28 lines
1.3 KiB
Shell
Executable file
28 lines
1.3 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Builds the shell and CLI (cargo, release) and installs them with the assets. The
|
|
# original builds a C++ plugin and Quickshell config here; ours is two binaries.
|
|
|
|
set -euo pipefail
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib/log.sh"
|
|
|
|
BUNDLE_DIR="${BUNDLE_DIR:?BUNDLE_DIR not set}"
|
|
BIN="${CAELESTIA_BIN:-$HOME/.local/bin}"
|
|
DATA="${XDG_DATA_HOME:-$HOME/.local/share}/caelestia-niri"
|
|
|
|
echo
|
|
[[ -x "$BUNDLE_DIR/bin/caelestia-shell" ]] || command -v cargo >/dev/null 2>&1 || die "cargo is not installed (pacman -S rust, or https://rustup.rs)"
|
|
|
|
mkdir -p "$BIN"
|
|
if [[ -x "$BUNDLE_DIR/bin/caelestia-shell" ]]; then
|
|
# A release carries its binaries, so it needs no compiler.
|
|
install -m755 "$BUNDLE_DIR/bin/caelestia" "$BUNDLE_DIR/bin/caelestia-shell" "$BIN/"
|
|
else
|
|
build() { cd "$BUNDLE_DIR" && { cargo build --release --locked || cargo build --release; }; }
|
|
ui_run "Compiling (a first build takes a few minutes)" build || die "build failed"
|
|
install -m755 "$BUNDLE_DIR/target/release/caelestia" "$BUNDLE_DIR/target/release/caelestia-shell" "$BIN/"
|
|
fi
|
|
rm -rf "$DATA"
|
|
mkdir -p "$DATA"
|
|
cp -r "$BUNDLE_DIR/assets/." "$DATA/"
|
|
ok "Installed caelestia and caelestia-shell to $BIN, assets to $DATA"
|
|
case ":$PATH:" in *":$BIN:"*) ;; *) warn "$BIN is not on your PATH" ;; esac
|