Forked from
Arch Linux / dbscripts
2 commits behind the upstream repository.
-
Kristian Klausen authored
With the archive and repos no longer hosted on the same server[1], we can let archivetools[2] update the packages directory on the archive server once a day and risk losing packages (if a package is updated multiple times in the same day). This is not ideal, so instead we will continue as before and let db-archive store the archived packages locally and then we will transfer them from the repos server to the archive server. The transfer part is more easily done, if the archived package files are copied in place in an atomic way on the repos server as we don't risk transferring partially written files that way. [1] https://lists.archlinux.org/archives/list/arch-dev-public@lists.archlinux.org/thread/B66SQUW4HOJAN2WHG4RLEBLYWNWOSF3Y/ [2] https://gitlab.archlinux.org/archlinux/archivetools/-/blob/d5cbd5a5a9454eecd5c46b64ebc08d5087a25f2d/archive.sh#L141-L200
Kristian Klausen authoredWith the archive and repos no longer hosted on the same server[1], we can let archivetools[2] update the packages directory on the archive server once a day and risk losing packages (if a package is updated multiple times in the same day). This is not ideal, so instead we will continue as before and let db-archive store the archived packages locally and then we will transfer them from the repos server to the archive server. The transfer part is more easily done, if the archived package files are copied in place in an atomic way on the repos server as we don't risk transferring partially written files that way. [1] https://lists.archlinux.org/archives/list/arch-dev-public@lists.archlinux.org/thread/B66SQUW4HOJAN2WHG4RLEBLYWNWOSF3Y/ [2] https://gitlab.archlinux.org/archlinux/archivetools/-/blob/d5cbd5a5a9454eecd5c46b64ebc08d5087a25f2d/archive.sh#L141-L200
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
db-archive 631 B
#!/bin/bash
. "$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")/config"
if (( $# != 1 )); then
echo "usage: %s <pkgfile>" "${0##*/}"
exit 1
fi
if [[ -n ${ARCHIVEUSER} && ${USER} != ${ARCHIVEUSER} ]]; then
exec sudo -u "${ARCHIVEUSER}" "${BASH_SOURCE[0]}" "${@}"
fi
pkgfile=${1##*/}
pkgname=${pkgfile%-*-*-*}
archive_dir="${ARCHIVE_BASE}/packages/${pkgname:0:1}/${pkgname}"
if [[ ! -f ${archive_dir}/${pkgfile} ]]; then
mkdir -p "${archive_dir}"
cp -p "${1}" "${archive_dir}/.${pkgfile}"
cp -p "${1}.sig" "${archive_dir}/.${pkgfile}.sig"
mv "${archive_dir}/"{.,}"${pkgfile}"
mv "${archive_dir}/"{.,}"${pkgfile}.sig"
fi