rsync update

This commit is contained in:
Q
2025-11-06 19:45:47 +02:00
parent f6a45ec968
commit b7ddf33ab5
3 changed files with 6 additions and 17 deletions

19
rc
View File

@@ -36,25 +36,18 @@ function _q-tools-update-binary {
fi
local current_version
local remote_version
local update_tempdir
current_version=$( cat "$QTOOLSPATH"/.version )
remote_version=$( curl -f -s -L https://six9.net/software/q-tools/current.txt )
if [[ -n "$remote_version" ]]; then
if [[ "$remote_version" != "$current_version" ]]; then
set -u
echo "Update $current_version => $remote_version"
curl -L -f -s https://six9.net/software/q-tools/current.tar.gz > "$QTOOLSPATH"/current.tar.gz || return
tar -xz -C "$QTOOLSPATH" -f "$QTOOLSPATH"/current.tar.gz || return
rm -rf \
"$QTOOLSPATH"/.git \
"$QTOOLSPATH"/current.tar.gz
local obsoleted_file
if [[ -e .removed_files.txt ]]; then
while read obsoleted_file; do
if [[ -e "$obsoleted_file" ]]; then
rm -f "$obsoleted_file"
fi
done < .removed_files.txt
fi
update_tempdir=$( mktemp -d -t qtools.XXXXXXXXX )
curl -L -f https://six9.net/software/q-tools/current.tar.gz | tar -xz -C "$update_tempdir" || return
rsync -a --del "$update_tempdir"/ "$QTOOLSPATH"
rm -r "$update_tempdir"
touch .lastupdate
set +u
fi
fi