Streamline the installer for fresh Arch installs
This commit is contained in:
1 parent
501d066e64
commit
d59725f193
14 files changed
+234
-44
No files matched your search
@@ -32,6 +32,6 @@ install_boot_splash() {
|
||||
if BLOB_PATH="$blob_path" "$repo_dir/bin/blob-boot" "$boot_splash_image"; then
|
||||
say "set boot splash to branding/blob_boot.png"
|
||||
else
|
||||
say "WARN could not set the boot splash; run 'blob boot' to retry"
|
||||
warn "could not set the boot splash; run 'blob boot' to retry"
|
||||
fi
|
||||
}
|
||||
@@ -15,7 +15,7 @@ link_blob_path() {
|
||||
fi
|
||||
|
||||
if [[ -e $blob_path && ! -L $blob_path ]]; then
|
||||
say "WARN $blob_path exists and is not a symlink; move it aside first"
|
||||
warn "$blob_path exists and is not a symlink; move it aside first"
|
||||
note_change
|
||||
return 0
|
||||
fi
|
||||
|
||||
+21
-7
@@ -71,7 +71,7 @@ report_greeter_compositor() {
|
||||
[[ -n $binary ]] || return 0
|
||||
command -v "$binary" &>/dev/null && return 0
|
||||
|
||||
say "WARN the greeter's compositor command '$binary' is not installed"
|
||||
warn "the greeter's compositor command '$binary' is not installed"
|
||||
say " SDDM cannot draw a greeter without it; it is set in $blob_greeter_conf"
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ report_login_conflicts() {
|
||||
session_entry_exists "$session" && continue
|
||||
|
||||
found=true
|
||||
say "WARN $file autologs into $session, which is not installed"
|
||||
warn "$file autologs into $session, which is not installed"
|
||||
done
|
||||
|
||||
if [[ $found == true ]]; then
|
||||
@@ -107,10 +107,10 @@ report_login_conflicts() {
|
||||
enable_display_manager() {
|
||||
if ! system_unit_exists sddm.service; then
|
||||
if package_installed sddm; then
|
||||
say "WARN sddm is installed but sddm.service is not visible to systemd"
|
||||
warn "sddm is installed but sddm.service is not visible to systemd"
|
||||
say " run 'sudo systemctl daemon-reload', then ./install.sh again"
|
||||
else
|
||||
say "WARN sddm is not installed; the desktop cannot start at boot"
|
||||
warn "sddm is not installed; the desktop cannot start at boot"
|
||||
say " install it with 'sudo pacman -S sddm', then ./install.sh again"
|
||||
fi
|
||||
return 0
|
||||
@@ -144,7 +144,7 @@ enable_display_manager() {
|
||||
if as_root systemctl enable sddm.service; then
|
||||
say "enable sddm.service"
|
||||
else
|
||||
say "WARN could not enable sddm.service"
|
||||
warn "could not enable sddm.service"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -152,7 +152,7 @@ enable_display_manager() {
|
||||
if as_root systemctl set-default graphical.target; then
|
||||
say "set default target to graphical.target"
|
||||
else
|
||||
say "WARN could not set the default target to graphical.target"
|
||||
warn "could not set the default target to graphical.target"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -184,8 +184,22 @@ launch_desktop() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if reboot_chosen; then
|
||||
say "Rebooting into Blob."
|
||||
as_root systemctl reboot
|
||||
return 0
|
||||
fi
|
||||
|
||||
say "Starting the login screen. Pick the Blob session to log in."
|
||||
as_root systemctl start sddm.service || {
|
||||
say "WARN sddm.service did not start; see 'systemctl status sddm'"
|
||||
warn "sddm.service did not start; see 'systemctl status sddm'"
|
||||
}
|
||||
}
|
||||
|
||||
reboot_chosen() {
|
||||
[[ -r /dev/tty ]] || return 1
|
||||
local answer
|
||||
say "A reboot brings up the network, boot splash and new kernel modules together."
|
||||
read -rp "Reboot now? [Y/n] " answer </dev/tty
|
||||
[[ -z $answer || $answer == [yY]* ]]
|
||||
}
|
||||
@@ -54,8 +54,6 @@ install_packages() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
blob_sudo_keepalive
|
||||
|
||||
if (( ${#repo_missing[@]} )); then
|
||||
say "install ${#repo_missing[@]} repo package(s)"
|
||||
install_repo_packages "${repo_missing[@]}"
|
||||
@@ -63,7 +61,7 @@ install_packages() {
|
||||
|
||||
if (( ${#aur_missing[@]} )); then
|
||||
ensure_aur_helper || {
|
||||
say "WARN no AUR helper; skipping ${#aur_missing[@]} AUR package(s): ${aur_missing[*]}"
|
||||
warn "no AUR helper; skipping ${#aur_missing[@]} AUR package(s): ${aur_missing[*]}"
|
||||
return 0
|
||||
}
|
||||
say "install ${#aur_missing[@]} AUR package(s)"
|
||||
@@ -75,20 +73,17 @@ install_repo_packages() {
|
||||
local package
|
||||
local -a failed=()
|
||||
|
||||
as_root pacman -S --needed --noconfirm "$@" && return 0
|
||||
as_root pacman -Syu --needed --noconfirm "$@" && return 0
|
||||
|
||||
say "WARN the batch install failed; refreshing the package databases"
|
||||
as_root pacman -Sy --noconfirm || true
|
||||
as_root pacman -S --needed --noconfirm "$@" && return 0
|
||||
|
||||
say "WARN still failing; retrying one package at a time"
|
||||
say " the batch install failed; upgrading the system, then one package at a time"
|
||||
as_root pacman -Syu --noconfirm || true
|
||||
for package in "$@"; do
|
||||
as_root pacman -S --needed --noconfirm "$package" || failed+=("$package")
|
||||
done
|
||||
|
||||
(( ${#failed[@]} == 0 )) && return 0
|
||||
|
||||
say "WARN ${#failed[@]} repo package(s) failed to install: ${failed[*]}"
|
||||
warn "${#failed[@]} repo package(s) failed to install: ${failed[*]}"
|
||||
}
|
||||
|
||||
desktop_essentials=(sddm hyprland quickshell uwsm)
|
||||
@@ -106,7 +101,7 @@ report_desktop_essentials() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
say "WARN the desktop cannot start without: ${missing[*]}"
|
||||
warn "the desktop cannot start without: ${missing[*]}"
|
||||
say " install them with 'sudo pacman -S ${missing[*]}', then ./install.sh again"
|
||||
}
|
||||
|
||||
@@ -120,8 +115,8 @@ install_aur_packages() {
|
||||
|
||||
(( ${#failed[@]} == 0 )) && return 0
|
||||
|
||||
say "WARN ${#failed[@]} AUR package(s) failed to build: ${failed[*]}"
|
||||
say "WARN the install continued; retry them with 'yay -S <name>'"
|
||||
warn "${#failed[@]} AUR package(s) failed to build: ${failed[*]}"
|
||||
say " the install continued; retry them with 'yay -S <name>'"
|
||||
}
|
||||
|
||||
# A fresh Arch install has no AUR helper, and yay is not in the official
|
||||
@@ -148,7 +143,3 @@ ensure_aur_helper() {
|
||||
rm -rf "$build_dir"
|
||||
command -v yay &>/dev/null
|
||||
}
|
||||
|
||||
blob_sudo_keepalive() {
|
||||
sudo -v 2>/dev/null || true
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
conflicting_network_services=(
|
||||
systemd-networkd.service
|
||||
iwd.service
|
||||
dhcpcd.service
|
||||
netctl.service
|
||||
)
|
||||
|
||||
stop_install() {
|
||||
printf 'ERROR %s\n' "$1" >&2
|
||||
shift
|
||||
local detail
|
||||
for detail in "$@"; do
|
||||
printf ' %s\n' "$detail" >&2
|
||||
done
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_regular_user() {
|
||||
(( EUID != 0 )) && return 0
|
||||
stop_install "run install.sh as your own user, not as root" \
|
||||
"it installs into \$HOME and builds AUR packages, which makepkg refuses to do as root" \
|
||||
"it asks for sudo when it needs it"
|
||||
}
|
||||
|
||||
require_arch() {
|
||||
command -v pacman &>/dev/null && return 0
|
||||
stop_install "pacman not found; Blob installs on Arch Linux only"
|
||||
}
|
||||
|
||||
require_sudo() {
|
||||
[[ $check == true ]] && return 0
|
||||
command -v sudo &>/dev/null || stop_install "sudo is not installed" \
|
||||
"as root: pacman -S sudo, then add your user with visudo"
|
||||
sudo -v || stop_install "sudo did not accept this user" \
|
||||
"as root: add your user to the wheel group and allow it in visudo"
|
||||
}
|
||||
|
||||
require_internet() {
|
||||
[[ $check == true || $skip_packages == true ]] && return 0
|
||||
curl -fsS --max-time 15 -o /dev/null https://archlinux.org && return 0
|
||||
stop_install "no internet connection; packages cannot be downloaded" \
|
||||
"connect first (iwctl for Wi-Fi), or rerun with --skip-packages"
|
||||
}
|
||||
|
||||
report_network_conflicts() {
|
||||
local unit
|
||||
local -a enabled=()
|
||||
|
||||
for unit in "${conflicting_network_services[@]}"; do
|
||||
[[ "$(system_unit_state "$unit")" == enabled ]] && enabled+=("$unit")
|
||||
done
|
||||
|
||||
(( ${#enabled[@]} == 0 )) && return 0
|
||||
|
||||
warn "NetworkManager will be enabled, but so is: ${enabled[*]}"
|
||||
say " two network managers fight over the same interfaces after a reboot"
|
||||
say " once NetworkManager works: sudo systemctl disable ${enabled[*]}"
|
||||
}
|
||||
|
||||
sudo_keepalive_pid=""
|
||||
|
||||
start_sudo_keepalive() {
|
||||
[[ $check == true ]] && return 0
|
||||
while true; do
|
||||
sudo -n true 2>/dev/null
|
||||
sleep 60
|
||||
done &
|
||||
sudo_keepalive_pid=$!
|
||||
trap stop_sudo_keepalive EXIT
|
||||
}
|
||||
|
||||
stop_sudo_keepalive() {
|
||||
[[ -n $sudo_keepalive_pid ]] && kill "$sudo_keepalive_pid" 2>/dev/null
|
||||
sudo_keepalive_pid=""
|
||||
}
|
||||
|
||||
run_preflight() {
|
||||
require_regular_user
|
||||
require_arch
|
||||
require_sudo
|
||||
require_internet
|
||||
report_network_conflicts
|
||||
start_sudo_keepalive
|
||||
say "ok preflight"
|
||||
}
|
||||
@@ -13,14 +13,14 @@ reload_system_services() {
|
||||
fi
|
||||
|
||||
if ! as_root systemctl daemon-reload; then
|
||||
say "WARN could not reload systemd"
|
||||
warn "could not reload systemd"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local unit
|
||||
for unit in "${reloaded_system_services[@]}"; do
|
||||
system_unit_exists "$unit" || continue
|
||||
as_root systemctl try-restart "$unit" || say "WARN could not restart $unit"
|
||||
as_root systemctl try-restart "$unit" || warn "could not restart $unit"
|
||||
done
|
||||
|
||||
say "ok system services reloaded"
|
||||
@@ -45,7 +45,7 @@ reload_user_services() {
|
||||
done
|
||||
|
||||
if (( ${#failed[@]} > 0 )); then
|
||||
say "WARN could not restart: ${failed[*]}"
|
||||
warn "could not restart: ${failed[*]}"
|
||||
else
|
||||
say "ok user services reloaded"
|
||||
fi
|
||||
@@ -58,7 +58,7 @@ run_session_reload() {
|
||||
if BLOB_PATH="$blob_path" PATH="$blob_path/bin:$PATH" "$@" &>/dev/null; then
|
||||
say "ok $label reloaded"
|
||||
else
|
||||
say "WARN could not reload $label"
|
||||
warn "could not reload $label"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ enable_user_units() {
|
||||
local unit
|
||||
|
||||
if ! user_manager_available; then
|
||||
say "WARN no user systemd manager; skipping user services"
|
||||
warn "no user systemd manager; skipping user services"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ install_default_theme() {
|
||||
blob-theme-set "$default_theme" >/dev/null; then
|
||||
say "theme $default_theme"
|
||||
else
|
||||
say "WARN could not apply the $default_theme theme"
|
||||
warn "could not apply the $default_theme theme"
|
||||
say " the session will come up without a palette; run 'blob theme set $default_theme'"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user