chore: rewrite directory name & feat: add lol sulaunchhelper2.sh

This commit is contained in:
2022-05-30 20:12:39 +07:00
parent a5abc5f35c
commit ec2fa3d16d
18 changed files with 327 additions and 0 deletions

View File

@ -0,0 +1,54 @@
#!/bin/bash
# This script is a wrapper for sulaunchhelper2.py and somewhat based on syscall_check.sh for kernel.yama.ptrace_scope wrapper
# Because this is for Lutris pre-launch script, you're required to have both sulaunchhelper2.py and syscall_check.sh
# present in the game' wineprefix
SCC_SH='syscall_check.sh'
SULH_PY='sulaunchhelper2.py'
dialog() {
zenity "$@" --icon-name='lutris' --width="400" --title="League of Legends launch helper (root version)"
}
own_dir="$(realpath .)"
# try to call syscall_check.sh
if ! [ -x "${own_dir}/${SCC_SH}" ]; then
dialog "Please place this script into the same directory as '${SCC_SH}'!"
else
sh "${own_dir}/${SCC_SH}"
fi
if [ "$(cat /proc/sys/kernel/yama/ptrace_scope)" -ne 0 ]; then
once="Change setting until next reboot"
persist="Change setting and persist after reboot"
manual="Show me the commands; I'll handle it myself"
if dialog --question --text="League of Legends' client UI launch much faster with some modification to your system. but as far as this script can detect, the setting has not been changed yet.\n\nWould you like to change the setting now?"
then
# I tried to embed the command in the dialog and run the output, but
# parsing variables with embedded quotes is an excercise in frustration.
RESULT=$(dialog --list --radiolist --height="200" \
--column="" --column="Command" \
"TRUE" "$once" \
"FALSE" "$persist" \
"FALSE" "$manual")
case "$RESULT" in
"$once")
pkexec sysctl -w kernel.yama.ptrace_scope=0
;;
"$persist")
pkexec sh -c 'echo "kernel.yama.ptrace_scope=0" >> /etc/sysctl.conf && sysctl -p'
;;
"$manual")
dialog --info --no-wrap --text="To change the setting (a kernel parameter) until next boot, run:\n\nsudo sh -c 'sysctl -w kernel.yama.ptrace_scope=0'\n\nTo persist the setting between reboots, run:\n\nsudo sh -c 'echo \"kernel.yama.ptrace_scope=0\" >> /etc/sysctl.conf && sysctl -p'\nChange the setting then press OK or script will NOT work."
;;
*)
echo "Dialog canceled or unknown option selected: $RESULT"
;;
esac
fi
fi
python3 "${own_dir}/${SULH_PY}"