Compare commits
No commits in common. "d95560c48cef70678cc4a1abb74ae3ecc6ff59be" and "94d91ff551c6d5e48f62090fe97e0ab67bf09e9a" have entirely different histories.
d95560c48c
...
94d91ff551
23
init.sh
23
init.sh
@ -1468,22 +1468,13 @@ 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"
|
||||||
|
|
||||||
# Generate the uninstall command at the fixed footprint + put it on $PATH as
|
# Install the uninstaller at the fixed footprint + put it on $PATH as
|
||||||
# `libreportal-uninstall` (same idea as the CLI wrapper above — generated by
|
# `libreportal-uninstall` — a location-agnostic command (it resolves the real
|
||||||
# init.sh, not a separate repo file). It just runs the engine's uninstall, so
|
# data roots from the systemd unit at run time), so users never type a data path.
|
||||||
# users never type a data path. $script_dir is baked in; /root/init.sh is a
|
if [[ -f "$script_dir/uninstall.sh" ]]; then
|
||||||
# fallback if the install tree is already gone.
|
sudo install -m 0755 -o root -g root "$script_dir/uninstall.sh" "$lp_lib_dir/uninstall.sh"
|
||||||
sudo tee "$lp_lib_dir/uninstall.sh" >/dev/null <<EOF
|
sudo ln -sfn "$lp_lib_dir/uninstall.sh" /usr/local/bin/libreportal-uninstall
|
||||||
#!/usr/bin/env bash
|
fi
|
||||||
# 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
Normal file
35
uninstall.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/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