1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-29 13:52:03 +01:00

chore: additional logging

This commit is contained in:
aclist 2023-06-19 05:39:54 +09:00
parent 73717d8567
commit f56a2f3fe6

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=3.3.3 version=3.3.4
aid=221100 aid=221100
game="dayz" game="dayz"
@ -1760,16 +1760,23 @@ check_map_count(){
echo "[DZGUI] Checking system map count" echo "[DZGUI] Checking system map count"
if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then
$steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null $steamsafe_zenity --question --width 500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count." 2>/dev/null
if [[ $? -eq 0 ]]; then local rc=$?
logger INFO "Return code is $rc"
if [[ $rc -eq 0 ]]; then
local pass local pass
logger INFO "Prompting user for sudo escalation"
pass=$($steamsafe_zenity --password) pass=$($steamsafe_zenity --password)
[[ $? -eq 1 ]] && exit 1 local rc
logger INFO "Return code is $rc"
[[ $rc -eq 1 ]] && exit 1
local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'") local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'")
local new_ct local new_ct
[[ $ct -lt $count ]] && ct=$count [[ $ct -lt $count ]] && ct=$count
logger INFO "Updating map count"
sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf" sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf"
sudo sysctl -p /etc/sysctl.d/dayz.conf sudo sysctl -p /etc/sysctl.d/dayz.conf
else else
logger INFO "Zenity dialog failed or user exit"
exit 1 exit 1
fi fi
fi fi