summarylogtreecommitdiffstats
path: root/millennium.install
blob: 4b7028c32a95c804f77a4066e9c48be6827a683d (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
#!/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
}

post_install() {
    if [ -n "$SUDO_USER" ]; then
        USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
    else
        USER_HOME="$HOME"
    fi
    
    # Remove any deprecated patches from the Steam binary
    remove_deprecated_patches
    
    # Link millennium to the Steam runtime
    rm -f "${USER_HOME}/.local/share/Steam/ubuntu12_32/libXtst.so.6"
    ln -s /usr/lib/millennium/libmillennium_bootstrap_86x.so "${USER_HOME}/.local/share/Steam/ubuntu12_32/libXtst.so.6"
}

post_upgrade() {
    post_install
}

post_remove() {
    if [ -n "$SUDO_USER" ]; then
        USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
    else
        USER_HOME="$HOME"
    fi
    
    # Remove the symlink created during post_install
    rm -f "${USER_HOME}/.local/share/Steam/ubuntu12_32/libXtst.so.6"
}