summarylogtreecommitdiffstats
path: root/fpsd.install
blob: 49f436f0cf40ebfa827c9b75fac43f86467e8b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
post_install() {
    echo ":: First-time setup:"
    echo "::   mkdir -p ~/.config/fpsd ~/.local/share/fpsd/logs"
    echo "::   cp /usr/share/doc/fpsd-git/fpsd.yml.example ~/.config/fpsd/fpsd.yml"
    echo "::   Edit ~/.config/fpsd/fpsd.yml — set data_dir to ~/.local/share/fpsd"
    echo ":: Enable the service: systemctl --user enable --now fpsd"
    echo ":: Generate CA for MITM: fpsd generate-ca (safe — refuses to overwrite existing CA)"
    echo ":: Transparent proxy setup: sudo fps-ctl install --transparent --interface <IF>"
}

post_upgrade() {
    echo ":: Restart the service: systemctl --user restart fpsd"
}

pre_remove() {
    # pacman hooks run as root, so systemctl --user targets root's session.
    # Use --machine to target the actual user who owns the service.
    if [ -n "$SUDO_USER" ]; then
        systemctl --user --machine="$SUDO_USER@" stop fpsd.service 2>/dev/null || true
        systemctl --user --machine="$SUDO_USER@" disable fpsd.service 2>/dev/null || true
    fi
    echo ":: If fpsd is still running: systemctl --user stop fpsd"
}