Files
gitlab-instance-0a899031_sh/d2ypp2/scripts/linux/uninstall_stack.sh
root fa422fb7b8 s
2026-05-18 13:49:53 +00:00

63 lines
2.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
INSTALL_TAG="uninstall"
. "$SELF_DIR/lib/common.sh"
ensure_root "$@"
load_env
log "Stopping systemd services"
for svc in live-edge.service live-console.service live-neko-ip-watch.service live-webtty.service live-android-panel.service live-pulseaudio.service live-kmscube.service live-redroid-host.service netdata cockpit.socket shellcrash.service avahi-daemon; do
systemctl stop "$svc" >/dev/null 2>&1 || true
systemctl disable "$svc" >/dev/null 2>&1 || true
done
log "Stopping dockerized services"
for compose_file in \
"$ROOT_DIR/services/srs/docker-compose.yml" \
"$ROOT_DIR/services/homepage/docker-compose.yml" \
"$ROOT_DIR/services/filebrowser/docker-compose.yml" \
"$ROOT_DIR/services/neko/docker-compose.yml" \
"$ROOT_DIR/services/mitmproxy/docker-compose.yml" \
"$ROOT_DIR/services/vscode-server/docker-compose.yml" \
"$ROOT_DIR/services/uptime-kuma/docker-compose.yml" \
"$ROOT_DIR/services/openclaw/docker-compose.yml"
do
[ -f "$compose_file" ] || continue
compose_in_service_dir "$compose_file" down >/dev/null 2>&1 || true
done
log "Stopping Redroid default instance"
if command -v docker >/dev/null 2>&1; then
docker rm -f "${REDROID_INSTANCE_PREFIX:-redroid13}-1" >/dev/null 2>&1 || true
fi
if command -v mountpoint >/dev/null 2>&1; then
mountpoint -q /dev/binderfs && umount /dev/binderfs >/dev/null 2>&1 || true
elif grep -qE '[[:space:]]/dev/binderfs[[:space:]]' /proc/mounts 2>/dev/null; then
umount /dev/binderfs >/dev/null 2>&1 || true
fi
log "Removing systemd unit files"
rm -f /etc/systemd/system/live-edge.service
rm -f /etc/systemd/system/live-console.service
rm -f /etc/systemd/system/live-neko-ip-watch.service
rm -f /etc/systemd/system/live-webtty.service
rm -f /etc/systemd/system/live-android-panel.service
rm -f /etc/systemd/system/live-pulseaudio.service
rm -f /etc/systemd/system/live-kmscube.service
rm -f /etc/systemd/system/live-redroid-host.service
rm -f /etc/modules-load.d/live-redroid.conf
rm -f /etc/modprobe.d/live-redroid.conf
rm -f /etc/sudoers.d/live-control-plane
systemctl daemon-reload
cat <<EOF
Uninstall completed for the managed live stack.
Repository files were kept in place:
$ROOT_DIR
EOF