202 lines
6.2 KiB
Bash
Executable File
202 lines
6.2 KiB
Bash
Executable File
#!/bin/bash -i
|
|
#
|
|
# Purpose : CoreDesktop installer
|
|
|
|
# Print the logo
|
|
print_logo() {
|
|
cat << "EOF"
|
|
|
|
██
|
|
█ ██
|
|
██ ██████ █████ ██ █████ █████ ████ ██ █████ ██
|
|
██ ██ ██ ███ ███████ ██ ██ ██ ██ ██ ████████ ██ ██ ███████
|
|
█████ ██████ ██ ██ ██████ ██ ████████ ██ █ ███████ ██ ██
|
|
██ ██████ ███████ ██████ ██ ██████ ██████ ██████ ███████
|
|
|
|
EOF
|
|
}
|
|
|
|
# Clear screen and show logo
|
|
clear
|
|
print_logo
|
|
cd
|
|
|
|
# Exit on any error
|
|
set -e
|
|
|
|
# Ask for sudo password upfront so subsequent sudo calls don't prompt mid-install
|
|
sudo -v
|
|
|
|
# Ensure git is available before attempting to clone anything
|
|
if ! command -v git &> /dev/null; then
|
|
echo "Installing git..."
|
|
sudo pacman -S git --noconfirm
|
|
else
|
|
echo "git is installed."
|
|
fi
|
|
|
|
# Clone the latest CoreDesktop repo into the standard data directory
|
|
echo "Getting the latest version of CoreDesktop..."
|
|
rm -rf ~/.local/share/coredesktop
|
|
git clone https://gitea.young.computer/david/coredesktop.git ~/.local/share/coredesktop > /dev/null
|
|
|
|
# Install the corerefresh and coreupdate management scripts to the user's bin
|
|
mkdir -p ~/.local/bin
|
|
sudo cp ~/.local/share/coredesktop/corerefresh ~/.local/bin/corerefresh
|
|
sudo cp ~/.local/share/coredesktop/coreupdate ~/.local/bin/coreupdate
|
|
|
|
cd ~/.local/share/coredesktop
|
|
|
|
# Source utility functions (provides install_packages and other helpers)
|
|
source utils.sh
|
|
|
|
# Source the package list (defines SYSTEM_UTILS, DEV_TOOLS, DESKTOP, etc. arrays)
|
|
if [ ! -f "packages.conf" ]; then
|
|
echo "Error: packages.conf not found!"
|
|
exit 1
|
|
fi
|
|
source packages.conf
|
|
|
|
echo "Starting full system setup..."
|
|
|
|
# Bring the system fully up to date before installing anything new
|
|
echo "Updating system..."
|
|
sudo pacman -Syu --noconfirm
|
|
|
|
cd ~/
|
|
|
|
# Install yay AUR helper if not present — required for AUR packages installed later
|
|
if ! command -v yay &> /dev/null; then
|
|
echo "Installing yay AUR helper..."
|
|
sudo pacman -S --needed git base-devel --noconfirm
|
|
if [[ -d "yay" ]]; then
|
|
echo "yay directory already exists, removing it..."
|
|
rm -rf yay
|
|
fi
|
|
echo "Cloning yay repository..."
|
|
git clone https://aur.archlinux.org/yay.git
|
|
cd yay
|
|
echo "Building yay..."
|
|
makepkg -si --noconfirm
|
|
cd ..
|
|
rm -rf yay
|
|
else
|
|
echo "yay is already installed."
|
|
fi
|
|
|
|
# Install packages grouped by category as defined in packages.conf
|
|
echo "Installing system utilities..."
|
|
install_packages "${SYSTEM_UTILS[@]}"
|
|
|
|
echo "Installing development tools..."
|
|
install_packages "${DEV_TOOLS[@]}"
|
|
|
|
echo "Installing system maintenance tools..."
|
|
install_packages "${MAINTENANCE[@]}"
|
|
|
|
echo "Installing desktop environment..."
|
|
install_packages "${DESKTOP[@]}"
|
|
|
|
echo "Installing office packages..."
|
|
install_packages "${OFFICE[@]}"
|
|
|
|
echo "Installing media packages..."
|
|
install_packages "${MEDIA[@]}"
|
|
|
|
echo "Installing fonts..."
|
|
install_packages "${FONTS[@]}"
|
|
|
|
# Enable all systemd services listed in SERVICES array, then register the SSH
|
|
# Avahi service so the machine is discoverable over mDNS
|
|
echo "Configuring services..."
|
|
for service in "${SERVICES[@]}"; do
|
|
if ! systemctl is-enabled "$service" &> /dev/null; then
|
|
echo "Enabling $service..."
|
|
sudo systemctl enable "$service"
|
|
else
|
|
echo "$service is already enabled."
|
|
fi
|
|
done
|
|
sudo cp /usr/share/doc/avahi/ssh.service /etc/avahi/services/
|
|
|
|
cd ~/.local/share/coredesktop
|
|
|
|
# Install GNOME shell extensions via the dedicated script
|
|
echo "Installing GNOME extensions..."
|
|
. gnome/gnome-extensions.sh
|
|
|
|
# Install Flatpak apps — some programs run better sandboxed as Flatpaks
|
|
echo "Installing flatpaks..."
|
|
. install-flatpaks.sh
|
|
|
|
# Install TPM (Tmux Plugin Manager) and configured plugins
|
|
echo "Installing tmux plug-in manager..."
|
|
. install-tpm.sh
|
|
|
|
# Install Mise version manager, then use it to set up Ruby and Rails
|
|
echo "Installing Mise, Ruby, Rails..."
|
|
cd ~/.local/share/coredesktop
|
|
. install-mise-ruby-rails.sh
|
|
|
|
# Install Kickstart Neovim config as the default Neovim configuration
|
|
echo "Installing Kickstart Neovim..."
|
|
. install-kickstart-nvim.sh
|
|
|
|
# Add the current user to the docker group and start the Docker daemon
|
|
sudo usermod -aG docker $USER
|
|
newgrp docker
|
|
sudo systemctl enable docker.service
|
|
sudo systemctl start docker.service
|
|
|
|
# Apply GNOME dconf settings only if the settings file has changed since last run
|
|
# (tracked via an MD5 checksum to avoid redundant writes)
|
|
SRC="$HOME/.local/share/coredesktop/gnome/gnome-settings.dconf"
|
|
CHECKSUM_FILE="$HOME/.local/share/coredesktop/gnome/.gnome-settings.md5"
|
|
|
|
if [ ! -f "$SRC" ]; then
|
|
echo "Error: $SRC not found, exiting."
|
|
exit 1
|
|
fi
|
|
|
|
CURRENT_SUM=$(md5sum "$SRC" | awk '{print $1}')
|
|
|
|
if [ -f "$CHECKSUM_FILE" ]; then
|
|
STORED_SUM=$(cat "$CHECKSUM_FILE")
|
|
else
|
|
STORED_SUM=""
|
|
fi
|
|
|
|
if [ "$CURRENT_SUM" != "$STORED_SUM" ]; then
|
|
echo "GNOME settings have changed, applying..."
|
|
dconf load /org/gnome/shell/extensions/ < "$SRC"
|
|
echo "$CURRENT_SUM" > "$CHECKSUM_FILE"
|
|
echo "Done."
|
|
else
|
|
echo "GNOME settings unchanged, skipping."
|
|
fi
|
|
|
|
# Fix mDNS configuration if systemd-resolved is managing DNS on this system
|
|
if systemctl is-enabled systemd-resolved.service &> /dev/null; then
|
|
echo "systemd-resolved is enabled, applying mDNS fix..."
|
|
bash ~/.local/share/coredesktop/fixmdns.sh
|
|
fi
|
|
|
|
# Check whether the running kernel matches the installed modules — if not, a
|
|
# newer kernel was installed during this run and a reboot is required
|
|
if ! ls /usr/lib/modules/$(uname -r) > /dev/null 2>&1; then
|
|
echo "A newer kernel has been installed, a reboot is recommended."
|
|
read -rp "Reboot now? [y/N] " response
|
|
case "$response" in
|
|
[yY][eE][sS]|[yY])
|
|
echo "Rebooting..."
|
|
sudo reboot
|
|
;;
|
|
*)
|
|
echo "Reboot skipped. Please remember to reboot when convenient."
|
|
exit 0
|
|
;;
|
|
esac
|
|
else
|
|
echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed."
|
|
fi
|