summarylogtreecommitdiffstats
path: root/moonbit.install
blob: 72c59219145289f946f708569128b7795aebaa71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
post_install() {
    echo "==> Reloading systemd daemon..."
    systemctl daemon-reload

    echo ""
    cat <<'EOF'
█▀▄▀█ ▄▀▀▀▄ ▄▀▀▀▄ █▄  █ █▀▀▀▄ ▀▀█▀▀ ▀▀█▀▀    ▄▀    ▄▀
█   █ █   █ █   █ █ ▀▄█ █▀▀▀▄   █     █    ▄▀    ▄▀
▀   ▀  ▀▀▀   ▀▀▀  ▀   ▀ ▀▀▀▀  ▀▀▀▀▀   ▀   ▀     ▀

EOF
    echo "==> MoonBit v1.4.0 installed successfully!"
    echo ""
    echo "Usage:"
    echo "  moonbit                    # Interactive TUI"
    echo "  moonbit scan               # Scan and optionally clean"
    echo "  moonbit clean              # Preview files before cleaning"
    echo "  moonbit clean --force      # Actually delete files"
    echo "  moonbit scan --list-categories"
    echo ""
    echo "Automation (choose ONE mode):"
    echo ""
    echo "  Timer Mode (lightweight, periodic):"
    echo "    sudo systemctl enable --now moonbit-scan.timer   # Daily scans"
    echo "    sudo systemctl enable --now moonbit-clean.timer  # Weekly cleaning"
    echo ""
    echo "  Daemon Mode (long-running, continuous):"
    echo "    sudo systemctl enable --now moonbit-daemon.service"
    echo ""
    echo "  NOTE: Timer and Daemon modes are mutually exclusive."
    echo "        Do not enable both simultaneously."
    echo ""
    echo "Check status:"
    echo "  systemctl list-timers moonbit-*"
    echo "  systemctl status moonbit-daemon.service"
    echo ""
}

post_upgrade() {
    echo "==> Reloading systemd daemon..."
    systemctl daemon-reload

    echo ""
    cat <<'EOF'
█▀▄▀█ ▄▀▀▀▄ ▄▀▀▀▄ █▄  █ █▀▀▀▄ ▀▀█▀▀ ▀▀█▀▀    ▄▀    ▄▀
█   █ █   █ █   █ █ ▀▄█ █▀▀▀▄   █     █    ▄▀    ▄▀
▀   ▀  ▀▀▀   ▀▀▀  ▀   ▀ ▀▀▀▀  ▀▀▀▀▀   ▀   ▀     ▀

EOF
    echo "==> MoonBit upgraded to v1.4.0!"
    echo ""
    echo "New in v1.4.0: safer systemd automation, deep app-cache targets,"
    echo "category include/exclude controls, and better scan logging."
    echo "  moonbit scan --list-categories --mode deep"
    echo "  moonbit scan --mode deep --include-category 'opencode Caches'"
    echo "  sudo systemctl enable --now moonbit-daemon.service"
    echo ""
    echo "If you have enabled timers, they will continue running."
    echo "Check status: systemctl list-timers moonbit-*"
    echo "              systemctl status moonbit-daemon.service"
    echo ""
}

pre_remove() {
    echo "==> Disabling MoonBit services..."
    systemctl disable --now moonbit-scan.timer 2>/dev/null || true
    systemctl disable --now moonbit-clean.timer 2>/dev/null || true
    systemctl disable --now moonbit-daemon.service 2>/dev/null || true
    systemctl daemon-reload
}