mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
chore: merge
This commit is contained in:
commit
6838afab8b
4 files changed
+1017
-2
No files matched your search
@@ -68,6 +68,7 @@ print_news(){
|
||||
}
|
||||
|
||||
declare -A deps
|
||||
<<<<<<< HEAD
|
||||
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1" [fold]="9.0")
|
||||
changelog(){
|
||||
build(){
|
||||
@@ -87,6 +88,19 @@ changelog(){
|
||||
curl -Ls "$md"
|
||||
}
|
||||
build | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
|
||||
=======
|
||||
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1")
|
||||
changelog(){
|
||||
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 ""
|
||||
curl -Ls "$md"
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
|
||||
depcheck(){
|
||||
@@ -144,6 +158,36 @@ set_api_params(){
|
||||
list_response=$response
|
||||
first_entry=1
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
query_api(){
|
||||
logger INFO ${FUNCNAME[0]}
|
||||
echo "# Querying API"
|
||||
#TODO: prevent drawing list if null values returned without API error
|
||||
if [[ $one_shot_launch -eq 1 ]]; then
|
||||
list_of_ids="$fav"
|
||||
else
|
||||
list_of_ids="$whitelist"
|
||||
fi
|
||||
set_api_params
|
||||
if [[ "$(jq -r 'keys[]' <<< "$response")" == "errors" ]]; then
|
||||
code=$(jq -r '.errors[] .status' <<< $response)
|
||||
#TODO: fix granular api codes
|
||||
if [[ $code -eq 401 ]]; then
|
||||
warn "Error $code: malformed API key"
|
||||
return
|
||||
elif [[ $code -eq 500 ]]; then
|
||||
warn "Error $code: malformed server list"
|
||||
return
|
||||
fi
|
||||
|
||||
fi
|
||||
if [[ -z $(echo $response | jq '.data[]') ]]; then
|
||||
warn "95: API returned empty response. Check config file."
|
||||
return
|
||||
fi
|
||||
}
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
write_config(){
|
||||
cat <<-END
|
||||
#Path to DayZ installation
|
||||
@@ -244,9 +288,16 @@ create_config(){
|
||||
write_config > $config_file
|
||||
info "Config file created at $config_file."
|
||||
source $config_file
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
while true; do
|
||||
player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="Steam API key" --add-entry="BattleMetrics API key (optional)" --title="DZGUI" --text="DZGUI" $sd_res --separator="@" 2>/dev/null)"
|
||||
=======
|
||||
return
|
||||
}
|
||||
while true; do
|
||||
player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="BattleMetrics API key" --add-entry="Steam API key" --title="DZGUI" --text="DZGUI" $sd_res --separator="@" 2>/dev/null)"
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
#explicitly setting IFS crashes $steamsafe_zenity in loop
|
||||
#and mapfile does not support high ascii delimiters
|
||||
#so split fields with newline
|
||||
@@ -265,6 +316,7 @@ create_config(){
|
||||
fi
|
||||
if [[ -n $api_key ]] && [[ $(test_bm_api $api_key) -eq 1 ]]; then
|
||||
warn "Invalid BM API key"
|
||||
<<<<<<< HEAD
|
||||
continue
|
||||
fi
|
||||
while true; do
|
||||
@@ -289,6 +341,28 @@ create_config(){
|
||||
return
|
||||
fi
|
||||
done
|
||||
=======
|
||||
else
|
||||
while true; do
|
||||
logger INFO "steamsafe_zenity is $steamsafe_zenity"
|
||||
[[ -n $steam_path ]] && { write_to_config; return; }
|
||||
find_default_path
|
||||
find_library_folder "$default_steam_path"
|
||||
if [[ -z $steam_path ]]; then
|
||||
logger WARN "Steam path was empty"
|
||||
zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Choose path manually" --cancel-label="Exit"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
logger INFO "User selected file picker"
|
||||
file_picker
|
||||
else
|
||||
exit
|
||||
fi
|
||||
else
|
||||
write_to_config
|
||||
fi
|
||||
done
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
done
|
||||
|
||||
}
|
||||
@@ -390,8 +464,51 @@ manual_mod_install(){
|
||||
|
||||
[[ $is_steam_deck -eq 1 ]] && test_display_mode
|
||||
if [[ $gamemode -eq 1 ]]; then
|
||||
<<<<<<< HEAD
|
||||
popup 1400
|
||||
return
|
||||
=======
|
||||
steam_deck_mods
|
||||
else
|
||||
local ex="/tmp/dzc.tmp"
|
||||
[[ -f $ex ]] && rm $ex
|
||||
watcher(){
|
||||
readarray -t stage_mods <<< "$diff"
|
||||
for((i=0;i<${#stage_mods[@]};i++)); do
|
||||
[[ -f $ex ]] && return 1
|
||||
local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid"
|
||||
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
||||
$steam_cmd "steam://url/CommunityFilePage/${stage_mods[$i]}"
|
||||
echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences."
|
||||
sleep 1s
|
||||
foreground
|
||||
until [[ -d $downloads_dir/${stage_mods[$i]} ]]; do
|
||||
[[ -f $ex ]] && return 1
|
||||
sleep 0.1s
|
||||
if [[ -d $workshop_dir/${stage_mods[$i]} ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
foreground
|
||||
echo "# Steam is downloading ${stage_mods[$i]} (mod $((i+1)) of ${#stage_mods[@]})"
|
||||
until [[ -d $workshop_dir/${stage_mods[$i]} ]]; do
|
||||
[[ -f $ex ]] && return 1
|
||||
sleep 0.1s
|
||||
done
|
||||
foreground
|
||||
echo "# ${stage_mods[$i]} moved to mods dir"
|
||||
done
|
||||
echo "100"
|
||||
}
|
||||
watcher > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZG Watcher" --width=500 2>/dev/null; rc=$?; [[ $rc -eq 1 ]] && touch $ex)
|
||||
compare
|
||||
if [[ -z $diff ]]; then
|
||||
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
||||
launch
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
fi
|
||||
local ex="/tmp/dzc.tmp"
|
||||
[[ -f $ex ]] && rm $ex
|
||||
@@ -478,6 +595,7 @@ passed_mod_check(){
|
||||
|
||||
}
|
||||
auto_mod_install(){
|
||||
<<<<<<< HEAD
|
||||
local ip="$1"
|
||||
local gameport="$2"
|
||||
popup 300
|
||||
@@ -505,6 +623,36 @@ auto_mod_install(){
|
||||
else
|
||||
manual_mod_install "$ip" "$gameport"
|
||||
fi
|
||||
=======
|
||||
popup 300
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
#calc_mod_sizes
|
||||
#local total_size=$(numfmt --to=iec $totalmodsize)
|
||||
log="$default_steam_path/logs/content_log.txt"
|
||||
[[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status"
|
||||
touch "/tmp/dz.status"
|
||||
console_dl "$diff" &&
|
||||
$steam_cmd steam://open/downloads && 2>/dev/null 1>&2
|
||||
win=$(xdotool search --name "DZG Watcher")
|
||||
xdotool windowactivate $win
|
||||
until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do
|
||||
local missing=$(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort) | wc -l)
|
||||
echo "# Downloaded $((${#modids[@]}-missing)) of ${#modids[@]} mods. ESC cancels"
|
||||
done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null
|
||||
compare
|
||||
[[ $force_update -eq 1 ]] && { unset force_update; return; }
|
||||
if [[ -z $diff ]]; then
|
||||
check_timestamps
|
||||
passed_mod_check > >($steamsafe_zenity --pulsate --progress --title="DZGUI" --auto-close --width=500 2>/dev/null)
|
||||
launch
|
||||
else
|
||||
manual_mod_install
|
||||
fi
|
||||
else
|
||||
manual_mod_install
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
get_local_stamps(){
|
||||
concat(){
|
||||
@@ -644,10 +792,51 @@ prepare_ip_list(){
|
||||
done
|
||||
fi
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
history_table(){
|
||||
[[ -f /tmp/dz.hist ]] && rm /tmp/dz.hist
|
||||
for i in $(cat $hist_file); do
|
||||
echo "# Getting metadata for $i"
|
||||
local meta_file=$(mktemp)
|
||||
source $config_file
|
||||
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$i&key=$steam_api"
|
||||
curl -Ls "$url" > $meta_file
|
||||
json=$(mktemp)
|
||||
< $meta_file jq '.response' > $json
|
||||
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
|
||||
prepare_ip_list "$meta_file" >> /tmp/dz.hist
|
||||
sleep 0.5s
|
||||
done | $steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --width=500 --no-cancel 2>/dev/null
|
||||
[[ $? -eq 1 ]] && return
|
||||
while true; do
|
||||
sel=$(cat /tmp/dz.hist | $steamsafe_zenity --width 1200 --height 800 --title="DZGUI" --text="Recent servers" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2,5 --separator=%% 2>/dev/null)
|
||||
if [[ $? -eq 1 ]]; then
|
||||
return_from_table=1
|
||||
rm /tmp/dz.hist
|
||||
return
|
||||
fi
|
||||
if [[ -z $sel ]]; then
|
||||
echo "No selection"
|
||||
else
|
||||
local addr="$(echo "$sel" | awk -F"%%" '{print $1}')"
|
||||
local qport="$(echo "$sel" | awk -F"%%" '{print $2}')"
|
||||
local ip=$(awk -F: '{print $1}' <<< $addr)
|
||||
local gameport=$(awk -F: '{print $2}' <<< $addr)
|
||||
local sa_ip=$(echo "$ip:$gameport%%$qport")
|
||||
qport_list="$sa_ip"
|
||||
connect "$sel" "ip"
|
||||
fi
|
||||
done
|
||||
rm /tmp/dz.hist
|
||||
}
|
||||
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
ip_table(){
|
||||
local sel
|
||||
local res="$1"
|
||||
while true; do
|
||||
<<<<<<< HEAD
|
||||
sel=$(prepare_ip_list "$res" | $steamsafe_zenity --width 1200 --height 800 --text="Multiple maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=1,2,5 --separator=%% 2>/dev/null)
|
||||
[[ $? -eq 1 ]] && return 1
|
||||
echo "$sel"
|
||||
@@ -659,6 +848,34 @@ fetch_ip_metadata(){
|
||||
source $config_file
|
||||
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
|
||||
curl -Ls "$url"
|
||||
=======
|
||||
sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --text="One or more maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2 --separator=%% 2>/dev/null)
|
||||
if [[ $? -eq 1 ]]; then
|
||||
return_from_table=1
|
||||
return
|
||||
fi
|
||||
if [[ -z $sel ]]; then
|
||||
echo "No selection"
|
||||
else
|
||||
local gameport="$(echo "$sel" | awk -F: '{print $2}')"
|
||||
local ip="$(echo "$sel" | awk -F: '{print $1}')"
|
||||
local addr=$(< $json jq -r --arg gameport $gameport '.servers[]|select(.gameport == ($gameport|tonumber)).addr')
|
||||
local qport=$(echo "$addr" | awk -F: '{print $2}')
|
||||
local sa_ip=$(echo "$ip:$gameport%%$qport")
|
||||
qport_list="$sa_ip"
|
||||
connect "$sel" "ip"
|
||||
fi
|
||||
done
|
||||
}
|
||||
fetch_ip_metadata(){
|
||||
meta_file=$(mktemp)
|
||||
source $config_file
|
||||
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
|
||||
curl -Ls "$url" > $meta_file
|
||||
json=$(mktemp)
|
||||
< $meta_file jq '.response' > $json
|
||||
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
|
||||
#TODO: local servers
|
||||
@@ -733,6 +950,7 @@ parse_ips(){
|
||||
source $config_file
|
||||
check_steam_api
|
||||
[[ $? -eq 1 ]] && return
|
||||
<<<<<<< HEAD
|
||||
while true; do
|
||||
local ip
|
||||
ip=$($steamsafe_zenity --entry --text="Enter server IP (omit port)" --title="DZGUI" 2>/dev/null)
|
||||
@@ -761,6 +979,31 @@ parse_ips(){
|
||||
warn "Invalid IP"
|
||||
fi
|
||||
done
|
||||
=======
|
||||
while true; do
|
||||
if [[ $return_from_table -eq 1 ]]; then
|
||||
return_from_table=0
|
||||
return
|
||||
fi
|
||||
ip=$($steamsafe_zenity --entry --text="Enter server IP (omit port)" --title="DZGUI" 2>/dev/null)
|
||||
[[ $? -eq 1 ]] && return
|
||||
if validate_ip "$ip"; then
|
||||
fetch_ip_metadata
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
|
||||
echo "[DZGUI] 96: Failed to retrieve IP metadata"
|
||||
else
|
||||
ip_table
|
||||
fi
|
||||
else
|
||||
continue
|
||||
fi
|
||||
done
|
||||
}
|
||||
fetch_mods(){
|
||||
remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \
|
||||
| jq -r '.data[] .attributes .details .modIds[]')
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
query_defunct(){
|
||||
readarray -t modlist <<< "$@"
|
||||
@@ -817,7 +1060,11 @@ launch(){
|
||||
fi
|
||||
fi
|
||||
if [[ $debug -eq 1 ]]; then
|
||||
<<<<<<< HEAD
|
||||
launch_options="$steam_cmd -applaunch $aid -connect=$ip:$gameport -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\""
|
||||
=======
|
||||
launch_options="$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\""
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
print_launch_options="$(printf "This is a dry run.\nThese options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)"
|
||||
$steamsafe_zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\
|
||||
--text="$print_launch_options" 2>/dev/null
|
||||
@@ -829,8 +1076,15 @@ launch(){
|
||||
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote launch options to \n$source_dir/options.log" 2>/dev/null
|
||||
fi
|
||||
else
|
||||
<<<<<<< HEAD
|
||||
$steamsafe_zenity --width=500 --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null
|
||||
$steam_cmd -applaunch $aid -connect=$ip:$gameport -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
|
||||
=======
|
||||
echo "[DZGUI] All OK. Launching DayZ"
|
||||
$steamsafe_zenity --width=500 --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null
|
||||
$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
|
||||
exit
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
fi
|
||||
}
|
||||
browser(){
|
||||
@@ -891,6 +1145,7 @@ format_table_results(){
|
||||
printf "%s\n%s\n%s\n%s\n" "$name" "$ip" "$gameport" "$qport"
|
||||
}
|
||||
delete_or_connect(){
|
||||
<<<<<<< HEAD
|
||||
local sel="$1"
|
||||
local mode="$2"
|
||||
|
||||
@@ -922,6 +1177,39 @@ delete_or_connect(){
|
||||
connect "$ip" "$gameport" "$qport"
|
||||
return
|
||||
esac
|
||||
=======
|
||||
if [[ $delete -eq 1 ]]; then
|
||||
server_name=$(echo "$sel" | awk -F"%%" '{print $1}')
|
||||
server_id=$(echo "$sel" | awk -F"%%" '{print $2}')
|
||||
$steamsafe_zenity --question --text="Delete this server? \n$server_name" --title="DZGUI" --width=500 2>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
delete_by_id $server_id
|
||||
fi
|
||||
source $config_file
|
||||
unset delete
|
||||
else
|
||||
local lookup_ip=$(echo "$sel" | awk -F: '{print $1}')
|
||||
ip=$lookup_ip
|
||||
fetch_ip_metadata
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
|
||||
echo "[DZGUI] 96: Failed to retrieve IP metadata"
|
||||
else
|
||||
local jad=$(echo "$res" | jq -r '.addr')
|
||||
if [[ $(<<< "$jad" wc -l ) -gt 1 ]]; then
|
||||
ip_table
|
||||
elif [[ $(<<< "$jad" wc -l ) -eq 1 ]]; then
|
||||
local gameport="$(echo "$res" | jq -r '.gameport')"
|
||||
local ip="$(echo "$jad" | awk -F: '{print $1}')"
|
||||
local qport=$(echo "$jad" | awk -F: '{print $2}')
|
||||
local sa_ip=$(echo "$ip:$gameport%%$qport")
|
||||
qport_list="$sa_ip"
|
||||
local sel="$ip:$gameport%%$qport"
|
||||
connect "$sel" "ip"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
populate(){
|
||||
local switch="$1"
|
||||
@@ -969,7 +1257,10 @@ connect_to_fav(){
|
||||
[[ $? -eq 1 ]] && return 1
|
||||
}
|
||||
set_header(){
|
||||
<<<<<<< HEAD
|
||||
local switch="$1"
|
||||
=======
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
logger INFO "Header mode is $1"
|
||||
print_news
|
||||
@@ -1060,6 +1351,15 @@ focus_beta_client(){
|
||||
console_dl(){
|
||||
readarray -t modids <<< "$@"
|
||||
focus_beta_client
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
# steam steam://open/console 2>/dev/null 1>&2 &&
|
||||
# sleep 1s
|
||||
#https://github.com/jordansissel/xdotool/issues/67
|
||||
#https://dwm.suckless.org/patches/current_desktop/
|
||||
# local wid=$(xdotool search --onlyvisible --name Steam)
|
||||
#xdotool windowactivate $wid
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
sleep 1.5s
|
||||
for i in "${modids[@]}"; do
|
||||
xdotool type --delay 0 "workshop_download_item $aid $i"
|
||||
@@ -1121,11 +1421,15 @@ popup(){
|
||||
700) pop "Toggled to Flatpak Steam." ;;
|
||||
800) pop "Toggled to native Steam." ;;
|
||||
900) pop "This feature is not supported on Steam Deck." ;;
|
||||
<<<<<<< HEAD
|
||||
1000) pop "No recent history." ;;
|
||||
1100) pop "No results found." ;;
|
||||
1200) pop "Timed out. Server may be temporarily offline or not responding to queries." ;;
|
||||
1300) pop "No favorite server configured." ;;
|
||||
1400) pop "DZGUI must be run in Desktop Mode on Steam Deck." ;;
|
||||
=======
|
||||
1000) pop "No recent history."
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
esac
|
||||
}
|
||||
toggle_console_dl(){
|
||||
@@ -1162,6 +1466,7 @@ toggle_steam_binary(){
|
||||
steam_cmd="steam"
|
||||
update_steam_cmd
|
||||
popup 800;;
|
||||
<<<<<<< HEAD
|
||||
esac
|
||||
}
|
||||
options_menu(){
|
||||
@@ -1319,6 +1624,68 @@ exclude_fpp(){
|
||||
}
|
||||
exclude_tpp(){
|
||||
response=$(<<< "$response" jq '[.[]|select(.gametype|split(",")|any(. == "no3rd"))]')
|
||||
=======
|
||||
esac
|
||||
}
|
||||
options_menu(){
|
||||
case "$auto_install" in
|
||||
0|1|"") auto_hr="OFF"; ;;
|
||||
2) auto_hr="ON"; ;;
|
||||
esac
|
||||
debug_list=(
|
||||
"Toggle branch"
|
||||
"Toggle debug mode"
|
||||
"Output system info"
|
||||
"Toggle auto mod install [$auto_hr]"
|
||||
)
|
||||
#TODO: tech debt: drop old flags
|
||||
[[ $auto_install -eq 2 ]] || [[ $auto_install -eq 1 ]] && debug_list+=("Force update local mods")
|
||||
case "$steam_cmd" in
|
||||
steam) steam_hr=Steam ;;
|
||||
flatpak*) steam_hr=Flatpak ;;
|
||||
esac
|
||||
[[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]")
|
||||
debug_sel=$($steamsafe_zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
|
||||
[[ -z $debug_sel ]] && return
|
||||
case "$debug_sel" in
|
||||
"Toggle branch")
|
||||
enforce_dl=1
|
||||
toggle_branch &&
|
||||
check_version
|
||||
;;
|
||||
"Toggle debug mode") toggle_debug ;;
|
||||
"Output system info")
|
||||
source_script=$(realpath "$0")
|
||||
source_dir=$(dirname "$source_script")
|
||||
generate_log > "$source_dir/DZGUI.log"
|
||||
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
|
||||
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
|
||||
;;
|
||||
Toggle[[:space:]]auto*) toggle_console_dl ;;
|
||||
"Force update local mods")
|
||||
force_update=1
|
||||
force_update_mods
|
||||
merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title="DZGUI" --width=500 2>/dev/null)
|
||||
auto_mod_install
|
||||
;;
|
||||
Toggle[[:space:]]native*) toggle_steam_binary ;;
|
||||
esac
|
||||
}
|
||||
query_and_connect(){
|
||||
[[ -z $whitelist ]] && { popup 600; return; }
|
||||
q(){
|
||||
query_api
|
||||
parse_json
|
||||
create_array
|
||||
}
|
||||
q | $steamsafe_zenity --width=500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
||||
rc=$?
|
||||
if [[ $rc -eq 1 ]]; then
|
||||
:
|
||||
else
|
||||
populate
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
exclude_full(){
|
||||
response=$(echo "$response" | jq '[.[]|select(.players!=.max_players)]')
|
||||
@@ -1407,6 +1774,7 @@ check_geo_file(){
|
||||
md5sum -c "$sums_path" 2>/dev/null 1>&2
|
||||
local res=$?
|
||||
cd $OLDPWD
|
||||
<<<<<<< HEAD
|
||||
[[ $res -eq 0 ]] && return
|
||||
update(){
|
||||
mkdir -p "$helpers_path"
|
||||
@@ -1421,6 +1789,23 @@ check_geo_file(){
|
||||
echo "100"
|
||||
}
|
||||
update > >(pdialog)
|
||||
=======
|
||||
if [[ $res -eq 1 ]]; then
|
||||
run(){
|
||||
mkdir -p "$helpers_path"
|
||||
echo "# Fetching new geolocation DB"
|
||||
curl -Ls "$db_file" > "$gzip"
|
||||
echo "# Extracting coordinates"
|
||||
#force overwrite
|
||||
gunzip -f "$gzip"
|
||||
echo "# Preparing helper file"
|
||||
curl -Ls "$km_helper_url" > "$km_helper"
|
||||
chmod +x $km_helper
|
||||
echo "100"
|
||||
}
|
||||
run > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
choose_filters(){
|
||||
if [[ $is_steam_deck -eq 0 ]]; then
|
||||
@@ -1428,6 +1813,7 @@ choose_filters(){
|
||||
fi
|
||||
sels=$($steamsafe_zenity --title="DZGUI" --text="Server search" --list --checklist --column "Check" --column "Option" --hide-header TRUE "All maps (untick to select from map list)" TRUE "Daytime" TRUE "Nighttime" TRUE "1PP" TRUE "3PP" False "Empty" False "Full" TRUE "Low population" FALSE "Non-ASCII titles" FALSE "Keyword search" $sd_res 2>/dev/null)
|
||||
if [[ $sels =~ Keyword ]]; then
|
||||
<<<<<<< HEAD
|
||||
local search
|
||||
while true; do
|
||||
search=$($steamsafe_zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}')
|
||||
@@ -1439,6 +1825,13 @@ choose_filters(){
|
||||
[[ -z $sels ]] && return
|
||||
echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//'
|
||||
echo "$search"
|
||||
=======
|
||||
search=$($steamsafe_zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}')
|
||||
[[ -z $search ]] && { ret=97; return; }
|
||||
fi
|
||||
[[ -z $sels ]] && return
|
||||
filters=$(echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//')
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
get_dist(){
|
||||
local given_ip="$1"
|
||||
@@ -1536,6 +1929,7 @@ munge_servers(){
|
||||
fi
|
||||
}
|
||||
debug_servers(){
|
||||
<<<<<<< HEAD
|
||||
debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api")
|
||||
local len=$(<<< "$debug_res" jq '[.response.servers[]]|length')
|
||||
if [[ $len -eq 0 ]]; then
|
||||
@@ -1543,6 +1937,19 @@ debug_servers(){
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
=======
|
||||
if [[ -n $steam_api ]]; then
|
||||
exists=true
|
||||
else
|
||||
exists=false
|
||||
fi
|
||||
key_len=${#steam_api}
|
||||
first_char=${steam_api:0:1}
|
||||
last_char=${steam_api:0-1}
|
||||
debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api")
|
||||
debug_len=$(echo "$debug_res" | jq '[.response.servers[]]|length')
|
||||
[[ -z $debug_len ]] && debug_len=0
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
server_browser(){
|
||||
unset ret
|
||||
@@ -1556,6 +1963,7 @@ server_browser(){
|
||||
echo "# Calculating server distances"
|
||||
local_latlon
|
||||
[[ $ret -eq 97 ]] && return
|
||||
<<<<<<< HEAD
|
||||
|
||||
local limit=20000
|
||||
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=$limit&key=$steam_api"
|
||||
@@ -1586,6 +1994,36 @@ server_browser(){
|
||||
|
||||
connect "$ip" "$gameport" "$qport"
|
||||
sd_res="--width=1280 --height=800"
|
||||
=======
|
||||
#TODO: some error handling here
|
||||
fetch(){
|
||||
echo "# Getting server list"
|
||||
response=$(curl -Ls "$url" | jq -r '.response.servers')
|
||||
}
|
||||
fetch > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
||||
total_servers=$(echo "$response" | jq 'length' | numfmt --grouping)
|
||||
players_online=$(curl -Ls "https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=$aid" \
|
||||
| jq '.response.player_count' | numfmt --grouping)
|
||||
debug_servers
|
||||
local sel=$(munge_servers)
|
||||
if [[ -z $sel ]]; then
|
||||
unset filters
|
||||
unset search
|
||||
ret=98
|
||||
sd_res="--width=1280 --height=800"
|
||||
return
|
||||
fi
|
||||
local sel_ip=$(echo "$sel" | awk -F%% '{print $1}')
|
||||
local sel_port=$(echo "$sel" | awk -F%% '{print $2}')
|
||||
qport_list="$sel_ip%%$sel_port"
|
||||
if [[ -n "$sel_ip" ]]; then
|
||||
connect "$sel_ip" "ip"
|
||||
sd_res="--width=1280 --height=800"
|
||||
else
|
||||
sd_res="--width=1280 --height=800"
|
||||
return
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
mods_disk_size(){
|
||||
printf "Total size on disk: %s | " $(du -sh "$workshop_dir" | awk '{print $1}')
|
||||
@@ -1597,12 +2035,17 @@ main_menu(){
|
||||
logger INFO "Setting mode"
|
||||
set_mode
|
||||
while true; do
|
||||
<<<<<<< HEAD
|
||||
set_header "main_menu"
|
||||
=======
|
||||
set_header ${FUNCNAME[0]}
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
rc=$?
|
||||
logger INFO "set_header rc is $rc"
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
case "$sel" in
|
||||
"") warn "No item was selected." ;;
|
||||
<<<<<<< HEAD
|
||||
" Server browser")
|
||||
local filters=$(choose_filters)
|
||||
[[ -z $filters ]] && continue
|
||||
@@ -1617,12 +2060,27 @@ main_menu(){
|
||||
" Add favorite server") add_by_fav ;;
|
||||
" Change favorite server") add_by_fav ;;
|
||||
" Delete server") query_and_connect "delete" ;;
|
||||
=======
|
||||
" Server browser") server_browser ;;
|
||||
" My servers") query_and_connect ;;
|
||||
" Quick connect to favorite server") connect_to_fav ;;
|
||||
" Connect by IP") connect_by_ip ;;
|
||||
" Recent servers (last 10)") history_table ;;
|
||||
" Add server by ID") add_by_id ;;
|
||||
" Add favorite server") add_by_fav ;;
|
||||
" Change favorite server") add_by_fav ;;
|
||||
" Delete server") delete=1; query_and_connect ;;
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
" List installed mods")
|
||||
list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" --column="Dir" \
|
||||
--title="DZGUI" $sd_res --text="$(mods_disk_size)" \
|
||||
--print-column="" 2>/dev/null
|
||||
;;
|
||||
<<<<<<< HEAD
|
||||
" View changelog") changelog ;;
|
||||
=======
|
||||
" View changelog") changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null ;;
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
" Advanced options")
|
||||
options_menu
|
||||
main_menu
|
||||
@@ -1640,6 +2098,7 @@ main_menu(){
|
||||
fi
|
||||
done
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
set_fav(){
|
||||
local fav="$1"
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
@@ -1653,6 +2112,83 @@ set_fav(){
|
||||
local info=$(a2s "$ip" "$qport" info)
|
||||
local name=$(<<< $info jq -r '.name')
|
||||
echo "'$name'"
|
||||
=======
|
||||
page_through(){
|
||||
list_response=$(curl -s "$page")
|
||||
list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
||||
idarr+=("$list")
|
||||
parse_json
|
||||
}
|
||||
parse_json(){
|
||||
echo "# Parsing servers"
|
||||
page=$(echo "$list_response" | jq -r '.links.next?')
|
||||
if [[ $first_entry -eq 1 ]]; then
|
||||
local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
||||
idarr+=("$list")
|
||||
first_entry=0
|
||||
fi
|
||||
if [[ "$page" != "null" ]]; then
|
||||
page_through
|
||||
else
|
||||
printf "%s\n" "${idarr[@]}" > $tmp
|
||||
idarr=()
|
||||
fetch_query_ports
|
||||
fi
|
||||
}
|
||||
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
|
||||
}
|
||||
create_array(){
|
||||
rows=()
|
||||
#TODO: improve error handling for null values
|
||||
lc=1
|
||||
while read line; do
|
||||
name=$(echo "$line" | awk -F'\t' '{print $1}')
|
||||
#truncate names
|
||||
if [[ $(echo "$name" | wc -m) -gt 50 ]]; then
|
||||
name="$(echo "$name" | awk '{print substr($0,1,50) "..."}')"
|
||||
else
|
||||
:
|
||||
fi
|
||||
ip=$(echo "$line" | awk -F'\t' '{print $2}')
|
||||
players=$(echo "$line" | awk -F'\t' '{print $3}')
|
||||
time=$(echo "$line" | awk -F'\t' '{print $4}')
|
||||
stat=$(echo "$line" | awk -F'\t' '{print $5}')
|
||||
|
||||
#TODO: probe offline return codes
|
||||
id=$(echo "$line" | awk -F'\t' '{print $6}')
|
||||
tc=$(awk 'END{print NR}' $tmp)
|
||||
if [[ $delete -eq 1 ]]; then
|
||||
declare -g -a rows=("${rows[@]}" "$name" "$id")
|
||||
else
|
||||
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 < <(cat "$tmp" | sort -k1)
|
||||
|
||||
for i in "${rows[@]}"; do echo -e "$i"; done > $tmp
|
||||
}
|
||||
set_fav(){
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
echo "[DZGUI] Querying favorite server"
|
||||
query_api
|
||||
fav_label=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "filter[game]=$game" -d "filter[ids][whitelist]=$fav" \
|
||||
| jq -r '.data[] .attributes .name')
|
||||
if [[ -z $fav_label ]]; then
|
||||
fav_label=null
|
||||
else
|
||||
fav_label="'$fav_label'"
|
||||
fi
|
||||
logger INFO "Fav label is $fav_label"
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
check_unmerged(){
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
@@ -1666,8 +2202,15 @@ merge_config(){
|
||||
legacy_fav
|
||||
legacy_ids
|
||||
[[ -z $staging_dir ]] && staging_dir="/tmp"
|
||||
<<<<<<< HEAD
|
||||
update_config
|
||||
tdialog "Wrote new config format to \n${config_file}\nIf errors occur, you can restore the file:\n${config_file}.old"
|
||||
=======
|
||||
write_config > $config_file
|
||||
printf "[DZGUI] Wrote new config file to %sdztuirc\n" $config_path
|
||||
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote new config format to \n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null
|
||||
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
download_new_version(){
|
||||
if [[ $is_steam_deck -eq 1 ]]; then
|
||||
@@ -1734,6 +2277,11 @@ check_version(){
|
||||
logger INFO "Local version is same as upstream"
|
||||
check_unmerged
|
||||
else
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
# echo "100"
|
||||
echo "[DZGUI] Upstream ($upstream) != local ($version)"
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
logger INFO "Local and remote version mismatch"
|
||||
if [[ $enforce_dl -eq 1 ]]; then
|
||||
enforce_dl
|
||||
@@ -1748,6 +2296,7 @@ check_architecture(){
|
||||
if [[ -n "$cpu" ]]; then
|
||||
is_steam_deck=1
|
||||
logger INFO "Setting architecture to 'Steam Deck'"
|
||||
<<<<<<< HEAD
|
||||
[[ $is_steam_deck -eq 1 ]] && test_display_mode
|
||||
if [[ $gamemode -eq 1 ]]; then
|
||||
popup 1400 &&
|
||||
@@ -1756,6 +2305,13 @@ check_architecture(){
|
||||
else
|
||||
is_steam_deck=0
|
||||
logger INFO "Setting architecture to 'desktop'"
|
||||
=======
|
||||
echo "[DZGUI] Setting architecture to 'Steam Deck'"
|
||||
else
|
||||
is_steam_deck=0
|
||||
logger INFO "Setting architecture to 'desktop'"
|
||||
echo "[DZGUI] Setting architecture to 'desktop'"
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
fi
|
||||
}
|
||||
print_ip_list(){
|
||||
@@ -1865,6 +2421,7 @@ add_by_id(){
|
||||
done
|
||||
fi
|
||||
while true; do
|
||||
<<<<<<< HEAD
|
||||
local id
|
||||
id=$(edialog "Enter server ID")
|
||||
[[ $? -eq 1 ]] && return 1
|
||||
@@ -1891,6 +2448,26 @@ add_by_id(){
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
=======
|
||||
id=$($steamsafe_zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null)
|
||||
rc=$?
|
||||
if [[ $rc -eq 1 ]]; then
|
||||
return
|
||||
else
|
||||
if [[ ! $id =~ ^[0-9]+$ ]]; then
|
||||
$steamsafe_zenity --warning --title="DZGUI" --text="Invalid ID" 2>/dev/null
|
||||
else
|
||||
[[ -z $whitelist ]] && new_whitelist="whitelist=\"$id\""
|
||||
[[ -n $whitelist ]] && new_whitelist="whitelist=\"$whitelist,$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
|
||||
$steamsafe_zenity --info --title="DZGUI" --text="Added "$id" to:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" --width=500 2>/dev/null
|
||||
source $config_file
|
||||
return
|
||||
fi
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
done
|
||||
}
|
||||
toggle_debug(){
|
||||
@@ -1904,11 +2481,18 @@ toggle_debug(){
|
||||
}
|
||||
setup(){
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
<<<<<<< HEAD
|
||||
[[ -z $fav_server ]] && return
|
||||
items[10]=" Change favorite server"
|
||||
[[ -n $fav_label ]] && return
|
||||
fav_label=$(set_fav $fav_server)
|
||||
update_config
|
||||
=======
|
||||
if [[ -n $fav ]]; then
|
||||
set_fav
|
||||
items[8]=" Change favorite server"
|
||||
fi
|
||||
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
|
||||
}
|
||||
check_map_count(){
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
@@ -2043,6 +2627,35 @@ steam_deps(){
|
||||
fi
|
||||
logger INFO "steam_cmd set to $steam_cmd"
|
||||
}
|
||||
update_steam_cmd(){
|
||||
local new_cmd
|
||||
preferred_client="$steam_cmd"
|
||||
new_cmd="preferred_client=\"$preferred_client\""
|
||||
mv $config_file ${config_path}dztuirc.old
|
||||
nr=$(awk '/preferred_client=/ {print NR}' ${config_path}dztuirc.old)
|
||||
awk -v "var=$new_cmd" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
|
||||
}
|
||||
steam_deps(){
|
||||
logger INFO "${FUNCNAME[0]}"
|
||||
local flatpak steam
|
||||
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
|
||||
steam=$(command -v steam)
|
||||
if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then
|
||||
warn "Requires Steam or Flatpak Steam"
|
||||
logger ERROR "Steam was missing"
|
||||
exit
|
||||
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
||||
toggle_steam=1
|
||||
steam_cmd="steam"
|
||||
[[ -n $preferred_client ]] && steam_cmd="$preferred_client"
|
||||
[[ -z $preferred_client ]] && update_steam_cmd
|
||||
elif [[ -n "$steam" ]]; then
|
||||
steam_cmd="steam"
|
||||
else
|
||||
steam_cmd="flatpak run com.valvesoftware.Steam"
|
||||
fi
|
||||
logger INFO "steam_cmd set to $steam_cmd"
|
||||
}
|
||||
initial_setup(){
|
||||
echo "# Initial setup"
|
||||
run_depcheck
|
||||
@@ -2061,6 +2674,17 @@ initial_setup(){
|
||||
check_news
|
||||
echo "100"
|
||||
}
|
||||
test_zenity_version(){
|
||||
local current="$1"
|
||||
local cutoff="3.99.1"
|
||||
if [[ "$(printf '%s\n' "$cutoff" "$current" | sort -V | head -n1)" == "$cutoff" ]]; then
|
||||
logger INFO "zenity version greater than or equal to $cutoff"
|
||||
echo greater
|
||||
else
|
||||
logger INFO "zenity version lesser than $cutoff"
|
||||
echo lesser
|
||||
fi
|
||||
}
|
||||
main(){
|
||||
local parent=$(cat /proc/$PPID/comm)
|
||||
[[ -f "$debug_log" ]] && rm "$debug_log"
|
||||
|
||||
Reference in new issue
Block a user