diff options
author | Erich Eckner <git@eckner.net> | 2023-10-02 10:20:27 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2023-10-02 10:20:27 +0200 |
commit | d89f0ce632388a8915a330af8dd681e0dbcf2b6c (patch) | |
tree | 891dae17e5328364707d0cf5d85fa6487a9a57ae /backup.in | |
parent | 211e9d95ce08ac0a3331f15278fb747f7952a078 (diff) | |
download | hardlinkedBackups-d89f0ce632388a8915a330af8dd681e0dbcf2b6c.tar.xz |
backup: download arch packages from mirror before doing the backup
Diffstat (limited to 'backup.in')
-rwxr-xr-x | backup.in | 66 |
1 files changed, 61 insertions, 5 deletions
@@ -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} \ |