mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
chore: drop the comments this change added
This commit is contained in:
1 parent
2d9d4dbeb0
commit
4a57c6f6f1
8 files changed
-46
No files matched your search
@@ -397,8 +397,6 @@ case $mode in
|
||||
steam_cef_gpu=0
|
||||
fi
|
||||
else
|
||||
# A first run downloads the client (about 360 MB in 2026): minutes on a slow connection, with
|
||||
# the progress in megabytes on the loading screen.
|
||||
step "checking the Steam client (first run downloads it, ~1-2 min with nothing on screen)"
|
||||
droiddeck-steam-install || steam_setup_failed $?
|
||||
step "Steam client ready"
|
||||
|
||||
@@ -25,8 +25,6 @@ stamp=$steam_root/package/droiddeck-installed
|
||||
legacy_stamp=$steam_root/package/bannerlator-installed
|
||||
unconfirmed=$steam_root/package/droiddeck-unconfirmed
|
||||
repair_request=$HOME/.bl-steam-repair
|
||||
# The parts of an unfinished download: a session that ends, or loses its connection, part way
|
||||
# through picks up where it stopped instead of fetching the whole client again.
|
||||
parts=$steam_root/package/droiddeck-download
|
||||
if [ -f "$legacy_stamp" ] && [ ! -f "$stamp" ]; then
|
||||
mv -f "$legacy_stamp" "$stamp" || true
|
||||
@@ -50,7 +48,6 @@ if [ -n "$fallback" ]; then
|
||||
fi
|
||||
if [ -n "$repair" ]; then
|
||||
echo "== STEP $(date -u +%H:%M:%S) repairing the Steam client ($repair)"
|
||||
# A repair unpacks every part again - once: an interrupted one keeps what it has redone.
|
||||
if [ ! -f "$parts/.repair" ]; then
|
||||
rm -rf "$parts"
|
||||
mkdir -p "$parts" && : > "$parts/.repair"
|
||||
@@ -78,7 +75,6 @@ fi
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
# A sleep that starts no process (droiddeck-session's nap): read -t on a pipe nothing writes to.
|
||||
nap() {
|
||||
[ -n "${nap_fd:-}" ] || exec {nap_fd}<> <(:)
|
||||
read -r -t "$1" -u "$nap_fd" _ 2>/dev/null || :
|
||||
@@ -88,16 +84,10 @@ size_of() {
|
||||
[ -f "$1" ] && n=$(wc -c < "$1")
|
||||
echo $((n))
|
||||
}
|
||||
# A connection can stall without closing (Wi-Fi power save, a phone changing networks), and
|
||||
# curl's default then is to wait for ever with nothing on screen. A transfer under 4 KB/s for a
|
||||
# minute is dropped and resumed from the bytes already on disk.
|
||||
limits=(--connect-timeout 30 --speed-limit 4096 --speed-time 60)
|
||||
# Seconds between attempts that made no progress; the download fails after the last one.
|
||||
read -r -a delays <<< "${BL_STEAM_RETRY_DELAYS:-5 10 20 30 30}"
|
||||
|
||||
step() { echo "== STEP $(date -u +%H:%M:%S) $*"; }
|
||||
# The line the app's loading screen reads: the part, its number, and megabytes overall. A third
|
||||
# argument is said after it (a stall), and is always said; otherwise only a change is.
|
||||
progress() {
|
||||
local mb=$(( (done_bytes + $(size_of "$1")) / 1000000 ))
|
||||
[ -z "${3:-}" ] && [ "$mb" = "${shown_mb:-}" ] && [ "$2" = "${shown_part:-}" ] && return 0
|
||||
@@ -105,21 +95,16 @@ progress() {
|
||||
step "downloading Steam: $2 ($i/$total), $mb of $((total_bytes / 1000000)) MB${3:+ - $3}"
|
||||
}
|
||||
|
||||
# fetch URL FILE SIZE SHA256 PART: FILE complete and checked, resuming whatever is already there.
|
||||
fetch() {
|
||||
local url=$1 dest=$2 size=$3 sum=$4 part=$5 failures=0 bad=0 finished=0 before rc fd wait
|
||||
while :; do
|
||||
# Whole once it is as long as the manifest says, or (no size given) once curl finished it.
|
||||
if [ -f "$dest" ] && { [ "$finished" = 1 ] || { [ "$size" -gt 0 ] && [ "$(size_of "$dest")" -ge "$size" ]; }; }; then
|
||||
echo "$sum $dest" | sha256sum -c --quiet 2>/dev/null && return 0
|
||||
# Bytes that do not check out are fetched whole again, a few times at most.
|
||||
rm -f "$dest"
|
||||
finished=0 bad=$((bad + 1))
|
||||
[ "$bad" -lt 3 ] || { echo "droiddeck-steam-install: $part does not match its checksum" >&2; return 1; }
|
||||
fi
|
||||
before=$(size_of "$dest")
|
||||
# curl's status comes back through the pipe (|| keeps set -e from ending the subshell before it
|
||||
# is said); until then a progress line every 5 s.
|
||||
exec {fd}< <(curl -fsSL "${limits[@]}" -C - -o "$dest" "$url" && echo 0 || echo $?)
|
||||
until read -r -t 5 -u "$fd" rc; do
|
||||
if [ $? -le 128 ]; then rc=1; break; fi
|
||||
@@ -127,7 +112,6 @@ fetch() {
|
||||
done
|
||||
exec {fd}<&-
|
||||
if [ "$rc" = 0 ]; then finished=1; continue; fi
|
||||
# 33: the server would not resume. Start the part over.
|
||||
[ "$rc" = 33 ] && rm -f "$dest"
|
||||
if [ "$(size_of "$dest")" -gt "$before" ]; then failures=0; else failures=$((failures + 1)); fi
|
||||
if [ "$failures" -gt "${#delays[@]}" ]; then
|
||||
@@ -189,8 +173,6 @@ total=$(grep -c . "$work/parts" 2>/dev/null || echo 0)
|
||||
total_bytes=$(awk '{ n += $4 } END { print n + 0 }' "$work/parts")
|
||||
|
||||
mkdir -p "$parts"
|
||||
# What an earlier attempt left for another client version is no use to this one. A part's file
|
||||
# name carries its own hash, so a name still listed is the same part.
|
||||
for left in "$parts"/*; do
|
||||
[ -e "$left" ] || continue
|
||||
name=${left##*/}
|
||||
@@ -218,7 +200,6 @@ while read -r block file sum size; do
|
||||
rm -f "$parts/$file"
|
||||
done_bytes=$((done_bytes + size))
|
||||
done < "$work/parts"
|
||||
# Some entries are zipped with Windows separators; unzip keeps the backslash in the file name.
|
||||
find "$steam_root" -depth -name '*\\*' | while read -r odd; do
|
||||
fixed=${odd//\\//}
|
||||
mkdir -p "$(dirname "$fixed")"
|
||||
|
||||
Reference in new issue
Block a user