mirror of
https://github.com/aclist/dztui.git
synced 2024-12-28 13:22:35 +01:00
Compare commits
22 commits
ee06231267
...
66eb4cf6d4
Author | SHA1 | Date | |
---|---|---|---|
66eb4cf6d4 | |||
|
e6b5e40bb2 | ||
|
822db9edfe | ||
|
3fce2cc3ad | ||
|
4da78d33f3 | ||
|
5d6cbaa1a5 | ||
|
d4d0593927 | ||
|
cbecf569ad | ||
|
c5785d1857 | ||
|
62e6da2abb | ||
|
12b1c392df | ||
|
1be68e7be3 | ||
|
33b2aa85df | ||
|
4b95033c19 | ||
|
ea0d94a2fc | ||
|
7c5bd76e8f | ||
|
a079d554bc | ||
|
0197e0f921 | ||
|
01081a29e7 | ||
|
1da2e72928 | ||
|
f503c89c2b | ||
|
eaf9d5ad3e |
5 changed files with 156 additions and 31 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,5 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [5.6.0-beta.17] 2024-12-14
|
||||||
|
### Added
|
||||||
|
- Additional logging
|
||||||
|
|
||||||
|
## [5.6.0-beta.16] 2024-12-13
|
||||||
|
### Fixed
|
||||||
|
- Add remote resource health checks before downloading updates
|
||||||
|
### Added
|
||||||
|
- Add fallback repository
|
||||||
|
|
||||||
## [5.6.0-beta.11] 2024-12-07
|
## [5.6.0-beta.11] 2024-12-07
|
||||||
### Fixed
|
### Fixed
|
||||||
- Add missing function definition
|
- Add missing function definition
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
## What this is
|
## What this is
|
||||||
DZGUI is a GUI version of [DZTUI](https://github.com/aclist/dztui/tree/dztui) for Linux.
|
|
||||||
|
|
||||||
Note: development of DZTUI has stopped and has been replaced with DZGUI.
|
|
||||||
|
|
||||||
DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so. This overcomes certain limitations in the Linux client and helps prepare the game to launch by doing the following:
|
DZGUI allows you to connect to both official and modded/community DayZ servers on Linux and provides a graphical interface for doing so. This overcomes certain limitations in the Linux client and helps prepare the game to launch by doing the following:
|
||||||
|
|
||||||
1. Search for and display server metadata in a table (server name, player count, ping, current gametime, distance, IP)
|
1. Search for and display server metadata in a table (server name, player count, ping, current gametime, distance, IP)
|
||||||
|
@ -14,7 +10,7 @@ Other options include the ability to connect by IP or ID or set a favorite serv
|
||||||
|
|
||||||
## Setup and usage
|
## Setup and usage
|
||||||
|
|
||||||
Refer to the [manual](https://aclist.github.io/dzgui/dzgui.html) for installation and setup instructions, a feature-by-feature breakdown, and Steam integration tutorials.
|
Refer to the [manual](https://aclist.codeberg.page) for installation and setup instructions, a feature-by-feature breakdown, and Steam integration tutorials.
|
||||||
|
|
||||||
![Alt text](/images/example.png)
|
![Alt text](/images/example.png)
|
||||||
|
|
||||||
|
|
73
dzgui.sh
73
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=5.6.0-beta.11
|
version=5.6.0-beta.17
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
|
@ -54,7 +54,8 @@ km_helper="$helpers_path/latlon"
|
||||||
sums_path="$helpers_path/sums.md5"
|
sums_path="$helpers_path/sums.md5"
|
||||||
func_helper="$helpers_path/funcs"
|
func_helper="$helpers_path/funcs"
|
||||||
|
|
||||||
#URLS
|
#REMOTE
|
||||||
|
remote_host=gh
|
||||||
author="aclist"
|
author="aclist"
|
||||||
repo="dztui"
|
repo="dztui"
|
||||||
url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
||||||
|
@ -64,6 +65,7 @@ releases_url="https://github.com/$author/$repo/releases/download/browser"
|
||||||
km_helper_url="$releases_url/latlon"
|
km_helper_url="$releases_url/latlon"
|
||||||
geo_file_url="$releases_url/ips.csv.gz"
|
geo_file_url="$releases_url/ips.csv.gz"
|
||||||
|
|
||||||
|
|
||||||
set_im_module(){
|
set_im_module(){
|
||||||
#TODO: drop pending SteamOS changes
|
#TODO: drop pending SteamOS changes
|
||||||
pgrep -a gamescope | grep -q "generate-drm-mode"
|
pgrep -a gamescope | grep -q "generate-drm-mode"
|
||||||
|
@ -312,13 +314,14 @@ check_unmerged(){
|
||||||
check_version(){
|
check_version(){
|
||||||
local version_url=$(format_version_url)
|
local version_url=$(format_version_url)
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
|
local res=$(get_response_code "$version_url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: '$version_url'"
|
||||||
logger INFO "Local branch: '$branch', local version: $version"
|
logger INFO "Local branch: '$branch', local version: $version"
|
||||||
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
|
||||||
local upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
|
||||||
[[ ! -f "$freedesktop_path/$app_name.desktop" ]] && freedesktop_dirs
|
[[ ! -f "$freedesktop_path/$app_name.desktop" ]] && freedesktop_dirs
|
||||||
if [[ $version == $upstream ]]; then
|
if [[ $version == $upstream ]]; then
|
||||||
logger INFO "Local version is same as upstream"
|
logger INFO "Local version is same as upstream"
|
||||||
|
@ -371,9 +374,10 @@ prompt_dl(){
|
||||||
}
|
}
|
||||||
dl_changelog(){
|
dl_changelog(){
|
||||||
local mdbranch
|
local mdbranch
|
||||||
|
local md
|
||||||
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
||||||
[[ $branch == "testing" ]] && mdbranch="testing"
|
[[ $branch == "testing" ]] && mdbranch="testing"
|
||||||
local md="https://raw.githubusercontent.com/$author/dztui/${mdbranch}/CHANGELOG.md"
|
local md="$url_prefix/${mdbranch}/$file"
|
||||||
curl -Ls "$md" > "$state_path/CHANGELOG.md"
|
curl -Ls "$md" > "$state_path/CHANGELOG.md"
|
||||||
}
|
}
|
||||||
test_display_mode(){
|
test_display_mode(){
|
||||||
|
@ -483,7 +487,7 @@ stale_symlinks(){
|
||||||
local game_dir="$steam_path/steamapps/common/DayZ"
|
local game_dir="$steam_path/steamapps/common/DayZ"
|
||||||
for l in $(find "$game_dir" -xtype l); do
|
for l in $(find "$game_dir" -xtype l); do
|
||||||
logger DEBUG "Updating stale symlink '$l'"
|
logger DEBUG "Updating stale symlink '$l'"
|
||||||
unlink $l
|
unlink "$l"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
local_latlon(){
|
local_latlon(){
|
||||||
|
@ -519,6 +523,7 @@ get_hash(){
|
||||||
md5sum "$1" | awk '{print $1}'
|
md5sum "$1" | awk '{print $1}'
|
||||||
}
|
}
|
||||||
fetch_a2s(){
|
fetch_a2s(){
|
||||||
|
# this file is currently monolithic
|
||||||
[[ -d $helpers_path/a2s ]] && { logger INFO "A2S helper is current"; return 0; }
|
[[ -d $helpers_path/a2s ]] && { logger INFO "A2S helper is current"; return 0; }
|
||||||
local sha=c7590ffa9a6d0c6912e17ceeab15b832a1090640
|
local sha=c7590ffa9a6d0c6912e17ceeab15b832a1090640
|
||||||
local author="yepoleb"
|
local author="yepoleb"
|
||||||
|
@ -526,6 +531,8 @@ fetch_a2s(){
|
||||||
local url="https://github.com/$author/$repo/tarball/$sha"
|
local url="https://github.com/$author/$repo/tarball/$sha"
|
||||||
local prefix="${author^}-$repo-${sha:0:7}"
|
local prefix="${author^}-$repo-${sha:0:7}"
|
||||||
local file="$prefix.tar.gz"
|
local file="$prefix.tar.gz"
|
||||||
|
local res=$(get_response_code "$url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: '$file'"
|
||||||
curl -Ls "$url" > "$helpers_path/$file"
|
curl -Ls "$url" > "$helpers_path/$file"
|
||||||
tar xf "$helpers_path/$file" -C "$helpers_path" "$prefix/a2s" --strip=1
|
tar xf "$helpers_path/$file" -C "$helpers_path" "$prefix/a2s" --strip=1
|
||||||
rm "$helpers_path/$file"
|
rm "$helpers_path/$file"
|
||||||
|
@ -539,9 +546,11 @@ fetch_dzq(){
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local sha=3088bbfb147b77bc7b6a9425581b439889ff3f7f
|
local sha=3088bbfb147b77bc7b6a9425581b439889ff3f7f
|
||||||
local author="aclist"
|
local author="yepoleb"
|
||||||
local repo="dayzquery"
|
local repo="dayzquery"
|
||||||
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
local url="https://raw.githubusercontent.com/$author/$repo/$sha/dayzquery.py"
|
||||||
|
local res=$(get_response_code "$url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: 'dayzquery.py'"
|
||||||
curl -Ls "$url" > "$file"
|
curl -Ls "$url" > "$file"
|
||||||
logger INFO "Updated DZQ to sha '$sha'"
|
logger INFO "Updated DZQ to sha '$sha'"
|
||||||
}
|
}
|
||||||
|
@ -576,7 +585,7 @@ fetch_helpers_by_sum(){
|
||||||
["ui.py"]="be3da1e542d14105f4358dd38901e25a"
|
["ui.py"]="be3da1e542d14105f4358dd38901e25a"
|
||||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="62f6b3fb2dcb56a78b7642c0f0aa7abe"
|
["funcs"]="37897aa36bc2fb6286cee02c8bb07258"
|
||||||
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
|
@ -600,11 +609,15 @@ fetch_helpers_by_sum(){
|
||||||
file="$i"
|
file="$i"
|
||||||
sum="${sums[$i]}"
|
sum="${sums[$i]}"
|
||||||
full_path="$helpers_path/$file"
|
full_path="$helpers_path/$file"
|
||||||
url="https://raw.githubusercontent.com/$author/$repo/$realbranch/helpers/$file"
|
|
||||||
|
url="${url_prefix}/$realbranch/helpers/$file"
|
||||||
|
|
||||||
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
if [[ -f "$full_path" ]] && [[ $(get_hash "$full_path") == $sum ]]; then
|
||||||
logger INFO "$file is current"
|
logger INFO "$file is current"
|
||||||
else
|
else
|
||||||
logger WARN "File '$full_path' checksum != '$sum'"
|
logger WARN "File '$full_path' checksum != '$sum'"
|
||||||
|
local res=$(get_response_code "$url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: '$url'"
|
||||||
curl -Ls "$url" > "$full_path"
|
curl -Ls "$url" > "$full_path"
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
raise_error_and_quit "Failed to fetch the file '$file'. Possible timeout?"
|
raise_error_and_quit "Failed to fetch the file '$file'. Possible timeout?"
|
||||||
|
@ -625,11 +638,15 @@ fetch_geo_file(){
|
||||||
local km_sum="b038fdb8f655798207bd28de3a004706"
|
local km_sum="b038fdb8f655798207bd28de3a004706"
|
||||||
local gzip="$helpers_path/ips.csv.gz"
|
local gzip="$helpers_path/ips.csv.gz"
|
||||||
if [[ ! -f $geo_file ]] || [[ $(get_hash $geo_file) != $geo_sum ]]; then
|
if [[ ! -f $geo_file ]] || [[ $(get_hash $geo_file) != $geo_sum ]]; then
|
||||||
|
local res=$(get_response_code "$geo_file_url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: '$geo_file_url'"
|
||||||
curl -Ls "$geo_file_url" > "$gzip"
|
curl -Ls "$geo_file_url" > "$gzip"
|
||||||
#force overwrite
|
#force overwrite
|
||||||
gunzip -f "$gzip"
|
gunzip -f "$gzip"
|
||||||
fi
|
fi
|
||||||
if [[ ! -f $km_helper ]] || [[ $(get_hash $km_helper) != $km_sum ]]; then
|
if [[ ! -f $km_helper ]] || [[ $(get_hash $km_helper) != $km_sum ]]; then
|
||||||
|
local res=$(get_response_code "$km_helper_url")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "Remote resource unavailable: '$km_helper_url'"
|
||||||
curl -Ls "$km_helper_url" > "$km_helper"
|
curl -Ls "$km_helper_url" > "$km_helper"
|
||||||
chmod +x "$km_helper"
|
chmod +x "$km_helper"
|
||||||
fi
|
fi
|
||||||
|
@ -849,14 +866,42 @@ is_steam_running(){
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
get_response_code(){
|
||||||
|
local url="$1"
|
||||||
|
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
|
}
|
||||||
test_connection(){
|
test_connection(){
|
||||||
ping -c1 -4 github.com 1>/dev/null 2>&1
|
source "$config_file"
|
||||||
if [[ ! $? -eq 0 ]]; then
|
declare -A hr
|
||||||
raise_error_and_quit "No connection could be established to the remote server (github.com)."
|
local res1
|
||||||
|
local res2
|
||||||
|
local str="No connection could be established to the remote server"
|
||||||
|
hr=(
|
||||||
|
["steampowered.com"]="https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=$steam_api"
|
||||||
|
["github.com"]="https://github.com/$author"
|
||||||
|
["codeberg.org"]="https://codeberg.org/$author"
|
||||||
|
)
|
||||||
|
# steam API is mandatory, except on initial setup
|
||||||
|
if [[ -n $steam_api ]]; then
|
||||||
|
res=$(get_response_code "${hr["steampowered.com"]}")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "$str ("steampowered.com")"
|
||||||
fi
|
fi
|
||||||
ping -c1 -4 api.steampowered.com 1>/dev/null 2>&1
|
|
||||||
if [[ ! $? -eq 0 ]]; then
|
res=$(get_response_code "${hr["github.com"]}")
|
||||||
raise_error_and_quit "No connection could be established to the remote server (steampowered.com)."
|
if [[ $res -ne 200 ]]; then
|
||||||
|
logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback"
|
||||||
|
remote_host=cb
|
||||||
|
res=$(get_response_code "${hr["codeberg.org"]}")
|
||||||
|
[[ $res -ne 200 ]] && raise_error_and_quit "$str (${hr["codeberg.org"]})"
|
||||||
|
fi
|
||||||
|
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
|
||||||
|
if [[ $remote_host == "cb" ]]; then
|
||||||
|
url_prefix="https://codeberg.org/$author/$repo/raw/branch"
|
||||||
|
releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
|
||||||
|
stable_url="$url_prefix/dzgui"
|
||||||
|
testing_url="$url_prefix/testing"
|
||||||
|
km_helper_url="$releases_url/latlon"
|
||||||
|
geo_file_url="$releases_url/ips.csv.gz"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
legacy_cols(){
|
legacy_cols(){
|
||||||
|
|
|
@ -76,10 +76,6 @@ url_prefix="https://raw.githubusercontent.com/$author/$repo"
|
||||||
stable_url="$url_prefix/dzgui"
|
stable_url="$url_prefix/dzgui"
|
||||||
testing_url="$url_prefix/testing"
|
testing_url="$url_prefix/testing"
|
||||||
releases_url="$gh_prefix/$author/$repo/releases/download/browser"
|
releases_url="$gh_prefix/$author/$repo/releases/download/browser"
|
||||||
km_helper_url="$releases_url/latlon"
|
|
||||||
db_file="$releases_url/ips.csv.gz"
|
|
||||||
sums_url="$stable_url/helpers/sums.md5"
|
|
||||||
#TODO: move adoc to index
|
|
||||||
help_url="https://$author.github.io/dzgui/dzgui"
|
help_url="https://$author.github.io/dzgui/dzgui"
|
||||||
forum_url="$gh_prefix/$author/$repo/discussions"
|
forum_url="$gh_prefix/$author/$repo/discussions"
|
||||||
sponsor_url="$gh_prefix/sponsors/$author"
|
sponsor_url="$gh_prefix/sponsors/$author"
|
||||||
|
@ -827,7 +823,45 @@ format_version_url(){
|
||||||
esac
|
esac
|
||||||
echo "$version_url"
|
echo "$version_url"
|
||||||
}
|
}
|
||||||
|
get_response_code(){
|
||||||
|
local url="$1"
|
||||||
|
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
|
}
|
||||||
|
test_connection(){
|
||||||
|
source "$config_file"
|
||||||
|
declare -A hr
|
||||||
|
local res1
|
||||||
|
local res2
|
||||||
|
local str="No connection could be established to the remote server"
|
||||||
|
hr=(
|
||||||
|
["github.com"]="https://github.com/$author"
|
||||||
|
["codeberg.org"]="https://codeberg.org/$author"
|
||||||
|
)
|
||||||
|
res=$(get_response_code "${hr["github.com"]}")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
logger WARN "Remote host '${hr["github.com"]}' unreachable', trying fallback"
|
||||||
|
remote_host=cb
|
||||||
|
res=$(get_response_code "${hr["codeberg.org"]}")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
logger INFO "Set remote host to '${hr["codeberg.org"]}'"
|
||||||
|
if [[ $remote_host == "cb" ]]; then
|
||||||
|
url_prefix="https://codeberg.org/$author/$repo/raw/branch"
|
||||||
|
releases_url="https://codeberg.org/$author/$repo/releases/download/browser"
|
||||||
|
stable_url="$url_prefix/dzgui"
|
||||||
|
testing_url="$url_prefix/testing"
|
||||||
|
fi
|
||||||
|
}
|
||||||
download_new_version(){
|
download_new_version(){
|
||||||
|
test_connection
|
||||||
|
rc=$?
|
||||||
|
if [[ $rc -eq 1 ]]; then
|
||||||
|
printf "Remote resource unavailable. Aborting"
|
||||||
|
logger WARN "Remote resource unavailable"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
local version_url="$(format_version_url)"
|
local version_url="$(format_version_url)"
|
||||||
mv "$src_path" "$src_path.old"
|
mv "$src_path" "$src_path.old"
|
||||||
curl -Ls "$version_url" > "$src_path"
|
curl -Ls "$version_url" > "$src_path"
|
||||||
|
@ -852,7 +886,7 @@ dl_changelog(){
|
||||||
local file="CHANGELOG.md"
|
local file="CHANGELOG.md"
|
||||||
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
[[ $branch == "stable" ]] && mdbranch="dzgui"
|
||||||
[[ $branch == "testing" ]] && mdbranch="testing"
|
[[ $branch == "testing" ]] && mdbranch="testing"
|
||||||
local md="https://raw.githubusercontent.com/$author/$repo/${mdbranch}/$file"
|
local md="$url_prefix/${mdbranch}/$file"
|
||||||
curl -Ls "$md" > "$state_path/$file"
|
curl -Ls "$md" > "$state_path/$file"
|
||||||
}
|
}
|
||||||
toggle(){
|
toggle(){
|
||||||
|
@ -867,6 +901,7 @@ toggle(){
|
||||||
fi
|
fi
|
||||||
update_config
|
update_config
|
||||||
download_new_version
|
download_new_version
|
||||||
|
[[ $? -eq 1 ]] && return 1
|
||||||
return 255
|
return 255
|
||||||
;;
|
;;
|
||||||
Toggle[[:space:]]mod[[:space:]]install[[:space:]]mode)
|
Toggle[[:space:]]mod[[:space:]]install[[:space:]]mode)
|
||||||
|
@ -1135,19 +1170,24 @@ compare(){
|
||||||
echo "$diff"
|
echo "$diff"
|
||||||
}
|
}
|
||||||
legacy_symlinks(){
|
legacy_symlinks(){
|
||||||
|
logger INFO "Removing legacy symlinks"
|
||||||
for d in "$game_dir"/*; do
|
for d in "$game_dir"/*; do
|
||||||
if [[ $d =~ @[0-9]+-.+ ]]; then
|
if [[ $d =~ @[0-9]+-.+ ]]; then
|
||||||
|
logger INFO "Unlinking $d"
|
||||||
unlink "$d"
|
unlink "$d"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
|
readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
|
||||||
|
logger INFO "Read local mods into array with length: ${#mod_dirs[@]}"
|
||||||
[[ ${#mod_dirs[@]} -eq 0 ]] && return
|
[[ ${#mod_dirs[@]} -eq 0 ]] && return
|
||||||
|
logger INFO "Removing legacy encoding format"
|
||||||
for d in "${mod_dirs[@]}"; do
|
for d in "${mod_dirs[@]}"; do
|
||||||
# suppress errors if mods are downloading at boot
|
# suppress errors if mods are downloading at boot
|
||||||
[[ ! -f "$d/meta.cpp" ]] && continue
|
[[ ! -f "$d/meta.cpp" ]] && continue
|
||||||
local id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
|
local id=$(awk -F"= " '/publishedid/ {print $2}' "$d"/meta.cpp | awk -F\; '{print $1}')
|
||||||
local encoded_id=$(echo "$id" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g')
|
local encoded_id=$(echo "$id" | awk '{printf("%c",$1)}' | base64 | sed 's/\//_/g; s/=//g; s/+/]/g')
|
||||||
if [[ -h "$game_dir/@$encoded_id" ]]; then
|
if [[ -h "$game_dir/@$encoded_id" ]]; then
|
||||||
|
logger INFO "Unlinking $game_dir/@$encoded_id"
|
||||||
unlink "$game_dir/@$encoded_id"
|
unlink "$game_dir/@$encoded_id"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1155,6 +1195,7 @@ legacy_symlinks(){
|
||||||
symlinks(){
|
symlinks(){
|
||||||
readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
|
readarray -t mod_dirs < <(find "$workshop_dir" -maxdepth 1 -mindepth 1 -type d)
|
||||||
[[ ${#mod_dirs[@]} -eq 0 ]] && return
|
[[ ${#mod_dirs[@]} -eq 0 ]] && return
|
||||||
|
logger INFO "Generating symlinks in new format"
|
||||||
for d in "${mod_dirs[@]}"; do
|
for d in "${mod_dirs[@]}"; do
|
||||||
# suppress errors if mods are downloading at boot
|
# suppress errors if mods are downloading at boot
|
||||||
[[ ! -f "$d/meta.cpp" ]] && continue
|
[[ ! -f "$d/meta.cpp" ]] && continue
|
||||||
|
|
47
install.sh
Normal file → Executable file
47
install.sh
Normal file → Executable file
|
@ -1,8 +1,41 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
curl "https://raw.githubusercontent.com/aclist/dztui/dzgui/dzgui.sh" > dzgui.sh
|
get_response_code(){
|
||||||
chmod +x dzgui.sh
|
local url="$1"
|
||||||
xdg_file="$HOME/.local/share/applications/dzgui.desktop"
|
curl -Ls -I -o /dev/null -w "%{http_code}" "$url"
|
||||||
share="$HOME/.local/share/dzgui"
|
}
|
||||||
[[ -f $xdg_file ]] && rm $xdg_file
|
abort(){
|
||||||
[[ -d $share ]] && rm -rf "$share"
|
printf "Remote resource not available. Try again later.\n"
|
||||||
./dzgui.sh
|
exit 1
|
||||||
|
}
|
||||||
|
fetch(){
|
||||||
|
local file="dzgui.sh"
|
||||||
|
local author="aclist"
|
||||||
|
local repo="dztui"
|
||||||
|
local branch="dzgui"
|
||||||
|
local url
|
||||||
|
local res
|
||||||
|
gh_url="https://raw.githubusercontent.com/$author/$repo/$branch/$file"
|
||||||
|
cb_url="https://codeberg.org/$author/$repo/raw/branch/$branch/$file"
|
||||||
|
|
||||||
|
url="$gh_url"
|
||||||
|
printf "Checking the remote resource at '%s'\n" "$url"
|
||||||
|
res=$(get_response_code "$url")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
url="$cb_url"
|
||||||
|
printf "Checking the remote resource at '%s'\n" "$url"
|
||||||
|
res=$(get_response_code "$url")
|
||||||
|
if [[ $res -ne 200 ]]; then
|
||||||
|
abort
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -L "$url" > dzgui.sh
|
||||||
|
chmod +x dzgui.sh
|
||||||
|
xdg_file="$HOME/.local/share/applications/dzgui.desktop"
|
||||||
|
share="$HOME/.local/share/dzgui"
|
||||||
|
[[ -f $xdg_file ]] && rm $xdg_file
|
||||||
|
[[ -d $share ]] && rm -rf "$share"
|
||||||
|
./dzgui.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch
|
||||||
|
|
Loading…
Reference in a new issue