Krolyxon
Commit 70456f7

Branches

Refs →

aurora70456f7

install.sh: unattended --yes, services, plugins, chroot-aware desktop step

Author
krolyxon
Date
2026-11-08 18:54 +0530
Parent
4aa7bd9
Commit
70456f76ec65633ec66593fabb2a64d94cf61d21

+99 −29

2 files changed

  1. M install/desktop.sh +69 −28
  2. M install/lib.sh +30 −1
M install/desktop.sh View
@@ -1,6 +1,10 @@
11 # shellcheck shell=bash
22 # Desktop part: packages, dotfiles (stow), zsh, services. Sourced by install.sh;
33 # runs as the user, asks for sudo when it needs it.
4+# AURORA_CHROOT=1: run by the full install inside the new system's chroot (unattended,
5+# nothing is running there yet: no --now, no user bus).
6+
7+IN_CHROOT="${AURORA_CHROOT:-0}"
48
59 #################
610 ## GATEKEEPING ##
@@ -51,9 +55,26 @@ check_fresh_system() {
5155 read -rp "Type 'I understand' to continue anyway: " answer
5256 [[ "$answer" == "I understand" ]] || { log WARN "Aborted."; exit 1; }
5357 }
54−check_fresh_system
58+((IN_CHROOT)) || check_fresh_system
5559
5660
61+# Enable a unit (--user: a user unit). In the chroot nothing runs yet:
62+# no --now, and user units are enabled offline (--root writes the links into $HOME).
63+enable_unit() {
64+ if [[ "$1" == --user ]]; then
65+ shift
66+ if ((IN_CHROOT)); then
67+ systemctl --user --root=/ enable "$@"
68+ else
69+ systemctl --user daemon-reload && systemctl --user enable "$@"
70+ fi
71+ elif ((IN_CHROOT)); then
72+ sudo systemctl enable "$@"
73+ else
74+ sudo systemctl enable --now "$@"
75+ fi
76+}
77+
5778 install_prerequisites() {
5879 sudo pacman -S --needed --noconfirm stow gum git zsh
5980 }
@@ -88,31 +109,18 @@ This script is provided AS IS, WITHOUT ANY WARRANTY. It will:
88109 Proceed at your OWN RISK."
89110 )
90111
91−confirm "$DISCLAIMER
112+# The full install showed its own summary already
113+if ! ((IN_CHROOT)); then
114+ confirm "$DISCLAIMER
92115
93116 Do you understand the risks and want to continue?" || exit 1
117+fi
94118
95119
96120 #######################
97121 ## Package selection ##
98122 #######################
99−SELECTED_PKGS=()
100−for list in utils dev gpu optional aur; do
101− case "$list" in
102− utils) prompt_style "Important utilities (Most likely go with defaults)" ;;
103− dev) prompt_style "Select Development Tools" ;;
104− gpu) prompt_style "Select GPU drivers" ;;
105− optional) prompt_style "Select Optional Desktop Packages" ;;
106− aur) prompt_style "Select AUR packages" ;;
107− esac
108−
109− if ((AUTO_YES)); then
110− mapfile -t picked < <(preselected "$list")
111− else
112− gum_to_array picked < <(choose_packages "$list")
113− fi
114− SELECTED_PKGS+=("${picked[@]}")
115−done
123+pick_packages
116124
117125
118126 ##########################
@@ -160,11 +168,16 @@ Proceed with system configuration (stow, shell)?"; then
160168 && log SUCCESS "Dotfiles stowed successfully" \
161169 || log ERROR "Stow failed"
162170
171+ # Hyprland's Lua plugins are git checkouts, not in this repo (hyprland.lua also fetches them when missing)
172+ "$currentDir/.local/bin/hypr/hypr_update_plugins.sh" \
173+ && log SUCCESS "Hyprland plugins installed" \
174+ || log WARN "Couldn't fetch the Hyprland plugins, Hyprland fetches them at its first start"
175+
163176 #################################
164177 ## Change default shell to zsh ##
165178 #################################
166179 log INFO "Changing the default shell to ZSH"
167− if [[ "$SHELL" != "$(command -v zsh)" ]]; then
180+ if [[ "$(getent passwd "$USER" | cut -d: -f7)" != "$(command -v zsh)" ]]; then
168181 chsh -s "$(command -v zsh)" \
169182 && log SUCCESS "Default shell successfully set to zsh" \
170183 || log ERROR "Default shell could not be set to zsh"
@@ -190,16 +203,22 @@ if ((${#ALL_PKGS[@]})); then
190203 if confirm "Install all the selected packages?"; then
191204 log INFO "Installing selected packages..."
192205
206+ # --yes: no prompts at all (makepkg, paru's review and provider questions take their defaults)
207+ noconfirm=()
208+ ((AUTO_YES)) && noconfirm=(--noconfirm)
209+
193210 ## Installing paru if not installed already
194211 if ! command -v paru >/dev/null 2>&1; then
195212 log INFO "Installing Paru (AUR package manager)"
196213 sudo pacman -S --needed --noconfirm base-devel
197− git clone https://aur.archlinux.org/paru.git
198− (cd paru && makepkg -sri)
199− rm -rf paru
214+ build="$(mktemp -d)"
215+ git clone https://aur.archlinux.org/paru.git "$build/paru" \
216+ && (cd "$build/paru" && makepkg -sri "${noconfirm[@]}")
217+ rm -rf "$build"
200218 fi
201219
202− if paru -Syu --needed "${ALL_PKGS[@]}"; then
220+ ((AUTO_YES)) && noconfirm+=(--skipreview)
221+ if paru -Syu --needed "${noconfirm[@]}" "${ALL_PKGS[@]}"; then
203222 INSTALL_STATUS="complete"
204223 else
205224 INSTALL_STATUS="failed"
@@ -221,8 +240,8 @@ fi
221240 if command -v keyd >/dev/null 2>&1; then
222241 if confirm "Configure and enable keyd? "; then
223242 log INFO "Copying keyd configuration to /etc/keyd/default.conf"
224− sudo cp "$currentDir/system/etc/keyd/default.conf" /etc/keyd/
225− sudo systemctl enable --now keyd.service \
243+ sudo install -Dm644 "$currentDir/system/etc/keyd/default.conf" /etc/keyd/default.conf
244+ enable_unit keyd.service \
226245 && log SUCCESS "Successfully enabled keyd.service" \
227246 || log ERROR "Couldn't enable keyd.service"
228247 fi
@@ -242,6 +261,26 @@ if confirm "Unlock GNOME keyring at login (writes /etc/pam.d/login and passwd)?"
242261 fi
243262
244263
264+##############
265+## Services ##
266+##############
267+# What the desktop expects to be running (all optional packages: only if installed)
268+if confirm "Enable bluetooth, power-profiles-daemon and mpd-mpris (if installed)?"; then
269+ for unit in bluetooth power-profiles-daemon; do
270+ [[ -f "/usr/lib/systemd/system/$unit.service" ]] || continue
271+ enable_unit "$unit.service" \
272+ && log SUCCESS "Enabled $unit.service" \
273+ || log ERROR "Couldn't enable $unit.service"
274+ done
275+ # media keys reach mpd through mpd-mpris (playerctl)
276+ if [[ -f /usr/lib/systemd/user/mpd-mpris.service ]]; then
277+ enable_unit --user mpd-mpris.service \
278+ && log SUCCESS "Enabled mpd-mpris.service" \
279+ || log ERROR "Couldn't enable mpd-mpris.service"
280+ fi
281+fi
282+
283+
245284 #########################
246285 ## Enable aurora shell ##
247286 #########################
@@ -249,8 +288,7 @@ fi
249288 # enabling it also ties it to graphical-session.target. No --now: no session yet.
250289 if [[ -f "$HOME/.config/systemd/user/aurora-shell.service" ]]; then
251290 if confirm "Enable aurora-shell.service (the desktop shell)?"; then
252− systemctl --user daemon-reload
253− systemctl --user enable aurora-shell.service \
291+ enable_unit --user aurora-shell.service \
254292 && log SUCCESS "Successfully enabled aurora-shell.service" \
255293 || log ERROR "Couldn't enable aurora-shell.service (run 'systemctl --user enable aurora-shell' after logging in)"
256294 fi
@@ -306,3 +344,6 @@ Check the logs above.$BACKUP_NOTE"
306344 gum style --bold "Finished.$BACKUP_NOTE"
307345 ;;
308346 esac
347+
348+# the full install looks at this
349+[[ "$INSTALL_STATUS" != failed ]]
M install/lib.sh View
@@ -19,7 +19,8 @@ log() {
1919 }
2020
2121 usage() {
22− sed -n '3,19s/^# \{0,1\}//p' "$0"
22+ # install.sh's header comment, up to the first line that isn't a comment
23+ sed -n '3,/^[^#]/s/^# \{0,1\}//p' "$currentDir/install.sh"
2324 }
2425
2526 ###################
@@ -90,3 +91,31 @@ confirm() {
9091 fi
9192 gum confirm --default=false "$msg"
9293 }
94+
95+# Package pickers -> SELECTED_PKGS (desktop.txt is always installed, it has no picker).
96+# --picks FILE (from the full install) replaces them.
97+pick_packages() {
98+ SELECTED_PKGS=()
99+ if [[ -n "$PICKS" ]]; then
100+ gum_to_array SELECTED_PKGS < "$PICKS"
101+ return
102+ fi
103+
104+ local list picked
105+ for list in utils dev gpu optional aur; do
106+ case "$list" in
107+ utils) prompt_style "Important utilities (Most likely go with defaults)" ;;
108+ dev) prompt_style "Select Development Tools" ;;
109+ gpu) prompt_style "Select GPU drivers" ;;
110+ optional) prompt_style "Select Optional Desktop Packages" ;;
111+ aur) prompt_style "Select AUR packages" ;;
112+ esac
113+
114+ if ((AUTO_YES)); then
115+ mapfile -t picked < <(preselected "$list")
116+ else
117+ gum_to_array picked < <(choose_packages "$list")
118+ fi
119+ SELECTED_PKGS+=("${picked[@]}")
120+ done
121+}