mem_dialog --warning --text="As far as this script can detect, your system is not configured to allow Star Citizen to use more than ~8GB or memory.\n\nYou will most likely experience crashes."
fi
}
# Check vm.max_map_count for the correct setting and let the user fix it if needed
if grep -E -x -q "vm.max_map_count" /etc/sysctl.conf /etc/sysctl.d/* 2>/dev/null;then
if mem_dialog --question --text="It looks like you already configured your system to work with Star Citizen, and saved the setting to persist across reboots. However, for some reason the persistence part did not work.\n\nFor now, would you like to enable the setting again until the next reboot?";then
pkexec sh -c 'sysctl -w vm.max_map_count=16777216'
fi
exit0
fi
once="Change setting until next reboot"
persist="Change setting and persist after reboot"
manual="Show me the commands; I'll handle it myself"
if mem_dialog --question --text="Running Star Citizen requires changing a system setting.\n\nvm.max_map_count must be increased to at least 16777216 to avoid crashes in areas with lots of geometry.\n\nAs far as this script can detect, the setting has not been changed on your system.\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.
mem_dialog --info --no-wrap --text="To change the setting (a kernel parameter) until next boot, run:\n\nsudo sh -c 'sysctl -w vm.max_map_count=16777216'\n\nTo persist the setting between reboots, run:\n\nsudo sh -c 'echo \"vm.max_map_count = 16777216\" >> /etc/sysctl.d/20-max_map_count.conf && sysctl -p'"
else
mem_dialog --info --no-wrap --text="To change the setting (a kernel parameter) until next boot, run:\n\nsudo sh -c 'sysctl -w vm.max_map_count=16777216'\n\nTo persist the setting between reboots, run:\n\nsudo sh -c 'echo \"vm.max_map_count = 16777216\" >> /etc/sysctl.conf && sysctl -p'"
fi
# Anyone who wants to do it manually doesn't need another warning
trap - EXIT
;;
*)
echo"Dialog canceled or unknown option selected: $RESULT"
check="Check my system settings for optimal performance"
clean="Delete my USER folder and preserve my keybinds"
options="$(main_dialog --height="175" --text="Welcome, fellow penguin, to the Star Citizen Linux Users Group Helper Script!" --list --radiolist --column=" " --column="What would you like to do?""TRUE""$check"\ "FALSE""$clean")"
case"$options" in
"$check")
mem_check
;;
"$clean")
sanitize
;;
*)
;;
esac
else
# Use a text menu if Zenity is not available
echo -e "\nWelcome, fellow penguin, to the Star Citizen Linux Users Group Helper Script!\nWhat would you like to do?\n"
options=("Check my system settings for optimal performance""Delete my USER folder and preserve my keybinds")