summarylogtreecommitdiffstats
path: root/gpu-control.install
blob: 5293a70dd24742f48f432cbd43d9287a11774d5f (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
post_install() {
    if [ ! -f /etc/X11/xorg.conf.d/99-coolbits.conf ]; then
        mkdir -p /etc/X11/xorg.conf.d
        printf 'Section "Device"\n  Identifier "Device0"\n  Driver "nvidia"\n  Option "Coolbits" "31"\nEndSection\n' > /etc/X11/xorg.conf.d/99-coolbits.conf
    fi
    echo ">>> install completed"
    echo ">>> On first launch you'll be asked for your password once to set up permissions."
}

post_remove() {
    rm -f /etc/sudoers.d/gpu-control
    if systemctl is-enabled gpu-control.service > /dev/null 2>&1; then
        systemctl disable gpu-control.service
    fi
    rm -f /etc/systemd/system/gpu-control.service
    systemctl daemon-reload 2>/dev/null
    
    # Clean up helper scripts from all user home directories
    for user_home in /home/*; do
        if [ -d "$user_home/.local/bin" ]; then
            rm -f "$user_home/.local/bin/gpu-control-apply.sh"
            rm -f "$user_home/.local/bin/gpu-control-setup.sh"
            rm -f "$user_home/.local/bin/gpu-control-remove.sh"
            rm -f "$user_home/.local/bin/gpu-control-startup.sh"
        fi
    done
    # Also clean up root's home if applicable
    rm -f /root/.local/bin/gpu-control-apply.sh
    rm -f /root/.local/bin/gpu-control-setup.sh
    rm -f /root/.local/bin/gpu-control-remove.sh
    rm -f /root/.local/bin/gpu-control-startup.sh
    
    echo ">>> GPU Control removed. Settings will return to defaults after reboot."
}