summarylogtreecommitdiffstats
path: root/fuzion-unload
blob: 59015f217fb493fe20d3df31e78db0c33c6f0f84 (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
#!/usr/bin/env bash

# Credit: Aixxe @ aixxe.net
# Edited for PKGBUILD

csgo_pid=$(pidof csgo_linux64)
filename="$(cat /usr/share/Fuzion/build_id)"
filename_old="$(cat /usr/share/Fuzion/build_id_old)"

if [ -f /usr/share/Fuzion/build_id ]; then
    if grep -q "$filename" /proc/"$csgo_pid"/maps; then
    echo "unloading $filename"
    sudo gdb -n -q -batch-silent \
        -ex "set logging on" \
        -ex "set logging file /dev/null" \
        -ex "set logging redirect on" \
        -ex "attach $csgo_pid" \
        -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
        -ex "set \$dlclose = (int(*)(void*)) dlclose" \
        -ex "set \$library = \$dlopen(\"/usr/lib/$filename\", 6)" \
        -ex "call \$dlclose(\$library)" \
        -ex "call \$dlclose(\$library)" \
        -ex "detach" \
        -ex "quit"
    fi
fi

echo "Done. See CS:GO Console."