mirror of
https://github.com/aclist/dztui.git
synced 2025-04-06 04:23:00 +02:00
fix: sudo escalation
This commit is contained in:
parent
1e1f647eb7
commit
55f1a6ad62
1 changed files with 8 additions and 7 deletions
15
dzgui.sh
15
dzgui.sh
|
@ -1722,24 +1722,25 @@ setup(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_map_count(){
|
check_map_count(){
|
||||||
count=1048576
|
local count=1048576
|
||||||
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
|
||||||
if [[ $parent != "bash" ]]; 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
|
if [[ $? -eq 0 ]]; then
|
||||||
pass=$($steamsafe_zenity --password)
|
local pass=$($steamsafe_zenity --password)
|
||||||
local ct=$(sudo -S <<< "$pass" sh -c "sudo 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}')")
|
||||||
if [[ $ct -lt $count ]]; then
|
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
|
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
||||||
pass=$($steamsafe_zenity --password)
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
return
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ $(sudo sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -lt $count ]]; then
|
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
|
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue