2020-03-15 17:26:02 +00:00
|
|
|
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
|
|
MANGOHUD_CONFIG_DIR="$XDG_CONFIG_HOME/MangoHud"
|
2020-04-12 09:51:14 +00:00
|
|
|
SU_CMD=$(command -v sudo || command -v doas)
|
|
|
|
|
|
|
|
# doas requires a double dash if the command it runs will include any dashes,
|
|
|
|
# so append a double dash to the command
|
2020-04-12 10:12:28 +00:00
|
|
|
[[ $SU_CMD == *doas ]] && SU_CMD="$SU_CMD -- "
|
2020-04-12 09:51:14 +00:00
|
|
|
|
2020-03-15 17:26:02 +00:00
|
|
|
|
2020-03-21 12:56:39 +00:00
|
|
|
mangohud_usage() {
|
|
|
|
echo 'Accepted arguments: "install", "uninstall".'
|
|
|
|
}
|
|
|
|
|
|
|
|
mangohud_config() {
|
2020-03-15 17:26:02 +00:00
|
|
|
mkdir -p "${MANGOHUD_CONFIG_DIR}"
|
|
|
|
echo You can use the example configuration file from
|
|
|
|
echo /usr/share/doc/mangohud/MangoHud.conf.example
|
|
|
|
echo as a starting point by copying it to
|
|
|
|
echo ${MANGOHUD_CONFIG_DIR}/MangoHud.conf
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2020-03-21 12:56:39 +00:00
|
|
|
mangohud_install() {
|
2020-03-13 16:51:32 +00:00
|
|
|
rm -rf "$HOME/.local/share/MangoHud/"
|
2020-03-11 09:01:46 +00:00
|
|
|
rm -f "$HOME/.local/share/vulkan/implicit_layer.d/"{mangohud32.json,mangohud64.json}
|
2020-03-21 12:56:39 +00:00
|
|
|
|
|
|
|
[ "$UID" -eq 0 ] || mangohud_config
|
|
|
|
[ "$UID" -eq 0 ] || tar xf MangoHud-package.tar
|
2020-04-12 09:51:14 +00:00
|
|
|
[ "$UID" -eq 0 ] || exec $SU_CMD bash "$0" install
|
2020-03-21 12:56:39 +00:00
|
|
|
|
|
|
|
install -vm644 -D ./usr/lib/mangohud/lib32/libMangoHud.so /usr/lib/mangohud/lib32/libMangoHud.so
|
|
|
|
install -vm644 -D ./usr/lib/mangohud/lib64/libMangoHud.so /usr/lib/mangohud/lib64/libMangoHud.so
|
2020-06-04 03:17:42 +00:00
|
|
|
install -vm644 -D ./usr/lib/mangohud/lib32/libMangoHud_dlsym.so /usr/lib/mangohud/lib32/libMangoHud_dlsym.so
|
|
|
|
install -vm644 -D ./usr/lib/mangohud/lib64/libMangoHud_dlsym.so /usr/lib/mangohud/lib64/libMangoHud_dlsym.so
|
2020-03-21 12:56:39 +00:00
|
|
|
install -vm644 -D ./usr/share/vulkan/implicit_layer.d/MangoHud.x86.json /usr/share/vulkan/implicit_layer.d/MangoHud.x86.json
|
|
|
|
install -vm644 -D ./usr/share/vulkan/implicit_layer.d/MangoHud.x86_64.json /usr/share/vulkan/implicit_layer.d/MangoHud.x86_64.json
|
|
|
|
install -vm644 -D ./usr/share/doc/mangohud/MangoHud.conf.example /usr/share/doc/mangohud/MangoHud.conf.example
|
|
|
|
|
|
|
|
install -vm755 ./usr/bin/mangohud.x86 /usr/bin/mangohud.x86
|
|
|
|
install -vm755 ./usr/bin/mangohud /usr/bin/mangohud
|
|
|
|
|
2020-03-10 12:39:52 +00:00
|
|
|
echo "MangoHud Installed"
|
|
|
|
}
|
|
|
|
|
2020-03-21 12:56:39 +00:00
|
|
|
mangohud_uninstall() {
|
2020-04-12 09:51:14 +00:00
|
|
|
[ "$UID" -eq 0 ] || exec $SU_CMD bash "$0" uninstall
|
2020-03-11 17:01:59 +00:00
|
|
|
rm -rfv "/usr/lib/mangohud"
|
2020-03-14 12:12:51 +00:00
|
|
|
rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.x86.json"
|
|
|
|
rm -fv "/usr/share/vulkan/implicit_layer.d/MangoHud.x86_64.json"
|
2020-03-14 12:17:40 +00:00
|
|
|
rm -frv "/usr/share/doc/mangohud"
|
2020-03-10 12:39:52 +00:00
|
|
|
rm -fv "/usr/bin/mangohud"
|
2020-03-14 12:12:51 +00:00
|
|
|
rm -fv "/usr/bin/mangohud.x86"
|
2020-03-10 12:39:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for a in $@; do
|
|
|
|
case $a in
|
2020-03-21 12:56:39 +00:00
|
|
|
"install") mangohud_install;;
|
|
|
|
"uninstall") mangohud_uninstall;;
|
2020-03-10 12:39:52 +00:00
|
|
|
*)
|
|
|
|
echo "Unrecognized command argument: $a"
|
2020-03-21 12:56:39 +00:00
|
|
|
mangohud_usage
|
2020-03-10 12:39:52 +00:00
|
|
|
esac
|
2020-03-21 12:56:39 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z $@ ]; then
|
|
|
|
mangohud_usage
|
2020-04-12 09:51:14 +00:00
|
|
|
fi
|