diff --git a/dzgui.sh b/dzgui.sh index b80a0aa..db9dca2 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1722,24 +1722,25 @@ setup(){ fi } check_map_count(){ - count=1048576 + local count=1048576 echo "[DZGUI] Checking system map count" if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then if [[ $parent != "bash" ]]; then - $steamsafe_zenity --question --width 500 --title="DZGUI" --text "sudo password required to check system vm map count." 2>/dev/null + echo "parent is not bash" >> $HOME/log + $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 - pass=$($steamsafe_zenity --password) - local ct=$(sudo -S <<< "$pass" sh -c "sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") + local pass=$($steamsafe_zenity --password) + local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F"= " '{print $2}')") if [[ $ct -lt $count ]]; then + sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" sudo sysctl -p /etc/sysctl.d/dayz.conf - pass=$($steamsafe_zenity --password) fi else - return + exit 1 fi else if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then - sudo echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf + sudo sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf" sudo sysctl -p /etc/sysctl.d/dayz.conf fi fi