feat(arje): reemplaza systemd en máquina real con coexistencia GRUB
1#!/usr/bin/env bash
2# uninstall-arje.sh — revierte lo que install-arje-as-init.sh hizo.
3#
4# - Borra /usr/sbin/ente-* y /usr/bin/{brahman-status,busctl,brainctl}.
5# - Borra el bloque ARJE-MENUENTRY de /etc/grub.d/40_custom.
6# - Regenera grub.cfg.
7# - NO toca /ente/seed.card.json (querés conservar customización).
8# - NO toca /sbin/init ni systemd.
9
10set -euo pipefail
11
12if [ "$(id -u)" -ne 0 ]; then
13 echo "[uninstall-arje] hace falta root" >&2
14 exit 1
15fi
16
17echo "[uninstall-arje] removiendo binarios"
18rm -f /usr/sbin/ente-zero
19for b in ente-echo ente-policy-provider \
20 ente-logind-compat ente-hostnamed-compat ente-timedated-compat \
21 ente-localed-compat ente-journald-compat ente-resolved-compat \
22 ente-polkit-compat ente-machined-compat ente-systemd1-compat \
23 ente-notify-compat ente-timer-compat ente-tmpfiles-compat \
24 ente-binfmt-compat; do
25 rm -f "/usr/sbin/$b"
26done
27for e in brahman-status busctl brainctl; do
28 rm -f "/usr/bin/$e"
29done
30
31echo "[uninstall-arje] limpiando menuentry de /etc/grub.d/40_custom"
32CUSTOM=/etc/grub.d/40_custom
33if [ -f "$CUSTOM" ] && grep -q "BEGIN ARJE-MENUENTRY" "$CUSTOM"; then
34 awk '/BEGIN ARJE-MENUENTRY/{f=1} /END ARJE-MENUENTRY/{f=0; next} !f' "$CUSTOM" \
35 > "$CUSTOM.tmp" && mv "$CUSTOM.tmp" "$CUSTOM"
36 chmod 0755 "$CUSTOM"
37fi
38
39if command -v update-grub >/dev/null 2>&1; then
40 update-grub
41elif command -v grub-mkconfig >/dev/null 2>&1; then
42 grub-mkconfig -o /boot/grub/grub.cfg
43fi
44
45echo "[uninstall-arje] hecho. /ente/seed.card.json conservado (borralo a mano si querés)."