75 lines
2.9 KiB
Shell
Executable file
75 lines
2.9 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Orchestrates the install, as the original's scripts/setup.sh does, minus everything KDE:
|
|
# prerequisites, build, niri config, app themes. lib/log.sh draws what its C++ TUI drew.
|
|
#
|
|
# install.sh [--yes] [--themes installed|none|choose] [--no-packages] [--no-niri]
|
|
# [--no-themes] [--no-build]
|
|
#
|
|
# It installs the desktop plumbing niri lacks (portals, polkit, keyring, audio, fonts, icons) but
|
|
# never a terminal, editor, file manager or browser, nor writes dotfiles for them
|
|
# (foot, kitty, micro, btop, fish, vesktop, ...). Colour themes for other apps are opt-in
|
|
# (04-app-themes.sh) and can be changed any time in Nexus.
|
|
|
|
set -euo pipefail
|
|
export CAELESTIA_SETUP_RUNNING=1
|
|
|
|
BUNDLE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
SCRIPTS_DIR="$BUNDLE_DIR/scripts"
|
|
export BUNDLE_DIR
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
|
|
exec 9>"${XDG_RUNTIME_DIR:-/tmp}/caelestia-niri-setup.lock"
|
|
flock -n 9 || { echo "Another Caelestia setup is already running."; exit 1; }
|
|
|
|
source "$SCRIPTS_DIR/lib/log.sh"
|
|
source "$SCRIPTS_DIR/lib/privileges.sh"
|
|
source "$SCRIPTS_DIR/lib/packages.sh"
|
|
source "$SCRIPTS_DIR/lib/selection.sh"
|
|
|
|
export ASSUME_YES=0 THEMES=ask
|
|
STEPS=(01-ensure-prereqs 02-build-shell 03-niri 04-app-themes)
|
|
skip_step() { STEPS=("${STEPS[@]/$1/}"); }
|
|
|
|
while (($#)); do
|
|
case "$1" in
|
|
-y|--yes) ASSUME_YES=1 ;;
|
|
--themes) THEMES="${2:-}"; shift ;;
|
|
--themes=*) THEMES="${1#*=}" ;;
|
|
--no-packages) skip_step 01-ensure-prereqs ;;
|
|
--no-build) skip_step 02-build-shell ;;
|
|
--no-niri) skip_step 03-niri ;;
|
|
--no-themes) skip_step 04-app-themes ;;
|
|
-h|--help) sed -n '2,11p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
*) die "unknown option $1" ;;
|
|
esac
|
|
shift
|
|
done
|
|
case "$THEMES" in ask|installed|none|choose) ;; *) die "--themes takes installed, none or choose" ;; esac
|
|
export THEMES
|
|
|
|
export CAELESTIA_LOG="${XDG_CACHE_HOME:-$HOME/.cache}/caelestia-niri/install.log"
|
|
mkdir -p "$(dirname "$CAELESTIA_LOG")"
|
|
: >"$CAELESTIA_LOG"
|
|
|
|
declare -A TITLE=(
|
|
[01-ensure-prereqs]="What niri needs"
|
|
[02-build-shell]="Building the shell"
|
|
[03-niri]="Keybinds and autostart"
|
|
[04-app-themes]="Colours in other apps"
|
|
)
|
|
RUN=()
|
|
for step in "${STEPS[@]}"; do [[ -n "$step" ]] && RUN+=("$step"); done
|
|
|
|
ui_banner
|
|
for i in "${!RUN[@]}"; do
|
|
ui_step "$((i + 1))" "${#RUN[@]}" "${TITLE[${RUN[$i]}]}"
|
|
bash "$SCRIPTS_DIR/${RUN[$i]}.sh"
|
|
done
|
|
|
|
ui_step "${#RUN[@]}" "${#RUN[@]}" "Done"
|
|
ok "Start it with: caelestia shell (niri starts it itself after you log in again)"
|
|
info "Print opens screen capture, Mod+Space the launcher, Mod+Comma settings"
|
|
info "Colours: caelestia wallpaper -f <image> or caelestia scheme set -n <name>"
|
|
failed="${XDG_CACHE_HOME:-$HOME/.cache}/caelestia-niri/failed_packages.txt"
|
|
[[ -s "$failed" ]] && warn "Some packages did not install, listed in $failed"
|
|
info "Full log: $CAELESTIA_LOG"
|