Merge claude/1
This commit is contained in:
commit
d95560c48c
23
init.sh
23
init.sh
@ -1468,13 +1468,22 @@ EOF
|
|||||||
# Put it on $PATH via a symlink (replaces any older real file at this path).
|
# Put it on $PATH via a symlink (replaces any older real file at this path).
|
||||||
sudo ln -sfn "$command_script" "$command_symlink"
|
sudo ln -sfn "$command_script" "$command_symlink"
|
||||||
|
|
||||||
# Install the uninstaller at the fixed footprint + put it on $PATH as
|
# Generate the uninstall command at the fixed footprint + put it on $PATH as
|
||||||
# `libreportal-uninstall` — a location-agnostic command (it resolves the real
|
# `libreportal-uninstall` (same idea as the CLI wrapper above — generated by
|
||||||
# data roots from the systemd unit at run time), so users never type a data path.
|
# init.sh, not a separate repo file). It just runs the engine's uninstall, so
|
||||||
if [[ -f "$script_dir/uninstall.sh" ]]; then
|
# users never type a data path. $script_dir is baked in; /root/init.sh is a
|
||||||
sudo install -m 0755 -o root -g root "$script_dir/uninstall.sh" "$lp_lib_dir/uninstall.sh"
|
# fallback if the install tree is already gone.
|
||||||
sudo ln -sfn "$lp_lib_dir/uninstall.sh" /usr/local/bin/libreportal-uninstall
|
sudo tee "$lp_lib_dir/uninstall.sh" >/dev/null <<EOF
|
||||||
fi
|
#!/usr/bin/env bash
|
||||||
|
# LibrePortal uninstall command — generated by init.sh. Runs the engine's uninstall.
|
||||||
|
[[ \$EUID -eq 0 ]] || { echo "libreportal-uninstall must run as root (try: sudo)"; exit 1; }
|
||||||
|
_init="$script_dir/init.sh"; [[ -f "\$_init" ]] || _init="/root/init.sh"
|
||||||
|
[[ -f "\$_init" ]] || { echo "Cannot find init.sh to run the uninstall."; exit 1; }
|
||||||
|
exec bash "\$_init" "\$@" uninstall
|
||||||
|
EOF
|
||||||
|
sudo chmod 0755 "$lp_lib_dir/uninstall.sh"
|
||||||
|
sudo chown root:root "$lp_lib_dir/uninstall.sh"
|
||||||
|
sudo ln -sfn "$lp_lib_dir/uninstall.sh" /usr/local/bin/libreportal-uninstall
|
||||||
source $sudo_bashrc
|
source $sudo_bashrc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
35
uninstall.sh
35
uninstall.sh
@ -1,35 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# LibrePortal uninstaller — convenience launcher.
|
|
||||||
#
|
|
||||||
# sudo ./uninstall.sh # remove everything
|
|
||||||
# sudo ./uninstall.sh --skip-docker-images # keep the rootless docker layer
|
|
||||||
#
|
|
||||||
# The real teardown lives in init.sh (runFullUninstall), which self-resolves the
|
|
||||||
# install's actual roots/manager from the baked systemd unit — so this just finds
|
|
||||||
# the installed init.sh and runs it. Works regardless of where LibrePortal was
|
|
||||||
# installed (custom --system-dir, etc.).
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
[[ $EUID -eq 0 ]] || { echo "uninstall.sh must run as root (try: sudo)" >&2; exit 1; }
|
|
||||||
|
|
||||||
# Prefer the system root baked into the systemd unit; then common defaults; then
|
|
||||||
# the bootstrap copy in /root; then a sibling init.sh next to this script.
|
|
||||||
unit=/etc/systemd/system/libreportal.service
|
|
||||||
sysdir=""
|
|
||||||
[[ -f "$unit" ]] && sysdir=$(grep -oE 'LP_SYSTEM_DIR=\S+' "$unit" | head -1 | cut -d= -f2)
|
|
||||||
|
|
||||||
init=""
|
|
||||||
for cand in \
|
|
||||||
${sysdir:+"$sysdir/install/init.sh"} \
|
|
||||||
/libreportal-system/install/init.sh \
|
|
||||||
/docker/install/init.sh \
|
|
||||||
/root/init.sh \
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/init.sh"; do
|
|
||||||
[[ -n "$cand" && -f "$cand" ]] && { init="$cand"; break; }
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ -n "$init" ]] || { echo "uninstall.sh: could not find init.sh to run the uninstall." >&2; exit 1; }
|
|
||||||
|
|
||||||
echo "Running uninstall via $init ..."
|
|
||||||
exec bash "$init" "$@" uninstall
|
|
||||||
Loading…
x
Reference in New Issue
Block a user