mirror of
https://github.com/zebrajr/HomeLab.git
synced 2026-01-15 12:15:06 +00:00
Compare commits
6 Commits
b8a5d8d4f7
...
f888376e9f
| Author | SHA1 | Date | |
|---|---|---|---|
| f888376e9f | |||
| 749526dbb6 | |||
| 601f61c3e0 | |||
| 11905f0681 | |||
| 898cec8757 | |||
| 2d6b9ce516 |
@@ -7,7 +7,8 @@ This repository contains a collection of scripts to automate Fedora system setup
|
|||||||
## Usage Instructions
|
## Usage Instructions
|
||||||
|
|
||||||
### Preparation
|
### Preparation
|
||||||
1. Review and modify `settings.conf` to configure system-specific options
|
1. Generate your custom `settings.conf` by running `./generate_settings.sh`
|
||||||
|
- You can also make a copy of `settings.conf.sample` and edit it manually
|
||||||
2. Inspect the scripts to ensure they meet your specific requirements
|
2. Inspect the scripts to ensure they meet your specific requirements
|
||||||
3. Run `setup_fedora.sh` to begin the deployment process
|
3. Run `setup_fedora.sh` to begin the deployment process
|
||||||
|
|
||||||
|
|||||||
167
fedora-bootstrap/generate_settings.sh
Executable file
167
fedora-bootstrap/generate_settings.sh
Executable file
@@ -0,0 +1,167 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# config_generator.sh
|
||||||
|
|
||||||
|
# Configuration file path
|
||||||
|
CONFIG_FILE="./settings.conf"
|
||||||
|
OPT_BE_VERBOSE=false
|
||||||
|
OPT_INSTALLING_PRE_TEXT=":: Installing - "
|
||||||
|
OPT_SKIPPING_PRE_TEXT="Skipping > "
|
||||||
|
|
||||||
|
# Function to prompt for yes/no questions with default as no
|
||||||
|
prompt_yes_no() {
|
||||||
|
local prompt="$1"
|
||||||
|
read -p "$prompt [y/N]: " response
|
||||||
|
response=$(echo "$response" | tr '[:upper:]' '[:lower:]')
|
||||||
|
[[ "$response" == "y" || "$response" == "yes" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to prompt for free input
|
||||||
|
prompt_input() {
|
||||||
|
local prompt="$1"
|
||||||
|
local default="$2"
|
||||||
|
read -p "$prompt ${default:+(current: $default)}: " response
|
||||||
|
echo "${response:-$default}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Backup existing config file if it exists
|
||||||
|
if [ -f "$CONFIG_FILE" ]; then
|
||||||
|
echo "Previous configuration file detected!"
|
||||||
|
mv "$CONFIG_FILE" "${CONFIG_FILE}.backup"
|
||||||
|
echo "Existing config file backed up."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create new config file
|
||||||
|
touch "$CONFIG_FILE"
|
||||||
|
|
||||||
|
# System Questions
|
||||||
|
ANSWER_HOSTNAME=$(prompt_input "Enter device hostname:" "$HOSTNAME")
|
||||||
|
ANSWER_USERNAME=$(prompt_input "Enter target user" "$USER")
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you want to setup Hyprland?"; then
|
||||||
|
ANSWER_SETUP_HYPRLAND=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_HYPRLAND=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Are you using an NVIDIA GPU?"; then
|
||||||
|
ANSWER_SETUP_NVIDIA=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_NVIDIA=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Packages Questions
|
||||||
|
if prompt_yes_no "Do you want core TTY utilities? (probably yes)"; then
|
||||||
|
ANSWER_SETUP_CORE_TTY=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_CORE_TTY=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you want core GUI utilities?"; then
|
||||||
|
ANSWER_SETUP_CORE_GUI=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_CORE_GUI=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you work on this device?"; then
|
||||||
|
ANSWER_SETUP_WORKSTATION=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_WORKSTATION=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if prompt_yes_no "Is this a personal device?"; then
|
||||||
|
ANSWER_SETUP_PERSONAL=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_PERSONAL=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you play games on this device?"; then
|
||||||
|
ANSWER_SETUP_GAMING=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_GAMING=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you develop (code) on this device?"; then
|
||||||
|
ANSWER_SETUP_DEVELOPMENT=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_DEVELOPMENT=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Do you gamedev on this device?"; then
|
||||||
|
ANSWER_SETUP_GAMEDEV=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_GAMEDEV=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if prompt_yes_no "Is this a VPS?"; then
|
||||||
|
ANSWER_SETUP_VPS=true
|
||||||
|
else
|
||||||
|
ANSWER_SETUP_VPS=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Write configuration to file
|
||||||
|
cat > "$CONFIG_FILE" << EOF
|
||||||
|
# settings.conf
|
||||||
|
# Auto-Generated Configuration File
|
||||||
|
#####################
|
||||||
|
## System Settings
|
||||||
|
#####################
|
||||||
|
|
||||||
|
TARGET_HOSTNAME="$ANSWER_HOSTNAME"
|
||||||
|
MAIN_USER="$ANSWER_USERNAME"
|
||||||
|
SETUP_NVIDIA=$ANSWER_SETUP_NVIDIA
|
||||||
|
ANSWER_SETUP_HYPRLAND=$ANSWER_SETUP_HYPRLAND
|
||||||
|
|
||||||
|
## Core Utitilities - We probably want this in all systems
|
||||||
|
### btop, curl, duf, fastfetch, fzf, ghostty, git, ncdu, neovim, nmtui, rsync, timeshift, tmux, vim, wget, zsh, ohmyzsh
|
||||||
|
SETUP_CORE_TTY=$ANSWER_SETUP_CORE_TTY
|
||||||
|
### vlc, gparted, flameshot, pipewire
|
||||||
|
SETUP_CORE_GUI=$ANSWER_SETUP_CORE_GUI
|
||||||
|
|
||||||
|
## Work Systems - Do we work on this device?
|
||||||
|
### docker, docker-compose, LibreOffice, nmap, qemu-kvm, virt-manager, drawio
|
||||||
|
SETUP_WORKSTATION=$ANSWER_SETUP_WORKSTATION
|
||||||
|
|
||||||
|
## Personal Use - Do we use this device for personal things?
|
||||||
|
### Clementine, KeepassXC, LibreOffice, Syncthing, darktable, inkscape, gimp
|
||||||
|
SETUP_PERSONAL=$ANSWER_SETUP_PERSONAL
|
||||||
|
|
||||||
|
## Gaming Things - Are we Playing Games?
|
||||||
|
### steam, gamescope, bottles
|
||||||
|
SETUP_GAMING=$ANSWER_SETUP_GAMING
|
||||||
|
|
||||||
|
## Development - Do we develop on this machine?
|
||||||
|
### golang, nodejs, zed
|
||||||
|
SETUP_DEVELOPMENT=$ANSWER_SETUP_DEVELOPMENT
|
||||||
|
|
||||||
|
## GameDev - Do we develop GAMES on this machine?
|
||||||
|
### godot
|
||||||
|
SETUP_GAMEDEV=$ANSWER_SETUP_GAMEDEV
|
||||||
|
|
||||||
|
## VPS Utilities- Is it a VPS?
|
||||||
|
### docker, docker-compose
|
||||||
|
SETUP_VPS=$ANSWER_SETUP_VPS
|
||||||
|
|
||||||
|
|
||||||
|
#####################
|
||||||
|
## Script Settings
|
||||||
|
#####################
|
||||||
|
# true will give full command output | false will just display written echos
|
||||||
|
BE_VERBOSE=$OPT_BE_VERBOSE
|
||||||
|
|
||||||
|
INSTALLING_PRE_TEXT="$OPT_INSTALLING_PRE_TEXT"
|
||||||
|
SKIPPING_PRE_TEXT="$OPT_SKIPPING_PRE_TEXT"
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Configuration file created at $CONFIG_FILE"
|
||||||
@@ -16,3 +16,25 @@ fi
|
|||||||
|
|
||||||
echo "${INSTALLING_PRE_TEXT} docker, docker-compose"
|
echo "${INSTALLING_PRE_TEXT} docker, docker-compose"
|
||||||
eval "sudo dnf install docker docker-compose -y $OUTPUT_CONTROL"
|
eval "sudo dnf install docker docker-compose -y $OUTPUT_CONTROL"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$MAIN_USER" ]; then
|
||||||
|
echo "MAIN_USER is not set. Skipping adding user to docker group"
|
||||||
|
else
|
||||||
|
echo "Adding ${MAIN_USER} to docker group"
|
||||||
|
eval "sudo usermod -aG docker $MAIN_USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SETUP_NVIDIA" != true ]; then
|
||||||
|
echo "${SKIPPING_PRE_TEXT} nvidia container toolkit. SETUP_NVIDIA is not true"
|
||||||
|
else
|
||||||
|
echo "Adding nvidia-container-toolkit repo"
|
||||||
|
eval "curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo"
|
||||||
|
|
||||||
|
echo "${INSTALLING_PRE_TEXT} nvidia-container-tookit"
|
||||||
|
eval "sudo dnf install -y nvidia-container-toolkit -y $OUTPUT_CONTROL"
|
||||||
|
eval "sudo nvidia-ctk runtime configure --runtime=docker"
|
||||||
|
eval "sudo systemctl restart docker"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -6,3 +6,12 @@ fi
|
|||||||
|
|
||||||
echo "${INSTALLING_PRE_TEXT} qemu-kvm virt-manager bridge-utils libvirt"
|
echo "${INSTALLING_PRE_TEXT} qemu-kvm virt-manager bridge-utils libvirt"
|
||||||
eval "sudo dnf install qemu-kvm virt-manager libvirt bridge-utils -y $OUTPUT_CONTROL"
|
eval "sudo dnf install qemu-kvm virt-manager libvirt bridge-utils -y $OUTPUT_CONTROL"
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$MAIN_USER" ]; then
|
||||||
|
"MAIN_USER is not set. Skipping adding user to libvirt"
|
||||||
|
else
|
||||||
|
echo "Adding ${MAIN_USER} to libvirt"
|
||||||
|
eval "sudo usermod -aG libvirt $MAIN_USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
8
fedora-bootstrap/packages/remmina.sh
Normal file
8
fedora-bootstrap/packages/remmina.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ "$SETUP_WORKSTATION" != "true" ]; then
|
||||||
|
echo "${SKIPPING_PRE_TEXT} remmina. SETUP_WORKSTATION is not true"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${INSTALLING_PRE_TEXT} remmina"
|
||||||
|
eval "sudo dnf install remmina -y $OUTPUT_CONTROL"
|
||||||
Reference in New Issue
Block a user