#!/bin/bash cd "$(dirname "$(readlink -e "$0")")" exec 9> sign-and-upload-all.lock if ! flock -n 9; then >&2 echo 'another sign-and-upload-all still holds the lock' exit 1 fi pkill -x keyboxd for distro in arch artix; do unset archs declare -A archs for arch in x86_64 i486 i686 pentium4; do [ "${arch}" != 'x86_64' ] && [ "${distro}" != 'arch' ] && continue upkgs=$( ssh ${distro}linuxewe@eckner.net ' bsdtar -Oxf os/'"${arch}"'/'"${distro}"'linuxewe.db.tar.gz \ | sed -n '"'"' /^%FILENAME%$/ { N s/^.*\n// p } '"'"' ' ) for pkg in */${distro}*-${arch}/*.pkg.tar.zst; do [ -f "${pkg}" ] \ || continue printf '%s\n' "${pkg##*/}" \ | grep -qxF "${upkgs}" \ && continue [ -f "${pkg}.sig" ] \ || gpg --detach-sign -u 5FDCA472AB93292BC678FD59255A76DB9A12601A "${pkg}" \ || exit 1 arch="${pkg##*-}" arch="${arch%%.*}" archs["${arch}"]="${arch}" done done for arch in "${!archs[@]}"; do rsync -av --progress --ignore-existing */${distro}*-${archs["${arch}"]}/*-${arch}.pkg.tar.zst{,.sig} ${distro}linuxewe@eckner.net:os/${arch}/ pkgs=$( printf '%s\n' */${distro}*-${archs["${arch}"]}/*-${arch}.pkg.tar.zst \ | sed 's@^.*/@@' \ | tr '\n' ' ' ) if [ "${arch}" = 'any' ]; then ssh ${distro}linuxewe@eckner.net ' cd os for arch in */; do [ "${arch}" = 'any/' ] && continue cd ${arch} for pkg in '"${pkgs}"'; do ln -s ../any/${pkg} ln -s ../any/${pkg}.sig done repo-add -s -k 0x3CFB0AD8F60030F8 '"${distro}"'linuxewe.db.tar.gz '"${pkgs}"' find -maxdepth 1 -mindepth 1 -not -type d -printf '"'"'%f\n'"'"' \ | grep -vxFf <( ls '"${distro}"'linuxewe.{db,files}* bsdtar -Oxf '"${distro}"'linuxewe.db.tar.gz \ | sed -n '"'"' /^%FILENAME%$/ { N s/^.*\n// p s/$/.sig/ p } '"'"' ) \ | xargs -r echo rm -f cd .. done cd any find -maxdepth 1 -mindepth 1 -not -type d -printf '"'"'%f\n'"'"' \ | grep -vxFf <( for db in ../*/'"${distro}"'linuxewe.db.tar.gz; do bsdtar -Oxf "${db}" done \ | sed -n '"'"' /^%FILENAME%$/ { N s/^.*\n// p s/$/.sig/ p } '"'"' ) \ | xargs -r echo rm -f ' else ssh ${distro}linuxewe@eckner.net ' cd os/'"${arch}"' repo-add -s -k 0x3CFB0AD8F60030F8 '"${distro}"'linuxewe.db.tar.gz '"${pkgs}"' find -maxdepth 1 -mindepth 1 -not -type d -printf '"'"'%f\n'"'"' \ | grep -vxFf <( ls '"${distro}"'linuxewe.{db,files}* bsdtar -Oxf '"${distro}"'linuxewe.db.tar.gz \ | sed -n '"'"' /^%FILENAME%$/ { N s/^.*\n// p s/$/.sig/ p } '"'"' ) \ | xargs -r echo rm -f ' fi done done