Delegate file deployment to moonarch-git package
Refactor post-install.sh and transform.sh to install moonarch-git via paru instead of manually copying configs, scripts, and themes. Remove install-themes.sh (replaced by sweet-cursors-git dependency). Replace update.sh with deprecation notice that forwards to the package-provided moonarch-update in /usr/bin/.
This commit is contained in:
+41
-126
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# ABOUTME: Post-install script for Moonarch — installs packages, defaults and configures the system.
|
||||
# ABOUTME: Post-install script for Moonarch — installs moonarch-git package and configures the system.
|
||||
# ABOUTME: Run as regular user after the archinstall base installation.
|
||||
|
||||
set -euo pipefail
|
||||
@@ -11,17 +11,6 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh"
|
||||
check_not_root
|
||||
check_pacman
|
||||
|
||||
# --- Install official packages ---
|
||||
|
||||
log "Installing official packages..."
|
||||
if [[ -f "$OFFICIAL_PACKAGES" ]]; then
|
||||
# shellcheck disable=SC2046
|
||||
sudo pacman -S --needed --noconfirm $(read_packages "$OFFICIAL_PACKAGES")
|
||||
else
|
||||
err "Package list not found: $OFFICIAL_PACKAGES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Install paru (AUR Helper) ---
|
||||
|
||||
if ! command -v paru &>/dev/null; then
|
||||
@@ -34,17 +23,6 @@ else
|
||||
log "paru already installed."
|
||||
fi
|
||||
|
||||
# --- Install AUR packages ---
|
||||
|
||||
log "Installing AUR packages..."
|
||||
if [[ -f "$AUR_PACKAGES" ]]; then
|
||||
# shellcheck disable=SC2046
|
||||
paru -S --needed --noconfirm $(read_packages "$AUR_PACKAGES")
|
||||
else
|
||||
err "AUR package list not found: $AUR_PACKAGES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Set up Moonarch custom paru repo ---
|
||||
|
||||
log "Setting up Moonarch paru repo..."
|
||||
@@ -61,39 +39,19 @@ else
|
||||
fi
|
||||
|
||||
paru -Sy --pkgbuilds --noconfirm
|
||||
paru -S --needed --noconfirm moonset-git moonlock-git moongreet-git
|
||||
|
||||
# --- Install themes (cursor etc.) ---
|
||||
# --- Install moonarch-git (pulls in all configs, scripts, themes as dependencies) ---
|
||||
|
||||
log "Installing themes..."
|
||||
"$SCRIPT_DIR/install-themes.sh"
|
||||
log "Installing moonarch-git package..."
|
||||
paru -S --needed --noconfirm moonarch-git
|
||||
|
||||
# --- Install XDG defaults ---
|
||||
|
||||
log "Installing XDG defaults to /etc/xdg/..."
|
||||
sudo cp -r "$DEFAULTS_DIR/xdg/"* /etc/xdg/
|
||||
|
||||
# Ensure Rofi scripts are executable
|
||||
sudo find /etc/xdg/rofi -name "*.sh" -exec chmod +x {} \;
|
||||
|
||||
# --- GTK4 theme symlinks for libadwaita apps ---
|
||||
# --- User-level GTK4 symlinks for libadwaita apps ---
|
||||
|
||||
THEME_NAME="Colloid-Catppuccin"
|
||||
THEME_GTK4="/usr/share/themes/$THEME_NAME/gtk-4.0"
|
||||
GTK4_XDG="/etc/xdg/gtk-4.0"
|
||||
|
||||
if [[ -d "$THEME_GTK4" ]]; then
|
||||
log "Creating system-wide GTK4 symlinks for $THEME_NAME..."
|
||||
|
||||
# gtk.css points to gtk-dark.css so libadwaita apps load the dark theme
|
||||
sudo ln -sf "$THEME_GTK4/gtk-dark.css" "$GTK4_XDG/gtk.css"
|
||||
sudo ln -sf "$THEME_GTK4/gtk-dark.css" "$GTK4_XDG/gtk-dark.css"
|
||||
|
||||
# Assets symlink: remove first if exists (ln -sf on directories follows the link)
|
||||
sudo rm -f "$GTK4_XDG/assets"
|
||||
sudo ln -s "$THEME_GTK4/assets" "$GTK4_XDG/assets"
|
||||
# libadwaita only reads user CSS from ~/.config/gtk-4.0/, not /etc/xdg/ fallback.
|
||||
# Create per-user symlinks so the theme applies to libadwaita apps (e.g. Nautilus).
|
||||
log "Creating user-level GTK4 symlinks for $THEME_NAME..."
|
||||
USER_GTK4="$HOME/.config/gtk-4.0"
|
||||
mkdir -p "$USER_GTK4"
|
||||
ln -sf "$THEME_GTK4/gtk-dark.css" "$USER_GTK4/gtk.css"
|
||||
@@ -112,32 +70,32 @@ gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
gsettings set org.gnome.desktop.interface icon-theme 'Colloid-Grey-Catppuccin-Dark'
|
||||
gsettings set org.gnome.desktop.interface font-name 'UbuntuSans Nerd Font 11'
|
||||
|
||||
# --- Install helper scripts ---
|
||||
# --- Install user config defaults ---
|
||||
|
||||
log "Installing Moonarch helper scripts to /usr/local/bin/..."
|
||||
sudo install -m 755 "$DEFAULTS_DIR/bin/moonarch-"* /usr/local/bin/
|
||||
|
||||
# --- awww compatibility symlinks (waypaper still calls swww) ---
|
||||
|
||||
if command -v awww &>/dev/null && ! command -v swww &>/dev/null; then
|
||||
log "Creating swww -> awww compatibility symlinks..."
|
||||
sudo ln -s /usr/bin/awww /usr/local/bin/swww
|
||||
sudo ln -s /usr/bin/awww-daemon /usr/local/bin/swww-daemon
|
||||
log "Installing user config defaults to ~/.config/..."
|
||||
if [[ -d "$USER_DEFAULTS" ]]; then
|
||||
# Each subdirectory in user-defaults/ corresponds to a ~/.config/ directory.
|
||||
# Files are only copied if they don't exist yet (no overwriting).
|
||||
for src_dir in "$USER_DEFAULTS"/*/; do
|
||||
app_name="$(basename "$src_dir")"
|
||||
dest_dir="$HOME/.config/$app_name"
|
||||
mkdir -p "$dest_dir"
|
||||
find "$src_dir" -type f -print0 | while IFS= read -r -d '' src_file; do
|
||||
rel_path="${src_file#"$src_dir"}"
|
||||
dest_file="$dest_dir/$rel_path"
|
||||
if [[ ! -f "$dest_file" ]]; then
|
||||
mkdir -p "$(dirname "$dest_file")"
|
||||
cp "$src_file" "$dest_file"
|
||||
log " + $app_name/$rel_path"
|
||||
else
|
||||
log " ~ $app_name/$rel_path already exists, skipped."
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# --- Zsh configuration ---
|
||||
# --- Zsh user config ---
|
||||
|
||||
log "Installing Zsh default config..."
|
||||
sudo cp "$DEFAULTS_DIR/shell/zshrc" /etc/zsh/zshrc.moonarch
|
||||
|
||||
# Entry in /etc/zsh/zshrc to load Moonarch defaults
|
||||
# unless the user has their own ~/.zshrc
|
||||
if ! grep -q "zshrc.moonarch" /etc/zsh/zshrc 2>/dev/null; then
|
||||
echo '# Moonarch defaults (overridden by ~/.zshrc)' | sudo tee -a /etc/zsh/zshrc > /dev/null
|
||||
echo '[[ ! -f "$HOME/.zshrc" ]] && source /etc/zsh/zshrc.moonarch' | sudo tee -a /etc/zsh/zshrc > /dev/null
|
||||
fi
|
||||
|
||||
# If user has no .zshrc yet, link Moonarch defaults
|
||||
if [[ ! -f "$HOME/.zshrc" ]]; then
|
||||
log "No ~/.zshrc found — sourcing Moonarch defaults."
|
||||
mkdir -p "$HOME/.zshrc.d"
|
||||
@@ -145,18 +103,21 @@ if [[ ! -f "$HOME/.zshrc" ]]; then
|
||||
echo "source /etc/zsh/zshrc.moonarch" >> "$HOME/.zshrc"
|
||||
fi
|
||||
|
||||
# --- greetd / moongreet configuration ---
|
||||
# --- Enable systemd user services ---
|
||||
|
||||
log "Configuring greetd + moongreet..."
|
||||
sudo mkdir -p /etc/greetd
|
||||
sudo cp "$DEFAULTS_DIR/etc/greetd/config.toml" /etc/greetd/config.toml
|
||||
sudo mkdir -p /etc/moongreet
|
||||
sudo cp "$DEFAULTS_DIR/etc/moongreet/moongreet.toml" /etc/moongreet/moongreet.toml
|
||||
log "Enabling systemd user services..."
|
||||
USER_SERVICES=(
|
||||
"kanshi"
|
||||
)
|
||||
|
||||
# Install default wallpaper (greeter, lockscreen, desktop)
|
||||
log "Installing default wallpaper..."
|
||||
sudo mkdir -p /usr/share/moonarch
|
||||
sudo cp "$DEFAULTS_DIR/backgrounds/wallpaper.jpg" /usr/share/moonarch/wallpaper.jpg
|
||||
for service in "${USER_SERVICES[@]}"; do
|
||||
if systemctl --user list-unit-files "${service}.service" &>/dev/null; then
|
||||
systemctl --user enable "$service"
|
||||
log " + $service (user)"
|
||||
else
|
||||
log " ~ $service (user) not found, skipped."
|
||||
fi
|
||||
done
|
||||
|
||||
# --- Enable systemd services ---
|
||||
|
||||
@@ -201,57 +162,11 @@ if ! groups | grep -q docker; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
|
||||
# --- Install user config defaults ---
|
||||
|
||||
log "Installing user config defaults to ~/.config/..."
|
||||
USER_DEFAULTS_DIR="$DEFAULTS_DIR/user"
|
||||
if [[ -d "$USER_DEFAULTS_DIR" ]]; then
|
||||
# Each subdirectory in defaults/user/ corresponds to a ~/.config/ directory.
|
||||
# Files are only copied if they don't exist yet (no overwriting).
|
||||
for src_dir in "$USER_DEFAULTS_DIR"/*/; do
|
||||
app_name="$(basename "$src_dir")"
|
||||
dest_dir="$HOME/.config/$app_name"
|
||||
mkdir -p "$dest_dir"
|
||||
find "$src_dir" -type f -print0 | while IFS= read -r -d '' src_file; do
|
||||
rel_path="${src_file#"$src_dir"}"
|
||||
dest_file="$dest_dir/$rel_path"
|
||||
if [[ ! -f "$dest_file" ]]; then
|
||||
mkdir -p "$(dirname "$dest_file")"
|
||||
cp "$src_file" "$dest_file"
|
||||
log " + $app_name/$rel_path"
|
||||
else
|
||||
log " ~ $app_name/$rel_path already exists, skipped."
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# --- Enable systemd user services ---
|
||||
|
||||
log "Enabling systemd user services..."
|
||||
USER_SERVICES=(
|
||||
"kanshi"
|
||||
)
|
||||
|
||||
for service in "${USER_SERVICES[@]}"; do
|
||||
if systemctl --user list-unit-files "${service}.service" &>/dev/null; then
|
||||
systemctl --user enable "$service"
|
||||
log " + $service (user)"
|
||||
else
|
||||
log " ~ $service (user) not found, skipped."
|
||||
fi
|
||||
done
|
||||
|
||||
# --- Screenshots directory ---
|
||||
|
||||
mkdir -p "$HOME/Pictures/Screenshots"
|
||||
mkdir -p "$HOME/Pictures/Wallpaper"
|
||||
|
||||
# --- moonarch-update Symlink ---
|
||||
|
||||
log "Creating moonarch-update command..."
|
||||
sudo ln -sf "$PROJECT_DIR/scripts/update.sh" /usr/local/bin/moonarch-update
|
||||
|
||||
# --- Done ---
|
||||
|
||||
log ""
|
||||
|
||||
Reference in New Issue
Block a user