caelestia-niri/scripts/setup.sh

58 lines
2.1 KiB
Shell
Executable file

#!/usr/bin/env bash
# Orchestrates the install, as the original's scripts/setup.sh does, minus its C++ TUI and
# everything KDE: prerequisites, build, niri config, app themes.
#
# install.sh [--yes] [--themes installed|none|choose] [--no-packages] [--no-niri]
# [--no-themes] [--no-build]
#
# Nothing here installs a terminal, editor or file manager, or 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
echo
echo " Caelestia for niri"
for step in "${STEPS[@]}"; do
[[ -n "$step" ]] || continue
bash "$SCRIPTS_DIR/$step.sh"
done
echo
ok "Done. Start it with: caelestia shell (niri starts it itself after you log in again)"
info "Settings: Mod+Comma. Colours: caelestia wallpaper -f <image> or caelestia scheme set -n <name>"