mirror of
https://github.com/aclist/dztui.git
synced 2024-12-28 13:22:35 +01:00
Bump version to 2.4.0-rc.1
This commit is contained in:
parent
56989976d4
commit
9d6f2f15f0
1 changed files with 196 additions and 79 deletions
275
dzgui.sh
275
dzgui.sh
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
version=2.3.0
|
||||
version=2.4.0-rc.1
|
||||
aid=221100
|
||||
game="dayz"
|
||||
workshop="steam://url/CommunityFilePage/"
|
||||
|
@ -11,23 +11,47 @@ config_path="$HOME/.config/dztui/"
|
|||
config_file="${config_path}dztuirc"
|
||||
tmp=/tmp/dztui.tmp
|
||||
separator="%%"
|
||||
git_url="https://github.com/aclist/dztui/issues/new/choose"
|
||||
git_url="https://github.com/aclist/dztui/issues"
|
||||
stable_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh"
|
||||
testing_url="https://raw.githubusercontent.com/aclist/dztui/testing/dzgui.sh"
|
||||
help_url="https://aclist.github.io/dzgui/dzgui"
|
||||
check_config_msg="Check config values and restart."
|
||||
news_url="https://raw.githubusercontent.com/aclist/dztui/dzgui/news"
|
||||
|
||||
update_last_seen(){
|
||||
mv $config_file ${config_path}dztuirc.old
|
||||
nr=$(awk '/seen_news=/ {print NR}' ${config_path}dztuirc.old)
|
||||
seen_news="seen_news=\"$sum\""
|
||||
awk -v "var=$seen_news" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > $config_file
|
||||
printf "[DZGUI] Updated last seen news item to '$sum'\n"
|
||||
source $config_file
|
||||
}
|
||||
check_news(){
|
||||
result=$(curl -Ls "$news_url")
|
||||
sum=$(echo -n "$result" | md5sum | awk '{print $1}')
|
||||
}
|
||||
print_news(){
|
||||
check_news
|
||||
if [[ $sum == $seen_news || -z $result ]]; then
|
||||
hchar=""
|
||||
news=""
|
||||
else
|
||||
hchar="─"
|
||||
news="$result\n$(awk -v var="$hchar" 'BEGIN{for(c=0;c<90;c++) printf var;}')\n"
|
||||
update_last_seen
|
||||
fi
|
||||
}
|
||||
#TODO: prevent connecting to offline servers
|
||||
#TODO: concat large mod links
|
||||
#TODO: check map count and warn
|
||||
#sysctl -q vm.max_map_count
|
||||
#prompt password
|
||||
#TODO: abstract zenity title params
|
||||
|
||||
declare -A deps
|
||||
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1")
|
||||
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [zenity]="3.42.1" [steam]="1.0.0")
|
||||
changelog(){
|
||||
md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md"
|
||||
if [[ $branch == "stable" ]]; then
|
||||
md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md"
|
||||
else
|
||||
md="https://raw.githubusercontent.com/aclist/dztui/testing/changelog.md"
|
||||
fi
|
||||
prefix="This window can be scrolled."
|
||||
echo $prefix
|
||||
echo ""
|
||||
|
@ -36,7 +60,7 @@ changelog(){
|
|||
|
||||
depcheck(){
|
||||
for dep in "${!deps[@]}"; do
|
||||
command -v $dep 2>&1>/dev/null || (printf "[ERROR] Requires %s >= %s\nCheck your system package manager." $dep ${deps[$dep]}; exit 1)
|
||||
command -v $dep 2>&1>/dev/null || (printf "Requires %s >=%s\n" $dep ${deps[$dep]}; exit 1)
|
||||
done
|
||||
}
|
||||
init_items(){
|
||||
|
@ -46,6 +70,7 @@ items=(
|
|||
"Quick connect to favorite server"
|
||||
"Add server by ID"
|
||||
"Add favorite server"
|
||||
"Delete server"
|
||||
"List installed mods"
|
||||
"Toggle debug mode"
|
||||
"Report bug (opens in browser)"
|
||||
|
@ -119,6 +144,9 @@ debug="0"
|
|||
|
||||
#Toggle stable/testing branch
|
||||
branch="stable"
|
||||
|
||||
#Last seen news item
|
||||
seen_news=""
|
||||
END
|
||||
}
|
||||
guess_path(){
|
||||
|
@ -169,7 +197,7 @@ run_depcheck() {
|
|||
if [[ -z $(depcheck) ]]; then
|
||||
:
|
||||
else
|
||||
zenity --warning --ok-label="Exit" --text="$(depcheck)"
|
||||
zenity --warning --ok-label="Exit" --title="DZGUI" --text="$(depcheck)"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
@ -214,6 +242,21 @@ open_mod_links(){
|
|||
browser "$link_file" &
|
||||
|
||||
}
|
||||
steam_deck_mods(){
|
||||
until [[ -z $diff ]]; do
|
||||
next=$(echo -e "$diff" | head -n1)
|
||||
zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." 2>/dev/null
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
echo "[DZGUI] Opening ${workshop}$next"
|
||||
steam steam://url/CommunityFilePage/$next 2>/dev/null &
|
||||
zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." 2>/dev/null
|
||||
else
|
||||
return
|
||||
fi
|
||||
compare
|
||||
done
|
||||
}
|
||||
manual_mod_install(){
|
||||
l=0
|
||||
if [[ $is_steam_deck -eq 0 ]]; then
|
||||
|
@ -229,38 +272,43 @@ manual_mod_install(){
|
|||
fi
|
||||
done
|
||||
else
|
||||
|
||||
until [[ -z $diff ]]; do
|
||||
next=$(echo -e "$diff" | head -n1)
|
||||
zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." 2>/dev/null
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
echo "[DZGUI] Opening ${workshop}$next"
|
||||
steam steam://url/CommunityFilePage/$next 2>/dev/null &
|
||||
zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." 2>/dev/null
|
||||
else
|
||||
return
|
||||
fi
|
||||
compare
|
||||
done
|
||||
steam_deck_mods
|
||||
fi
|
||||
passed_mod_check
|
||||
}
|
||||
encode(){
|
||||
echo "$1" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g'
|
||||
}
|
||||
stale_symlinks(){
|
||||
for l in $(find "$game_dir" -xtype l); do
|
||||
unlink $l
|
||||
done
|
||||
}
|
||||
legacy_symlinks(){
|
||||
for d in "$game_dir"/*; do
|
||||
if [[ $d =~ @[0-9]+-.+ ]]; then
|
||||
unlink "$d"
|
||||
fi
|
||||
done
|
||||
}
|
||||
symlinks(){
|
||||
for d in "$workshop_dir"/*; do
|
||||
id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
|
||||
encoded_id=$(encode "$id")
|
||||
mod=$(awk -F\" '/name/ {print $2}' "$d"/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g')
|
||||
link="@$id-$mod"
|
||||
link="@$encoded_id"
|
||||
if [[ -h "$game_dir/$link" ]]; then
|
||||
:
|
||||
else
|
||||
printf "[DZGUI] Creating symlink for $mod\n"
|
||||
:
|
||||
else
|
||||
printf "[DZGUI] Creating symlink for $mod\n"
|
||||
ln -fs "$d" "$game_dir/$link"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
passed_mod_check(){
|
||||
echo "[DZGUI] Passed mod check"
|
||||
stale_symlinks
|
||||
legacy_symlinks
|
||||
symlinks
|
||||
launch
|
||||
|
||||
|
@ -351,8 +399,8 @@ concat_mods(){
|
|||
readarray -t serv <<< "$(server_modlist)"
|
||||
for i in "${serv[@]}"; do
|
||||
id=$(awk -F"= " '/publishedid/ {print $2}' "$workshop_dir"/$i/meta.cpp | awk -F\; '{print $1}')
|
||||
mod=$(awk -F\" '/name/ {print $2}' "$workshop_dir"/$i/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g')
|
||||
link="@$id-$mod;"
|
||||
encoded_id=$(encode $id)
|
||||
link="@$encoded_id;"
|
||||
echo -e "$link"
|
||||
done | tr -d '\n' | perl -ple 'chop'
|
||||
fi
|
||||
|
@ -360,8 +408,17 @@ concat_mods(){
|
|||
launch(){
|
||||
mods=$(concat_mods)
|
||||
if [[ $debug -eq 1 ]]; then
|
||||
zenity --warning --title="DZGUI" \
|
||||
--text="$(printf "[DEBUG] This is a dry run. These options would have been used to launch the game:\n\nsteam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\"\n")" 2>/dev/null
|
||||
launch_options="steam -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro \"-mod=$mods\""
|
||||
print_launch_options="$(printf "[DEBUG] This is a dry run. These options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)"
|
||||
zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\
|
||||
--text="$print_launch_options" 2>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
source_script=$(realpath "$0")
|
||||
source_dir=$(dirname "$source_script")
|
||||
echo "$launch_options" > "$source_dir"/options.log
|
||||
echo "[DZGUI] Wrote 'options.log' to $source_dir"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "[DZGUI] All OK. Launching DayZ"
|
||||
zenity --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null
|
||||
|
@ -382,7 +439,7 @@ report_bug(){
|
|||
if [[ $is_steam_deck -eq 1 ]]; then
|
||||
steam steam://openurl/"$git_url" 2>/dev/null
|
||||
elif [[ $is_steam_deck -eq 0 ]]; then
|
||||
browser "$git_url" 2>/dev/null
|
||||
browser "$git_url" 2>/dev/null &
|
||||
fi
|
||||
}
|
||||
help_file(){
|
||||
|
@ -390,7 +447,7 @@ help_file(){
|
|||
if [[ $is_steam_deck -eq 1 ]]; then
|
||||
steam steam://openurl/"$help_url" 2>/dev/null
|
||||
elif [[ $is_steam_deck -eq 0 ]]; then
|
||||
browser "$help_url" 2>/dev/null
|
||||
browser "$help_url" 2>/dev/null &
|
||||
fi
|
||||
}
|
||||
set_mode(){
|
||||
|
@ -400,19 +457,46 @@ set_mode(){
|
|||
mode=normal
|
||||
fi
|
||||
}
|
||||
delete_by_id(){
|
||||
new_whitelist="whitelist=\"$(echo "$whitelist" | sed "s/,$server_id$//;s/^$server_id,//;s/,$server_id,/,/")\""
|
||||
mv $config_file ${config_path}dztuirc.old
|
||||
nr=$(awk '/whitelist=/ {print NR}' ${config_path}dztuirc.old)
|
||||
awk -v "var=$new_whitelist" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
|
||||
echo "[DZGUI] Removed $server_id from key 'whitelist'"
|
||||
zenity --info --title="DZGUI" --text="Removed "$server_id" from:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null
|
||||
source $config_file
|
||||
}
|
||||
delete_or_connect(){
|
||||
if [[ $delete -eq 1 ]]; then
|
||||
server_name=$(echo "$sel" | awk -F"%%" '{print $1}')
|
||||
server_id=$(echo "$sel" | awk -F"%%" '{print $2}')
|
||||
zenity --question --text="Delete this server? \n$server_name"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
delete_by_id $server_id
|
||||
fi
|
||||
else
|
||||
connect $sel
|
||||
fi
|
||||
}
|
||||
populate(){
|
||||
while true; do
|
||||
#TODO: add boolean statement for ping flag; affects all column ordinal output
|
||||
cols="--column="Server" --column="IP" --column="Players" --column="Gametime" --column="Status" --column="ID" --column="Ping""
|
||||
set_header ${FUNCNAME[0]}
|
||||
if [[ $delete -eq 1 ]]; then
|
||||
cols="--column="Server" --column="ID""
|
||||
set_header "delete"
|
||||
else
|
||||
cols="--column="Server" --column="IP" --column="Players" --column="Gametime" --column="Status" --column="ID" --column="Ping""
|
||||
set_header ${FUNCNAME[0]}
|
||||
fi
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
if [[ -z $sel ]]; then
|
||||
warn "No item was selected."
|
||||
else
|
||||
connect $sel
|
||||
delete_or_connect
|
||||
return
|
||||
fi
|
||||
else
|
||||
delete=0
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
@ -421,16 +505,20 @@ list_mods(){
|
|||
if [[ -z $(installed_mods) || -z $(find $workshop_dir -maxdepth 2 -name "*.cpp" | grep .cpp) ]]; then
|
||||
zenity --info --text="No mods currently installed or incorrect path given" $sd_res 2>/dev/null
|
||||
else
|
||||
for d in $(installed_mods); do
|
||||
awk -F\" '/name/ {print $2}' "$workshop_dir"/$d/meta.cpp
|
||||
done | sort | zenity --text-info --title="DZGUI" $sd_res 2>/dev/null
|
||||
for d in $(find $game_dir/* -maxdepth 1 -type l); do
|
||||
dir=$(basename $d)
|
||||
awk -v d=$dir -F\" '/name/ {printf "%s\t%s\n", $2,d}' "$gamedir"/$d/meta.cpp
|
||||
done | sort | sed 's/\t/\n/g' | zenity --list --column="Mod" --column="Symlink" --title="DZGUI" $sd_res --print-column="" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
fetch_query_ports(){
|
||||
qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"')
|
||||
}
|
||||
connect_to_fav(){
|
||||
if [[ -n $fav ]]; then
|
||||
one_shot_launch=1
|
||||
query_api
|
||||
qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"')
|
||||
fetch_query_ports
|
||||
echo "[DZGUI] Attempting connection to $fav_label"
|
||||
connect "$qport_list"
|
||||
one_shot_launch=0
|
||||
|
@ -440,12 +528,15 @@ connect_to_fav(){
|
|||
|
||||
}
|
||||
set_header(){
|
||||
if [[ $1 == "populate" ]]; then
|
||||
sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \
|
||||
if [[ $1 == "delete" ]]; then
|
||||
sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \
|
||||
--separator="$separator" --print-column=1,2 --ok-label="Delete" 2>/dev/null)
|
||||
elif [[ $1 == "populate" ]]; then
|
||||
sel=$(cat $tmp | zenity $sd_res --list $cols --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \
|
||||
--separator="$separator" --print-column=2,6 2>/dev/null)
|
||||
elif [[ $1 == "main_menu" ]]; then
|
||||
sel=$(zenity --width=1280 --height=800 --list --title="DZGUI" --text="DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \
|
||||
--cancel-label="Exit" --ok-label="Select" --column="Select launch option" "${items[@]}" 2>/dev/null)
|
||||
sel=$(zenity $sd_res --list --title="DZGUI" --text="${news}DZGUI $version | Mode: $mode | Branch: $branch | Fav: $fav_label" \
|
||||
--cancel-label="Exit" --ok-label="Select" --column="Select launch option" --hide-header "${items[@]}" 2>/dev/null)
|
||||
fi
|
||||
}
|
||||
toggle_branch(){
|
||||
|
@ -465,17 +556,32 @@ debug_menu(){
|
|||
debug_list=(
|
||||
"Toggle branch"
|
||||
)
|
||||
debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" "${debug_list[@]}" 2>/dev/null)
|
||||
debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
|
||||
if [[ $debug_sel == "${debug_list[0]}" ]]; then
|
||||
toggle_branch
|
||||
check_version
|
||||
fi
|
||||
}
|
||||
query_and_connect(){
|
||||
query_api
|
||||
parse_json <<< "$response"
|
||||
#TODO: create logger function
|
||||
echo "[DZGUI] Checking response time of servers"
|
||||
create_array | zenity --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
||||
rc=$?
|
||||
if [[ $rc -eq 1 ]]; then
|
||||
:
|
||||
else
|
||||
populate
|
||||
fi
|
||||
}
|
||||
|
||||
main_menu(){
|
||||
print_news
|
||||
set_mode
|
||||
if [[ $debug -eq 1 ]]; then
|
||||
items+=("Debug options")
|
||||
fi
|
||||
set_mode
|
||||
if [[ -n $fav ]]; then
|
||||
items[3]="Change favorite server"
|
||||
fi
|
||||
|
@ -486,17 +592,7 @@ main_menu(){
|
|||
if [[ -z $sel ]]; then
|
||||
warn "No item was selected."
|
||||
elif [[ $sel == "${items[0]}" ]]; then
|
||||
query_api
|
||||
parse_json <<< "$response"
|
||||
#TODO: create logger function
|
||||
echo "[DZGUI] Checking response time of servers"
|
||||
create_array | zenity --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
||||
rc=$?
|
||||
if [[ $rc -eq 1 ]]; then
|
||||
:
|
||||
else
|
||||
populate
|
||||
fi
|
||||
query_and_connect
|
||||
elif [[ $sel == "${items[1]}" ]]; then
|
||||
connect_to_fav
|
||||
elif [[ $sel == "${items[2]}" ]]; then
|
||||
|
@ -504,18 +600,21 @@ main_menu(){
|
|||
elif [[ $sel == "${items[3]}" ]]; then
|
||||
add_by_fav
|
||||
elif [[ $sel == "${items[4]}" ]]; then
|
||||
list_mods
|
||||
delete=1
|
||||
query_and_connect
|
||||
elif [[ $sel == "${items[5]}" ]]; then
|
||||
list_mods
|
||||
elif [[ $sel == "${items[6]}" ]]; then
|
||||
toggle_debug
|
||||
main_menu
|
||||
return
|
||||
elif [[ $sel == "${items[6]}" ]]; then
|
||||
report_bug
|
||||
elif [[ $sel == "${items[7]}" ]]; then
|
||||
help_file
|
||||
report_bug
|
||||
elif [[ $sel == "${items[8]}" ]]; then
|
||||
changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
|
||||
help_file
|
||||
elif [[ $sel == "${items[9]}" ]]; then
|
||||
changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
|
||||
elif [[ $sel == "${items[10]}" ]]; then
|
||||
debug_menu
|
||||
else
|
||||
warn "This feature is not yet implemented."
|
||||
|
@ -527,17 +626,18 @@ main_menu(){
|
|||
}
|
||||
parse_json(){
|
||||
list=$(jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
||||
qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"')
|
||||
fetch_query_ports
|
||||
#qport_list=$(echo "$response" | jq -r '.data[] .attributes | "\(.ip):\(.port)%%\(.portQuery)"')
|
||||
echo -e "$list" > $tmp
|
||||
}
|
||||
check_ping(){
|
||||
ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}')
|
||||
ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}')
|
||||
if [[ -z $ms ]]; then
|
||||
echo "Timeout"
|
||||
else
|
||||
echo "$ms"
|
||||
fi
|
||||
ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}')
|
||||
ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}')
|
||||
if [[ -z $ms ]]; then
|
||||
echo "Timeout"
|
||||
else
|
||||
echo "$ms"
|
||||
fi
|
||||
}
|
||||
create_array(){
|
||||
list=$(cat $tmp)
|
||||
|
@ -562,10 +662,14 @@ create_array(){
|
|||
#TODO: probe offline return codes
|
||||
id=$(echo "$line" | awk -F'\t' '{print $6}')
|
||||
tc=$(awk 'END{print NR}' $tmp)
|
||||
echo "$lc/$tc"
|
||||
echo "# Checking ping: $lc/$tc"
|
||||
ping=$(check_ping "$line")
|
||||
declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping")
|
||||
if [[ $delete -eq 1 ]]; then
|
||||
declare -g -a rows=("${rows[@]}" "$name" "$id")
|
||||
else
|
||||
echo "$lc/$tc"
|
||||
echo "# Checking ping: $lc/$tc"
|
||||
ping=$(check_ping "$line")
|
||||
declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping")
|
||||
fi
|
||||
let lc++
|
||||
done <<< "$list"
|
||||
|
||||
|
@ -646,8 +750,8 @@ check_version(){
|
|||
fi
|
||||
}
|
||||
check_architecture(){
|
||||
os_release=$(awk '/SteamOS/' "/etc/os-release")
|
||||
if [[ -f "/etc/os-release" ]] && [[ -n $os_releasec ]]; then
|
||||
cpu=$(cat /proc/cpuinfo | grep "AMD Custom APU 0405")
|
||||
if [[ -n $cpu ]]; then
|
||||
is_steam_deck=1
|
||||
echo "[DZGUI] Setting architecture to 'Steam Deck'"
|
||||
else
|
||||
|
@ -700,6 +804,18 @@ setup(){
|
|||
items[3]="Change favorite server"
|
||||
fi
|
||||
}
|
||||
check_map_count(){
|
||||
count=1048576
|
||||
if [[ $(sysctl -q vm.max_map_count | awk -F"= " '{print $2}') -ne $count ]]; then
|
||||
map_warning=$(zenity --question --title="DZGUI" --text "System map count must be $count or higher to run DayZ with Wine. Increase map count and make this change permanent? (will prompt for sudo password)" 2>/dev/null)
|
||||
if [[ $? -eq 0 ]]; then
|
||||
pass=$(zenity --password)
|
||||
sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=1048576' > /etc/sysctl.d/dayz.conf"
|
||||
echo ""
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
add_by_fav(){
|
||||
while true; do
|
||||
fav_id=$(zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null)
|
||||
|
@ -728,6 +844,7 @@ main(){
|
|||
run_depcheck
|
||||
check_version
|
||||
check_architecture
|
||||
check_map_count
|
||||
config
|
||||
run_varcheck
|
||||
init_items
|
||||
|
|
Loading…
Reference in a new issue