summarylogtreecommitdiffstats
path: root/millennium.install
blob: 95acea065069795f5aa64896a7718953202f1628 (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
#!/bin/bash

# Remove legacy patches that Millennium used to use prior to JUL/6/2025
remove_deprecated_patches() {
    if test -f "/usr/bin/steam.millennium.bak"; then
        if grep -q "LD_PRELOAD" /usr/bin/steam.millennium.bak; then
            printf '#!/bin/sh\nexec /usr/lib/steam/steam "$@"\n' > /usr/bin/steam
        else
            mv /usr/bin/steam.millennium.bak /usr/bin/steam
        fi
    else
        # Check /usr/bin/steam directly if backup doesn't exist
        if test -f "/usr/bin/steam" && grep -q "LD_PRELOAD" /usr/bin/steam; then
            printf '#!/bin/sh\nexec /usr/lib/steam/steam "$@"\n' > /usr/bin/steam
        fi
    fi
}

for_each_steam_user() {
    local callback="$1"
    getent passwd | while IFS=: read -r _ _ uid _ _ home _; do
        [ "$uid" -ge 1000 ] || continue
        [ -d "$home/.local/share/Steam" ] || continue
        "$callback" "$home"
    done
}

link_millennium() {
    local home="$1"
    local steam="$home/.local/share/Steam"

    ln -sf /usr/lib/millennium/libmillennium_bootstrap_x86.so   "$steam/ubuntu12_32/libXtst.so.6"
    ln -sf /usr/lib/millennium/libmillennium_bootstrap_hhx64.so "$steam/ubuntu12_64/libXtst.so.6"
}

unlink_millennium() {
    local home="$1"
    local steam="$home/.local/share/Steam"

    rm -f "$steam/ubuntu12_32/libXtst.so.6"
    rm -f "$steam/ubuntu12_64/libXtst.so.6"
    rm -f "$home/.steam/steam/.cef-enable-remote-debugging"
}

post_install() {
    remove_deprecated_patches
    for_each_steam_user link_millennium
}

post_upgrade() {
    post_install
}

post_remove() {
    for_each_steam_user unlink_millennium
}