summarylogtreecommitdiffstats
path: root/sysc-greet.install
blob: 1efcb35a6dbe7b8d07e970de2d8a4ef5bac054b0 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
post_install() {
    echo "==> Creating greeter user..."
    # FIXED 2025-10-15 - Add render group for Intel/AMD iGPU support on laptops
    # Modern Linux uses 'render' group for /dev/dri/renderD* device access
    if ! id greeter &>/dev/null; then
        useradd -M -G video,render,input -s /usr/bin/nologin greeter
    else
        # User exists - ensure they have required groups for GPU access
        # CRITICAL: Fixes "greeter exited without creating session" on laptops
        usermod -aG video,render,input greeter
    fi

    echo "==> Setting permissions..."
    chown -R greeter:greeter /var/cache/sysc-greet
    chown -R greeter:greeter /var/lib/greeter
    chmod 755 /var/lib/greeter

    echo "==> Configuring greetd for niri..."
    if [ -f /etc/greetd/config.toml ]; then
        cp /etc/greetd/config.toml /etc/greetd/config.toml.bak
        echo "    Backed up existing config to /etc/greetd/config.toml.bak"
    fi
    cat > /etc/greetd/config.toml <<'EOF'
[terminal]
vt = 1

[default_session]
command = "niri -c /etc/greetd/niri-greeter-config.kdl"
user = "greeter"
EOF

    echo "==> Enabling greetd service..."
    systemctl enable greetd.service

    echo ""
    echo "                       ▄▀▀▀▀ █   █ ▄▀▀▀▀ ▄▀▀▀▀    ▄▀    ▄▀ "
    echo "                        ▀▀▀▄ ▀▀▀▀█  ▀▀▀▄ █      ▄▀    ▄▀   "
    echo "                       ▀▀▀▀  ▀▀▀▀▀ ▀▀▀▀   ▀▀▀▀ ▀     ▀     "
    echo "                      //  SEE YOU SPACE COWBOY //          "
    echo ""
    echo "sysc-greet (niri) installed successfully!"
    echo ""
    echo "IMPORTANT: You must REBOOT to start using sysc-greet."
    echo "           Logging out is NOT sufficient when switching compositors."
    echo ""
}

post_upgrade() {
    echo "==> Updating greeter user groups..."
    # FIXED 2025-10-15 - Add render group for Intel/AMD iGPU support on laptops
    usermod -aG video,render,input greeter 2>/dev/null || true

    echo "==> Setting permissions..."
    chown -R greeter:greeter /var/cache/sysc-greet 2>/dev/null || true
    chown -R greeter:greeter /var/lib/greeter 2>/dev/null || true

    # Remove source_profile=false if present (was added in v1.1.3, causes user session breakage)
    if [ -f /etc/greetd/config.toml ] && grep -q 'source_profile' /etc/greetd/config.toml; then
        echo "==> Removing source_profile setting from greetd config..."
        cp /etc/greetd/config.toml /etc/greetd/config.toml.bak
        sed -i '/^\[general\]/d; /^source_profile/d' /etc/greetd/config.toml
        sed -i '/^$/N;/^\n$/d' /etc/greetd/config.toml
    fi

    echo ""
    echo "                       ▄▀▀▀▀ █   █ ▄▀▀▀▀ ▄▀▀▀▀    ▄▀    ▄▀ "
    echo "                        ▀▀▀▄ ▀▀▀▀█  ▀▀▀▄ █      ▄▀    ▄▀   "
    echo "                       ▀▀▀▀  ▀▀▀▀▀ ▀▀▀▀   ▀▀▀▀ ▀     ▀     "
    echo "                      //  SEE YOU SPACE COWBOY //          "
    echo ""
    echo "sysc-greet upgraded to v1.1.6"
    echo ""
    echo "What's new:"
    echo "  v1.1.6: New backgrounds (Sonar, Cracktro, Plasma), condensed F3 notes"
    echo "  v1.1.5: Animation speed control (Slow/Normal/Fast), installer beam effect"
    echo "  v1.1.4: Fix wallpaper startup race condition, remove source_profile global override"
    echo ""
    echo "IMPORTANT: You must REBOOT to apply changes."
    echo "           Logging out is NOT sufficient when switching compositors."
    echo ""
}

pre_remove() {
    echo "==> Disabling greetd service..."
    systemctl disable greetd.service 2>/dev/null || true
}