27 lines
1.1 KiB
Shell
27 lines
1.1 KiB
Shell
#!/usr/bin/env bash
|
|
# The footprint: with the shell built, the compiler the installer added and the build's output go.
|
|
# A compiler that was already here is not touched, and nothing runs without the tick. Updating
|
|
# later builds again, or use a release, which needs no compiler.
|
|
|
|
set -euo pipefail
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib/log.sh"
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib/privileges.sh"
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib/packages.sh"
|
|
|
|
echo
|
|
if [[ " ${OPTIONS-cleanup} " != *" cleanup "* ]]; then
|
|
skip "Build tools left in place"
|
|
exit 0
|
|
fi
|
|
list="${XDG_CACHE_HOME:-$HOME/.cache}/caelestia-niri/build-added"
|
|
mapfile -t added < <(sed '/^$/d' "$list" 2>/dev/null || true)
|
|
if ((${#added[@]})); then
|
|
ui_run "Removing build tools: ${added[*]}" remove_packages "${added[@]}" || warn "Something else needs them, so they stay"
|
|
fi
|
|
: >"$list"
|
|
if [[ -d "${BUNDLE_DIR:?}/target" ]]; then
|
|
size="$(du -sh "$BUNDLE_DIR/target" | cut -f1)"
|
|
rm -rf "${BUNDLE_DIR:?}/target"
|
|
ok "Removed the build's output ($size)"
|
|
fi
|
|
caelestia_stop_sudo_keepalive
|