summaryrefslogtreecommitdiff
path: root/backup.in
diff options
context:
space:
mode:
Diffstat (limited to 'backup.in')
-rwxr-xr-xbackup.in66
1 files changed, 61 insertions, 5 deletions
diff --git a/backup.in b/backup.in
index 2de7384..2d4a046 100755
--- a/backup.in
+++ b/backup.in
@@ -203,13 +203,69 @@ for toExclude in "${excludes[@]}"; do
excludeArgs="${excludeArgs} --exclude ${toExclude}"
done
-if [ ! -e "${neues}/wip" ]; then
- mkdir -p "${neues}/wip"
-fi
-chmod 750 "${neues}"{,/wip}
-chown root:root "${neues}"{,/wip}
+mkdir -p "${neues}/wip"
+mkdir -p "${neues}/tmp"
+chmod 750 "${neues}"{,/wip,/tmp}
+chown root:root "${neues}"{,/wip,/tmp}
if [ -z "${rsyncShell}" ]; then
preConnectHook
+ if [ -z "${Quelle#*@*:/}" ]; then
+ ssh "-${ipVer}" "${Quelle%:/}" '
+ pacman-conf Architecture
+ find /var/lib/pacman/local -name desc -exec cat {} +
+ ' \
+ | {
+ read -r arch
+ sed -n '
+ /^%\(NAME\|VERSION\|ARCH\)%/ {
+ N
+ s/\n/ /
+ p
+ }
+ ' \
+ | sed '
+ N
+ N
+ s@^%NAME% \(\S\+\)\n%VERSION% \(\S\+\)\n%ARCH% \(\S\+\)$@\1-\2-\3.pkg.tar.zst@
+ t
+ w /dev/stderr
+ d
+ ' \
+ | while read -r file; do
+ cache_file='/var/cache/pacman/pkg/'"${file}"
+ if [ ! -f "${cache_file}" ]; then
+ case "${arch}" in
+ 'x86_64')
+ for url in \
+ 'https://mirror.f4st.host/archlinux/pool/packages/'"${file}" \
+ 'https://archive.archlinux.org/packages/'"${file:0:1}"'/'"${file%-*}"'/'"${file}"; do
+ curl -Lo "${cache_file}" "${url}" || continue
+ tar --zstd -tf "${cache_file}" >/dev/null 2>&1 && break
+ done
+ ;;
+ 'i486'|'i686'|'pentium4')
+ for url in \
+ 'https://mirror.archlinux32.org/pool/'"${file}" \
+ 'https://archive.archlinux32.org/packages/'"${file:0:1}"'/'"${file%-*}"'/'"${file}"; do
+ curl -Lo "${cache_file}" "${url}" || continue
+ tar --zstd -tf "${cache_file}" >/dev/null 2>&1 && break
+ done
+ ;;
+ *)
+ for url in \
+ 'https://mirror.archlinux.org/'"${arch}"'/'{extra,community,core,alarm,aur}'/'"${file}"; do
+ curl -Lo "${cache_file}" "${url}" || continue
+ tar --zstd -tf "${cache_file}" >/dev/null 2>&1 && break
+ done
+ ;;
+ esac
+ fi
+ if [ -f "${cache_file}" ]; then
+ tar -C "${neues:?}/wip/" --zstd -xf "${cache_file}"
+ fi
+ done
+ }
+ fi
rsync ${rsyncOptions} \
${linkdests} \
${excludeArgs} \