# Display a message to the user. Expects a numerical argument followed by the string to display.
message(){
if["$zenity" -eq 1];then
if["$1" -eq 1];then
# info
margs="--info --no-wrap --text="
elif["$1" -eq 2];then
# warning
margs="--warning --no-wrap --text="
elif["$1" -eq 3];then
# question
margs="--question --text="
elif["$1" -eq 4];then
# radio list
margs="--list --radiolist --height=\"200\" --column=\" \" --column=\"What would you like to do?\" "
elif["$1" -eq 5];then
# main menu radio list
margs="--list --radiolist --height=\"175\" --text="Welcome, fellow penguin, to the Star Citizen Linux Users Group Helper Script!" --column=\" \" --column=\"What would you like to do?\" "
else
echo -e "Invalid message format.\n\nThe message function expects a numerical argument followed by the string to display.\n"
message 1"Before proceeding, please be sure you have\nmade a backup of your Star Citizen keybinds!\nTo do this from within the game, go to\nOptions->Keybindings->Control Profiles->Save Control Settings\nGive it a name and save it to the backup location\nthat you specified in this script's variables."
message 2"As far as this script can detect, your system is not configured\nto allow Star Citizen to use more than ~8GB or memory.\n\nYou will most likely experience crashes."
if message 3"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
if message 3"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
message 1"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
message 1"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"
;;
esac
else
# text menu
options="($once$persist$manual)"
PS3="Enter selection number or 'q' to quit: "
select choice in "${options[@]}"
do
case"$REPLY" in
"1")
pkexec sh -c 'sysctl -w vm.max_map_count=16777216'
message 1"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
message 1"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