mirror of
https://github.com/aclist/dztui.git
synced 2025-01-01 15:12:05 +01:00
chore: backports from stable
This commit is contained in:
parent
24b07a9bf9
commit
3f2397ad74
1 changed files with 186 additions and 146 deletions
258
dzgui.sh
258
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version=3.4.0-rc.8
|
version=3.4.0-rc.9
|
||||||
|
|
||||||
aid=221100
|
aid=221100
|
||||||
game="dayz"
|
game="dayz"
|
||||||
|
@ -13,6 +13,7 @@ config_file="${config_path}dztuirc"
|
||||||
hist_file="${config_path}/history"
|
hist_file="${config_path}/history"
|
||||||
tmp=/tmp/dzgui.tmp
|
tmp=/tmp/dzgui.tmp
|
||||||
fifo=/tmp/table.tmp
|
fifo=/tmp/table.tmp
|
||||||
|
debug_log="$PWD/DZGUI_DEBUG.log"
|
||||||
separator="%%"
|
separator="%%"
|
||||||
check_config_msg="Check config values and restart."
|
check_config_msg="Check config values and restart."
|
||||||
issues_url="https://github.com/aclist/dztui/issues"
|
issues_url="https://github.com/aclist/dztui/issues"
|
||||||
|
@ -52,13 +53,16 @@ update_last_seen(){
|
||||||
source $config_file
|
source $config_file
|
||||||
}
|
}
|
||||||
check_news(){
|
check_news(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
echo "# Checking news"
|
echo "# Checking news"
|
||||||
[[ $branch == "stable" ]] && news_url="$stable_url/news"
|
[[ $branch == "stable" ]] && news_url="$stable_url/news"
|
||||||
[[ $branch == "testing" ]] && news_url="$testing_url/news"
|
[[ $branch == "testing" ]] && news_url="$testing_url/news"
|
||||||
result=$(curl -Ls "$news_url")
|
result=$(curl -Ls "$news_url")
|
||||||
sum=$(echo -n "$result" | md5sum | awk '{print $1}')
|
sum=$(echo -n "$result" | md5sum | awk '{print $1}')
|
||||||
|
logger INFO "News: $result"
|
||||||
}
|
}
|
||||||
print_news(){
|
print_news(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ $sum == $seen_news || -z $result ]]; then
|
if [[ $sum == $seen_news || -z $result ]]; then
|
||||||
hchar=""
|
hchar=""
|
||||||
news=""
|
news=""
|
||||||
|
@ -127,12 +131,14 @@ info(){
|
||||||
$steamsafe_zenity --info --title="DZGUI" --text="$1" --width=500 2>/dev/null
|
$steamsafe_zenity --info --title="DZGUI" --text="$1" --width=500 2>/dev/null
|
||||||
}
|
}
|
||||||
set_api_params(){
|
set_api_params(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
response=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "sort=-players" \
|
response=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "sort=-players" \
|
||||||
-d "filter[game]=$game" -d "filter[ids][whitelist]=$list_of_ids")
|
-d "filter[game]=$game" -d "filter[ids][whitelist]=$list_of_ids")
|
||||||
list_response=$response
|
list_response=$response
|
||||||
first_entry=1
|
first_entry=1
|
||||||
}
|
}
|
||||||
query_api(){
|
query_api(){
|
||||||
|
logger INFO ${FUNCNAME[0]}
|
||||||
echo "# Querying API"
|
echo "# Querying API"
|
||||||
#TODO: prevent drawing list if null values returned without API error
|
#TODO: prevent drawing list if null values returned without API error
|
||||||
if [[ $one_shot_launch -eq 1 ]]; then
|
if [[ $one_shot_launch -eq 1 ]]; then
|
||||||
|
@ -232,17 +238,17 @@ freedesktop_dirs(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
find_library_folder(){
|
find_library_folder(){
|
||||||
echo "ENTERED: ${FUNCNAME[0]}" >> /tmp/dzdebug.log
|
logger INFO "${FUNCNAME[0]}"
|
||||||
echo "RECEIVED ARG: $1" >> /tmp/dzdebug.log
|
logger INFO "User picked directory: '$1'"
|
||||||
steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path')"
|
steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" | jq -r '.libraryfolders[]|select(.apps|has("221100")).path')"
|
||||||
echo "STEAM PATH RESOLVED TO: $steam_path" >> /tmp/dzdebug.log
|
logger INFO "Steam path resolved to: $steam_path"
|
||||||
}
|
}
|
||||||
file_picker(){
|
file_picker(){
|
||||||
echo "${FUNCNAME[0]}" >> /tmp/dzdebug.log
|
logger INFO "${FUNCNAME[0]}"
|
||||||
local path=$($steamsafe_zenity --file-selection --directory 2>/dev/null)
|
local path=$($steamsafe_zenity --file-selection --directory 2>/dev/null)
|
||||||
echo "FILE PICKER PATH RESOLVED TO: $path" >> /tmp/dzdebug.log
|
logger INFO "File picker path resolve to: $path"
|
||||||
if [[ -z "$path" ]]; then
|
if [[ -z "$path" ]]; then
|
||||||
echo "PATH WAS EMPTY" >> /tmp/dzdebug.log
|
logger INFO "Path was empty"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
default_steam_path="$path"
|
default_steam_path="$path"
|
||||||
|
@ -250,7 +256,7 @@ file_picker(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
create_config(){
|
create_config(){
|
||||||
debug "ENTERED ${FUNCNAME[0]}"
|
logger INFO "${FUNCNAME[0]}"
|
||||||
check_pyver
|
check_pyver
|
||||||
write_to_config(){
|
write_to_config(){
|
||||||
mkdir -p $config_path
|
mkdir -p $config_path
|
||||||
|
@ -279,15 +285,15 @@ create_config(){
|
||||||
warn "Invalid BM API key"
|
warn "Invalid BM API key"
|
||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
debug "STEAMSAFEZENITY: $steamsafe_zenity"
|
logger INFO "steamsafe_zenity is $steamsafe_zenity"
|
||||||
[[ -n $steam_path ]] && { write_to_config; return; }
|
[[ -n $steam_path ]] && { write_to_config; return; }
|
||||||
find_default_path
|
find_default_path
|
||||||
find_library_folder "$default_steam_path"
|
find_library_folder "$default_steam_path"
|
||||||
if [[ -z $steam_path ]]; then
|
if [[ -z $steam_path ]]; then
|
||||||
debug "STEAM PATH WAS EMPTY"
|
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"
|
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
|
if [[ $? -eq 0 ]]; then
|
||||||
debug "USER SELECTED FILE PICKER"
|
logger INFO "User selected file picker"
|
||||||
file_picker
|
file_picker
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
|
@ -309,25 +315,29 @@ varcheck(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
run_depcheck(){
|
run_depcheck(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ -n $(depcheck) ]]; then
|
if [[ -n $(depcheck) ]]; then
|
||||||
echo "100"
|
echo "100"
|
||||||
|
logger ERROR "Missing dependencies, quitting"
|
||||||
$steamsafe_zenity --warning --ok-label="Exit" --title="DZGUI" --text="$(depcheck)"
|
$steamsafe_zenity --warning --ok-label="Exit" --title="DZGUI" --text="$(depcheck)"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
debug(){
|
logger(){
|
||||||
echo "$*" >> /tmp/dzdebug.log
|
local date="$(date "+%F %T")"
|
||||||
|
local tag="$1"
|
||||||
|
local string="$2"
|
||||||
|
printf "[%s] [%s] %s\n" "$date" "$tag" "$string" >> "$debug_log"
|
||||||
}
|
}
|
||||||
check_pyver(){
|
check_pyver(){
|
||||||
debug "ENTERED ${FUNCNAME[0]}"
|
|
||||||
pyver=$(python3 --version | awk '{print $2}')
|
pyver=$(python3 --version | awk '{print $2}')
|
||||||
debug "PYVER is $pyver"
|
|
||||||
if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]]; then
|
if [[ -z $pyver ]] || [[ ${pyver:0:1} -lt 3 ]]; then
|
||||||
warn "Requires python >=3.0" &&
|
warn "Requires python >=3.0" &&
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
run_varcheck(){
|
run_varcheck(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
source $config_file
|
source $config_file
|
||||||
workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
workshop_dir="$steam_path/steamapps/workshop/content/$aid"
|
||||||
game_dir="$steam_path/steamapps/common/DayZ"
|
game_dir="$steam_path/steamapps/common/DayZ"
|
||||||
|
@ -335,6 +345,7 @@ run_varcheck(){
|
||||||
$steamsafe_zenity --question --cancel-label="Exit" --text="Malformed config file. This is probably user error.\nStart first-time setup process again?" --width=500 2>/dev/null
|
$steamsafe_zenity --question --cancel-label="Exit" --text="Malformed config file. This is probably user error.\nStart first-time setup process again?" --width=500 2>/dev/null
|
||||||
code=$?
|
code=$?
|
||||||
if [[ $code -eq 1 ]]; then
|
if [[ $code -eq 1 ]]; then
|
||||||
|
logger ERROR "Malformed config vars"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
create_config
|
create_config
|
||||||
|
@ -342,19 +353,17 @@ run_varcheck(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
config(){
|
config(){
|
||||||
debug "ENTERED ${FUNCNAME[0]}"
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ ! -f $config_file ]]; then
|
if [[ ! -f $config_file ]]; then
|
||||||
debug "CONFIG FILE MISSING"
|
logger WARN "Config file missing"
|
||||||
debug "STEAMSAFEZENITY is $steamsafe_zenity"
|
logger INFO "steamsafe_zenity is $steamsafe_zenity"
|
||||||
$steamsafe_zenity --width 500 --info --text="Config file not found. Click OK to proceed to first-time setup." 2>/dev/null
|
$steamsafe_zenity --width=500 --info --text="Config file not found. Click OK to proceed to first-time setup." 2>/dev/null
|
||||||
code=$?
|
code=$?
|
||||||
debug "RETURN CODE WAS $code"
|
logger INFO "Return code $code"
|
||||||
#TODO: prevent progress if user hits ESC
|
#TODO: prevent progress if user hits ESC
|
||||||
if [[ $code -eq 1 ]]; then
|
if [[ $code -eq 1 ]]; then
|
||||||
debug "RECEIVED EXIT CODE 1"
|
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
debug "CREATING CONFIG"
|
|
||||||
create_config
|
create_config
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -435,7 +444,6 @@ manual_mod_install(){
|
||||||
compare
|
compare
|
||||||
if [[ -z $diff ]]; then
|
if [[ -z $diff ]]; then
|
||||||
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
||||||
echo "${FUNCNAME[0]}" >> $config_path/dzdebug
|
|
||||||
launch
|
launch
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
@ -446,6 +454,7 @@ encode(){
|
||||||
echo "$1" | md5sum | cut -c -8
|
echo "$1" | md5sum | cut -c -8
|
||||||
}
|
}
|
||||||
stale_symlinks(){
|
stale_symlinks(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
for l in $(find "$game_dir" -xtype l); do
|
for l in $(find "$game_dir" -xtype l); do
|
||||||
unlink $l
|
unlink $l
|
||||||
done
|
done
|
||||||
|
@ -465,31 +474,34 @@ legacy_symlinks(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
symlinks(){
|
symlinks(){
|
||||||
readarray -t wdirs < <(find "$workshop_dir"/*/meta.cpp)
|
for d in "$workshop_dir"/*; do
|
||||||
for (( i = 0; i < ${#wdirs[@]}; i++ )); do
|
id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
|
||||||
echo "# Processing symlink $i of ${#wdirs[@]}"
|
|
||||||
id=$(awk -F"= " '/publishedid/ {print $2}' "${wdirs[$i]}" | awk -F\; '{print $1}')
|
|
||||||
mod=$(awk -F\" '/name/ {print $2}' "${wdirs[$i]}" | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g')
|
|
||||||
encoded_id=$(encode "$id")
|
encoded_id=$(encode "$id")
|
||||||
|
mod=$(awk -F\" '/name/ {print $2}' "$d"/meta.cpp | sed -E 's/[^[:alpha:]0-9]+/_/g; s/^_|_$//g')
|
||||||
link="@$encoded_id"
|
link="@$encoded_id"
|
||||||
if [[ -h "$game_dir/$link" ]]; then
|
if [[ -h "$game_dir/$link" ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
ln -fs "${wdirs[$i]}" "$game_dir/$link"
|
printf "[DZGUI] Creating symlink for $mod\n"
|
||||||
|
ln -fs "$d" "$game_dir/$link"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
passed_mod_check(){
|
passed_mod_check(){
|
||||||
|
echo "[DZGUI] Passed mod check"
|
||||||
|
echo "# Preparing symlinks"
|
||||||
|
legacy_symlinks
|
||||||
symlinks
|
symlinks
|
||||||
echo "100"
|
echo "100"
|
||||||
|
|
||||||
}
|
}
|
||||||
auto_mod_install(){
|
auto_mod_install(){
|
||||||
[[ -z $(is_steam_running) ]] && { $steamsafe_zenity --info --text "Steam must be running to use this feature."; return; }
|
#[[ -z $(is_steam_running) ]] && { $steamsafe_zenity --info --text "Steam must be running to use this feature."; return; }
|
||||||
popup 300
|
popup 300
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 0 ]]; then
|
if [[ $rc -eq 0 ]]; then
|
||||||
calc_mod_sizes
|
#calc_mod_sizes
|
||||||
local total_size=$(numfmt --to=iec $totalmodsize)
|
#local total_size=$(numfmt --to=iec $totalmodsize)
|
||||||
log="$default_steam_path/logs/content_log.txt"
|
log="$default_steam_path/logs/content_log.txt"
|
||||||
[[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status"
|
[[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status"
|
||||||
touch "/tmp/dz.status"
|
touch "/tmp/dz.status"
|
||||||
|
@ -584,7 +596,7 @@ update_history(){
|
||||||
echo -e "${old}${ip}" > "$hist_file"
|
echo -e "${old}${ip}" > "$hist_file"
|
||||||
}
|
}
|
||||||
is_steam_running(){
|
is_steam_running(){
|
||||||
wmctrl -ilx | awk 'tolower($3) == "steam.steam"'
|
xdotool search --onlyvisible --name "Steam"
|
||||||
}
|
}
|
||||||
connect(){
|
connect(){
|
||||||
#TODO: sanitize/validate input
|
#TODO: sanitize/validate input
|
||||||
|
@ -616,7 +628,6 @@ connect(){
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
|
||||||
echo "${FUNCNAME[0]}" >> $config_path/dzdebug
|
|
||||||
update_history
|
update_history
|
||||||
launch
|
launch
|
||||||
fi
|
fi
|
||||||
|
@ -708,7 +719,7 @@ history_table(){
|
||||||
|
|
||||||
ip_table(){
|
ip_table(){
|
||||||
while true; do
|
while true; do
|
||||||
sel=$(prepare_ip_list "$meta_file" | $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=2 --separator=%% 2>/dev/null)
|
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
|
if [[ $? -eq 1 ]]; then
|
||||||
return_from_table=1
|
return_from_table=1
|
||||||
return
|
return
|
||||||
|
@ -867,12 +878,12 @@ launch(){
|
||||||
source_dir=$(dirname "$source_script")
|
source_dir=$(dirname "$source_script")
|
||||||
echo "$launch_options" > "$source_dir"/options.log
|
echo "$launch_options" > "$source_dir"/options.log
|
||||||
echo "[DZGUI] Wrote launch options to $source_dir/options.log"
|
echo "[DZGUI] Wrote launch options to $source_dir/options.log"
|
||||||
$steamsafe_zenity --info --width 500 --title="DZGUI" --text="Wrote launch options to \n$source_dir/options.log" 2>/dev/null
|
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote launch options to \n$source_dir/options.log" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "[DZGUI] All OK. Launching DayZ"
|
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
|
$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\"
|
$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -905,11 +916,13 @@ hof(){
|
||||||
browser "${help_url}#_hall_of_fame"
|
browser "${help_url}#_hall_of_fame"
|
||||||
}
|
}
|
||||||
set_mode(){
|
set_mode(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ $debug -eq 1 ]]; then
|
if [[ $debug -eq 1 ]]; then
|
||||||
mode=debug
|
mode=debug
|
||||||
else
|
else
|
||||||
mode=normal
|
mode=normal
|
||||||
fi
|
fi
|
||||||
|
logger INFO "Mode is $mode"
|
||||||
}
|
}
|
||||||
delete_by_id(){
|
delete_by_id(){
|
||||||
new_whitelist="whitelist=\"$(echo "$whitelist" | sed "s/,$server_id$//;s/^$server_id,//;s/,$server_id,/,/;s/^$server_id$//")\""
|
new_whitelist="whitelist=\"$(echo "$whitelist" | sed "s/,$server_id$//;s/^$server_id,//;s/,$server_id,/,/;s/^$server_id$//")\""
|
||||||
|
@ -1004,6 +1017,8 @@ connect_to_fav(){
|
||||||
|
|
||||||
}
|
}
|
||||||
set_header(){
|
set_header(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
|
logger INFO "Header mode is $1"
|
||||||
print_news
|
print_news
|
||||||
[[ $auto_install -eq 2 ]] && install_mode="auto"
|
[[ $auto_install -eq 2 ]] && install_mode="auto"
|
||||||
[[ $auto_install -eq 1 ]] && install_mode="headless"
|
[[ $auto_install -eq 1 ]] && install_mode="headless"
|
||||||
|
@ -1032,38 +1047,6 @@ toggle_branch(){
|
||||||
printf "[DZGUI] Toggled branch to '$branch'\n"
|
printf "[DZGUI] Toggled branch to '$branch'\n"
|
||||||
source $config_file
|
source $config_file
|
||||||
}
|
}
|
||||||
is_beta(){
|
|
||||||
local dir="$default_steam_path/package"
|
|
||||||
if [[ -f $dir/beta ]]; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
focus_beta_client(){
|
|
||||||
wid(){
|
|
||||||
wmctrl -ilx | awk 'tolower($3) == "steam.steam"' | grep 'Steam$' | awk '{print $1}'
|
|
||||||
}
|
|
||||||
until [[ -n $(wid) ]]; do
|
|
||||||
:
|
|
||||||
done
|
|
||||||
wmctrl -ia $(wid)
|
|
||||||
sleep 0.1s
|
|
||||||
wid=$(xdotool getactivewindow)
|
|
||||||
local geo=$(xdotool getwindowgeometry $wid)
|
|
||||||
local pos=$(<<< "$geo" awk 'NR==2 {print $2}' | sed 's/,/ /')
|
|
||||||
local dim=$(<<< "$geo" awk 'NR==3 {print $2}' | sed 's/x/ /')
|
|
||||||
local pos1=$(<<< "$pos" awk '{print $1}')
|
|
||||||
local pos2=$(<<< "$pos" awk '{print $2}')
|
|
||||||
local dim1=$(<<< "$dim" awk '{print $1}')
|
|
||||||
local dim2=$(<<< "$dim" awk '{print $2}')
|
|
||||||
local dim1=$(((dim1/2)+pos1))
|
|
||||||
local dim2=$(((dim2/2)+pos2))
|
|
||||||
xdotool mousemove $dim1 $dim2
|
|
||||||
xdotool click 1
|
|
||||||
sleep 0.5s
|
|
||||||
xdotool key Tab
|
|
||||||
}
|
|
||||||
generate_log(){
|
generate_log(){
|
||||||
cat <<-DOC
|
cat <<-DOC
|
||||||
Linux: $(uname -mrs)
|
Linux: $(uname -mrs)
|
||||||
|
@ -1078,26 +1061,46 @@ generate_log(){
|
||||||
$(list_mods)
|
$(list_mods)
|
||||||
DOC
|
DOC
|
||||||
}
|
}
|
||||||
|
focus_beta_client(){
|
||||||
|
steam steam://open/console 2>/dev/null 1>&2 &&
|
||||||
|
sleep 1s
|
||||||
|
wid(){
|
||||||
|
#wmctrl -ilx | awk 'tolower($3) == "steam.steam"' | grep 'Steam$' | awk '{print $1}'
|
||||||
|
wmctrl -ilx | awk '$3 == "steamwebhelper.steam" {print $1}'
|
||||||
|
}
|
||||||
|
until [[ -n $(wid) ]]; do
|
||||||
|
:
|
||||||
|
done
|
||||||
|
wmctrl -ia $(wid)
|
||||||
|
sleep 0.1s
|
||||||
|
wid=$(xdotool getactivewindow)
|
||||||
|
echo wid is $wid
|
||||||
|
local geo=$(xdotool getwindowgeometry $wid)
|
||||||
|
local pos=$(<<< "$geo" awk 'NR==2 {print $2}' | sed 's/,/ /')
|
||||||
|
local dim=$(<<< "$geo" awk 'NR==3 {print $2}' | sed 's/x/ /')
|
||||||
|
local pos1=$(<<< "$pos" awk '{print $1}')
|
||||||
|
local pos2=$(<<< "$pos" awk '{print $2}')
|
||||||
|
local dim1=$(<<< "$dim" awk '{print $1}')
|
||||||
|
local dim2=$(<<< "$dim" awk '{print $2}')
|
||||||
|
local dim1=$(((dim1/2)+pos1))
|
||||||
|
local dim2=$(((dim2/2)+pos2))
|
||||||
|
echo moving mouse
|
||||||
|
xdotool mousemove $dim1 $dim2
|
||||||
|
xdotool click 1
|
||||||
|
sleep 0.5s
|
||||||
|
xdotool key Tab
|
||||||
|
}
|
||||||
console_dl(){
|
console_dl(){
|
||||||
readarray -t modids <<< "$@"
|
readarray -t modids <<< "$@"
|
||||||
$steam_cmd steam://open/console 2>/dev/null 1>&2 &&
|
focus_beta_client
|
||||||
sleep 1s
|
# steam steam://open/console 2>/dev/null 1>&2 &&
|
||||||
|
# sleep 1s
|
||||||
#https://github.com/jordansissel/xdotool/issues/67
|
#https://github.com/jordansissel/xdotool/issues/67
|
||||||
#https://dwm.suckless.org/patches/current_desktop/
|
#https://dwm.suckless.org/patches/current_desktop/
|
||||||
|
# local wid=$(xdotool search --onlyvisible --name Steam)
|
||||||
|
#xdotool windowactivate $wid
|
||||||
sleep 1.5s
|
sleep 1.5s
|
||||||
for i in "${modids[@]}"; do
|
for i in "${modids[@]}"; do
|
||||||
if [[ $(is_beta) -eq 0 ]]; then
|
|
||||||
if [[ ${#modids[@]} -eq 1 ]]; then
|
|
||||||
focus_beta_client
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
wid=0
|
|
||||||
until [[ $(xdotool getwindowname $wid 2>/dev/null) == "Steam" ]]; do
|
|
||||||
wid=$(xdotool getactivewindow)
|
|
||||||
done
|
|
||||||
xdotool windowfocus $wid
|
|
||||||
xdotool key Tab
|
|
||||||
fi
|
|
||||||
xdotool type --delay 0 "workshop_download_item $aid $i"
|
xdotool type --delay 0 "workshop_download_item $aid $i"
|
||||||
sleep 0.5s
|
sleep 0.5s
|
||||||
xdotool key Return
|
xdotool key Return
|
||||||
|
@ -1105,6 +1108,7 @@ console_dl(){
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
find_default_path(){
|
find_default_path(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
discover(){
|
discover(){
|
||||||
echo "# Searching for Steam"
|
echo "# Searching for Steam"
|
||||||
default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path \
|
default_steam_path=$(find / -type d \( -path "/proc" -o -path "*/timeshift" -o -path \
|
||||||
|
@ -1223,9 +1227,8 @@ options_menu(){
|
||||||
"Generate debug log")
|
"Generate debug log")
|
||||||
source_script=$(realpath "$0")
|
source_script=$(realpath "$0")
|
||||||
source_dir=$(dirname "$source_script")
|
source_dir=$(dirname "$source_script")
|
||||||
generate_log > "$source_dir/DZGUI.log"
|
|
||||||
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
|
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
|
||||||
$steamsafe_zenity --info --width 500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
|
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
|
||||||
;;
|
;;
|
||||||
Toggle[[:space:]]auto*) toggle_console_dl ;;
|
Toggle[[:space:]]auto*) toggle_console_dl ;;
|
||||||
"Force update local mods")
|
"Force update local mods")
|
||||||
|
@ -1244,7 +1247,7 @@ query_and_connect(){
|
||||||
parse_json
|
parse_json
|
||||||
create_array
|
create_array
|
||||||
}
|
}
|
||||||
q | $steamsafe_zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
q | $steamsafe_zenity --width=500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 1 ]]; then
|
if [[ $rc -eq 1 ]]; then
|
||||||
:
|
:
|
||||||
|
@ -1449,7 +1452,6 @@ munge_servers(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
debug_servers(){
|
debug_servers(){
|
||||||
[[ -f $debug_log ]] && rm $debug_log
|
|
||||||
if [[ -n $steam_api ]]; then
|
if [[ -n $steam_api ]]; then
|
||||||
exists=true
|
exists=true
|
||||||
else
|
else
|
||||||
|
@ -1461,19 +1463,6 @@ debug_servers(){
|
||||||
debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api")
|
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')
|
debug_len=$(echo "$debug_res" | jq '[.response.servers[]]|length')
|
||||||
[[ -z $debug_len ]] && debug_len=0
|
[[ -z $debug_len ]] && debug_len=0
|
||||||
cat <<-DOC > $debug_log
|
|
||||||
======START DEBUG======
|
|
||||||
Key exists: $exists
|
|
||||||
First char: $first_char
|
|
||||||
Last char: $last_char
|
|
||||||
Key length: $key_len
|
|
||||||
======Short query======
|
|
||||||
Expected: 10
|
|
||||||
Found: $debug_len
|
|
||||||
Response follows---->
|
|
||||||
$debug_res
|
|
||||||
======END DEBUG=======
|
|
||||||
DOC
|
|
||||||
}
|
}
|
||||||
server_browser(){
|
server_browser(){
|
||||||
check_steam_api
|
check_steam_api
|
||||||
|
@ -1497,7 +1486,6 @@ server_browser(){
|
||||||
total_servers=$(echo "$response" | jq 'length' | numfmt --grouping)
|
total_servers=$(echo "$response" | jq 'length' | numfmt --grouping)
|
||||||
players_online=$(curl -Ls "https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=$aid" \
|
players_online=$(curl -Ls "https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=$aid" \
|
||||||
| jq '.response.player_count' | numfmt --grouping)
|
| jq '.response.player_count' | numfmt --grouping)
|
||||||
debug_log="$HOME/.local/share/dzgui/DEBUG.log"
|
|
||||||
debug_servers
|
debug_servers
|
||||||
local sel=$(munge_servers)
|
local sel=$(munge_servers)
|
||||||
if [[ -z $sel ]]; then
|
if [[ -z $sel ]]; then
|
||||||
|
@ -1524,10 +1512,13 @@ mods_disk_size(){
|
||||||
printf "Location: %s/steamapps/workshop/content/221100" "$steam_path"
|
printf "Location: %s/steamapps/workshop/content/221100" "$steam_path"
|
||||||
}
|
}
|
||||||
main_menu(){
|
main_menu(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
|
logger INFO "Setting mode"
|
||||||
set_mode
|
set_mode
|
||||||
while true; do
|
while true; do
|
||||||
set_header ${FUNCNAME[0]}
|
set_header ${FUNCNAME[0]}
|
||||||
rc=$?
|
rc=$?
|
||||||
|
logger INFO "set_header rc is $rc"
|
||||||
if [[ $rc -eq 0 ]]; then
|
if [[ $rc -eq 0 ]]; then
|
||||||
case "$sel" in
|
case "$sel" in
|
||||||
"") warn "No item was selected." ;;
|
"") warn "No item was selected." ;;
|
||||||
|
@ -1558,6 +1549,7 @@ main_menu(){
|
||||||
" NEW: Hall of fame ⧉") hof ;;
|
" NEW: Hall of fame ⧉") hof ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
logger INFO "Returning from main menu"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1626,6 +1618,7 @@ create_array(){
|
||||||
for i in "${rows[@]}"; do echo -e "$i"; done > $tmp
|
for i in "${rows[@]}"; do echo -e "$i"; done > $tmp
|
||||||
}
|
}
|
||||||
set_fav(){
|
set_fav(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
echo "[DZGUI] Querying favorite server"
|
echo "[DZGUI] Querying favorite server"
|
||||||
query_api
|
query_api
|
||||||
fav_label=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "filter[game]=$game" -d "filter[ids][whitelist]=$fav" \
|
fav_label=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "filter[game]=$game" -d "filter[ids][whitelist]=$fav" \
|
||||||
|
@ -1635,8 +1628,10 @@ set_fav(){
|
||||||
else
|
else
|
||||||
fav_label="'$fav_label'"
|
fav_label="'$fav_label'"
|
||||||
fi
|
fi
|
||||||
|
logger INFO "Fav label is $fav_label"
|
||||||
}
|
}
|
||||||
check_unmerged(){
|
check_unmerged(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ -f ${config_path}.unmerged ]]; then
|
if [[ -f ${config_path}.unmerged ]]; then
|
||||||
printf "[DZGUI] Found new config format, merging changes\n"
|
printf "[DZGUI] Found new config format, merging changes\n"
|
||||||
merge_config
|
merge_config
|
||||||
|
@ -1649,17 +1644,17 @@ merge_config(){
|
||||||
[[ -z $staging_dir ]] && staging_dir="/tmp"
|
[[ -z $staging_dir ]] && staging_dir="/tmp"
|
||||||
write_config > $config_file
|
write_config > $config_file
|
||||||
printf "[DZGUI] Wrote new config file to %sdztuirc\n" $config_path
|
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
|
$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
|
||||||
|
|
||||||
}
|
}
|
||||||
download_new_version(){
|
download_new_version(){
|
||||||
echo "# Downloading version $upstream"
|
|
||||||
if [[ $is_steam_deck -eq 1 ]]; then
|
if [[ $is_steam_deck -eq 1 ]]; then
|
||||||
freedesktop_dirs
|
freedesktop_dirs
|
||||||
fi
|
fi
|
||||||
source_script=$(realpath "$0")
|
source_script=$(realpath "$0")
|
||||||
source_dir=$(dirname "$source_script")
|
source_dir=$(dirname "$source_script")
|
||||||
mv $source_script $source_script.old
|
mv $source_script $source_script.old
|
||||||
|
echo "# Downloading version $upstream"
|
||||||
curl -Ls "$version_url" > $source_script
|
curl -Ls "$version_url" > $source_script
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 0 ]]; then
|
if [[ $rc -eq 0 ]]; then
|
||||||
|
@ -1667,7 +1662,7 @@ download_new_version(){
|
||||||
chmod +x $source_script
|
chmod +x $source_script
|
||||||
touch ${config_path}.unmerged
|
touch ${config_path}.unmerged
|
||||||
echo "100"
|
echo "100"
|
||||||
$steamsafe_zenity --question --width 500 --title="DZGUI" --text "DZGUI $upstream successfully downloaded.\nTo view the changelog, select Changelog.\nTo use the new version, select Exit and restart." --ok-label="Changelog" --cancel-label="Exit" 2>/dev/null
|
$steamsafe_zenity --question --width=500 --title="DZGUI" --text "DZGUI $upstream successfully downloaded.\nTo view the changelog, select Changelog.\nTo use the new version, select Exit and restart." --ok-label="Changelog" --cancel-label="Exit" 2>/dev/null
|
||||||
code=$?
|
code=$?
|
||||||
if [[ $code -eq 0 ]]; then
|
if [[ $code -eq 0 ]]; then
|
||||||
changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
|
changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
|
||||||
|
@ -1684,15 +1679,18 @@ download_new_version(){
|
||||||
|
|
||||||
}
|
}
|
||||||
check_branch(){
|
check_branch(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ $branch == "stable" ]]; then
|
if [[ $branch == "stable" ]]; then
|
||||||
version_url="$stable_url/dzgui.sh"
|
version_url="$stable_url/dzgui.sh"
|
||||||
elif [[ $branch == "testing" ]]; then
|
elif [[ $branch == "testing" ]]; then
|
||||||
version_url="$testing_url/dzgui.sh"
|
version_url="$testing_url/dzgui.sh"
|
||||||
fi
|
fi
|
||||||
|
logger INFO "Branch is $branch"
|
||||||
upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
|
logger INFO "Upstream version is $version"
|
||||||
}
|
}
|
||||||
enforce_dl(){
|
enforce_dl(){
|
||||||
download_new_version > >($steamsafe_zenity --progress --title="DZGUI" --pulsate --auto-close --no-cancel --width=500)
|
download_new_version > >($steamsafe_zenity --progress --pulsate --auto-close --no-cancel --width=500)
|
||||||
}
|
}
|
||||||
prompt_dl(){
|
prompt_dl(){
|
||||||
$steamsafe_zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null
|
$steamsafe_zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null
|
||||||
|
@ -1701,19 +1699,22 @@ prompt_dl(){
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
echo "100"
|
echo "100"
|
||||||
download_new_version > >($steamsafe_zenity --title="DZGUI" --progress --pulsate --auto-close --no-cancel --width=500)
|
download_new_version > >($steamsafe_zenity --progress --pulsate --auto-close --no-cancel --width=500)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_version(){
|
check_version(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
[[ -f $config_file ]] && source $config_file
|
[[ -f $config_file ]] && source $config_file
|
||||||
[[ -z $branch ]] && branch="stable"
|
[[ -z $branch ]] && branch="stable"
|
||||||
check_branch
|
check_branch
|
||||||
[[ ! -f "$freedesktop_path/dzgui.desktop" ]] && freedesktop_dirs
|
[[ ! -f "$freedesktop_path/dzgui.desktop" ]] && freedesktop_dirs
|
||||||
if [[ $version == $upstream ]]; then
|
if [[ $version == $upstream ]]; then
|
||||||
|
logger INFO "Local version is same as upstream"
|
||||||
check_unmerged
|
check_unmerged
|
||||||
else
|
else
|
||||||
# echo "100"
|
# echo "100"
|
||||||
echo "[DZGUI] Upstream ($upstream) != local ($version)"
|
echo "[DZGUI] Upstream ($upstream) != local ($version)"
|
||||||
|
logger INFO "Local and remote version mismatch"
|
||||||
if [[ $enforce_dl -eq 1 ]]; then
|
if [[ $enforce_dl -eq 1 ]]; then
|
||||||
enforce_dl
|
enforce_dl
|
||||||
else
|
else
|
||||||
|
@ -1722,12 +1723,15 @@ check_version(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_architecture(){
|
check_architecture(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
cpu=$(cat /proc/cpuinfo | grep "AMD Custom APU 0405")
|
cpu=$(cat /proc/cpuinfo | grep "AMD Custom APU 0405")
|
||||||
if [[ -n "$cpu" ]]; then
|
if [[ -n "$cpu" ]]; then
|
||||||
is_steam_deck=1
|
is_steam_deck=1
|
||||||
|
logger INFO "Setting architecture to 'Steam Deck'"
|
||||||
echo "[DZGUI] Setting architecture to 'Steam Deck'"
|
echo "[DZGUI] Setting architecture to 'Steam Deck'"
|
||||||
else
|
else
|
||||||
is_steam_deck=0
|
is_steam_deck=0
|
||||||
|
logger INFO "Setting architecture to 'desktop'"
|
||||||
echo "[DZGUI] Setting architecture to 'desktop'"
|
echo "[DZGUI] Setting architecture to 'desktop'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1769,27 +1773,37 @@ toggle_debug(){
|
||||||
|
|
||||||
}
|
}
|
||||||
setup(){
|
setup(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
if [[ -n $fav ]]; then
|
if [[ -n $fav ]]; then
|
||||||
set_fav
|
set_fav
|
||||||
items[8]=" Change favorite server"
|
items[8]=" Change favorite server"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_map_count(){
|
check_map_count(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
[[ $is_steam_deck -eq 1 ]] && return
|
[[ $is_steam_deck -eq 1 ]] && return
|
||||||
local count=1048576
|
local count=1048576
|
||||||
|
logger INFO "Checking system map count"
|
||||||
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
|
||||||
$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
|
$steamsafe_zenity --question --width=500 --title="DZGUI" --cancel-label="Cancel" --ok-label="OK" --text "sudo password required to check system vm map count."
|
||||||
if [[ $? -eq 0 ]]; then
|
local rc=$?
|
||||||
|
logger INFO "Return code is $rc"
|
||||||
|
if [[ $rc -eq 0 ]]; then
|
||||||
local pass
|
local pass
|
||||||
|
logger INFO "Prompting user for sudo escalation"
|
||||||
pass=$($steamsafe_zenity --password)
|
pass=$($steamsafe_zenity --password)
|
||||||
[[ $? -eq 1 ]] && exit 1
|
local rc
|
||||||
|
logger INFO "Return code is $rc"
|
||||||
|
[[ $rc -eq 1 ]] && exit 1
|
||||||
local ct=$(sudo -S <<< "$pass" sh -c "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}'")
|
||||||
local new_ct
|
local new_ct
|
||||||
[[ $ct -lt $count ]] && ct=$count
|
[[ $ct -lt $count ]] && ct=$count
|
||||||
|
logger INFO "Updating map count"
|
||||||
sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf"
|
sudo -S <<< "$pass" sh -c "echo 'vm.max_map_count=$ct' > /etc/sysctl.d/dayz.conf"
|
||||||
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
sudo sysctl -p /etc/sysctl.d/dayz.conf
|
||||||
else
|
else
|
||||||
|
logger INFO "Zenity dialog failed or user exit"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1837,6 +1851,7 @@ lock(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fetch_helpers(){
|
fetch_helpers(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
mkdir -p "$helpers_path"
|
mkdir -p "$helpers_path"
|
||||||
[[ ! -f "$helpers_path/vdf2json.py" ]] && curl -Ls "$vdf2json_url" > "$helpers_path/vdf2json.py"
|
[[ ! -f "$helpers_path/vdf2json.py" ]] && curl -Ls "$vdf2json_url" > "$helpers_path/vdf2json.py"
|
||||||
}
|
}
|
||||||
|
@ -1849,11 +1864,13 @@ update_steam_cmd(){
|
||||||
awk -v "var=$new_cmd" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
|
awk -v "var=$new_cmd" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
|
||||||
}
|
}
|
||||||
steam_deps(){
|
steam_deps(){
|
||||||
|
logger INFO "${FUNCNAME[0]}"
|
||||||
local flatpak steam
|
local flatpak steam
|
||||||
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
|
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
|
||||||
steam=$(command -v steam)
|
steam=$(command -v steam)
|
||||||
if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then
|
if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then
|
||||||
warn "Requires Steam or Flatpak Steam"
|
warn "Requires Steam or Flatpak Steam"
|
||||||
|
logger ERROR "Steam was missing"
|
||||||
exit
|
exit
|
||||||
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
|
||||||
toggle_steam=1
|
toggle_steam=1
|
||||||
|
@ -1865,6 +1882,7 @@ steam_deps(){
|
||||||
else
|
else
|
||||||
steam_cmd="flatpak run com.valvesoftware.Steam"
|
steam_cmd="flatpak run com.valvesoftware.Steam"
|
||||||
fi
|
fi
|
||||||
|
logger INFO "steam_cmd set to $steam_cmd"
|
||||||
}
|
}
|
||||||
initial_setup(){
|
initial_setup(){
|
||||||
echo "# Initial setup"
|
echo "# Initial setup"
|
||||||
|
@ -1883,12 +1901,34 @@ initial_setup(){
|
||||||
check_news
|
check_news
|
||||||
echo "100"
|
echo "100"
|
||||||
}
|
}
|
||||||
|
test_zenity_version(){
|
||||||
|
local current="$1"
|
||||||
|
local cutoff="3.91.0"
|
||||||
|
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(){
|
main(){
|
||||||
lock
|
lock
|
||||||
|
local zenv=$(zenity --version 2>/dev/null)
|
||||||
|
[[ -z $zenv ]] && { logger "Missing zenity"; exit; }
|
||||||
|
local res=$(test_zenity_version $zenv)
|
||||||
|
case $res in
|
||||||
|
"greater")
|
||||||
|
initial_setup
|
||||||
|
;;
|
||||||
|
"lesser")
|
||||||
initial_setup > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --no-cancel --width=500 2>/dev/null)
|
initial_setup > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --no-cancel --width=500 2>/dev/null)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
main_menu
|
main_menu
|
||||||
#TODO: tech debt: cruddy handling for steam forking
|
#TODO: tech debt: cruddy handling for steam forking
|
||||||
[[ $? -eq 1 ]] && pkill -f dzgui.sh
|
[[ $? -eq 1 ]] && pkill -f dzgui.sh
|
||||||
}
|
}
|
||||||
parent=$(cat /proc/$PPID/comm)
|
parent=$(cat /proc/$PPID/comm)
|
||||||
|
[[ -f "$debug_log" ]] && rm "$debug_log"
|
||||||
main
|
main
|
||||||
|
|
Loading…
Reference in a new issue