mirror of
https://github.com/aclist/dztui.git
synced 2024-12-29 13:52:03 +01:00
fix: sudo escalation
This commit is contained in:
parent
55f1a6ad62
commit
6bb3631e8d
1 changed files with 9 additions and 17 deletions
26
dzgui.sh
26
dzgui.sh
|
@ -1725,24 +1725,16 @@ check_map_count(){
|
|||
local count=1048576
|
||||
echo "[DZGUI] Checking system map count"
|
||||
if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then
|
||||
if [[ $parent != "bash" ]]; then
|
||||
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
|
||||
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
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
$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 pass=$($steamsafe_zenity --password)
|
||||
local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'")
|
||||
local new_ct
|
||||
[[ $ct -lt $count ]] && ct=$count
|
||||
sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf"
|
||||
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
||||
else
|
||||
if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then
|
||||
sudo sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf"
|
||||
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue