Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archive
diff options
context:
space:
mode:
Diffstat (limited to 'archive')
-rwxr-xr-xarchive87
1 files changed, 87 insertions, 0 deletions
diff --git a/archive b/archive
new file mode 100755
index 0000000..e7db9f0
--- /dev/null
+++ b/archive
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# to be periodically run on the master mirror
+
+# this requires the master mirror to be on the same drive as the archive
+
+master_mirror_root='/srv/arch-mirror/arch/arch/archlinux32'
+archive_root='/srv/arch-mirror/archive.archlinux32'
+lock_file='/tmp/archive.lock'
+
+# get lock
+if [ -f "${lock_file}" ] && kill -0 "$(cat "${lock_file}")"; then
+ >&2 echo 'cannot get lock'
+ exit
+fi
+echo "$$" >"${lock_file}"
+
+# copy the isos
+find "${master_mirror_root}/archisos" \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -type f \
+| while read -r file; do
+ if [ -z "${file##*sums}" ]; then
+ diff -u "${file}" "${archive_root}/iso/${file##*/}" \
+ | sed '
+ s/^-\([^-][^-]\)/\1/
+ t
+ d
+ ' \
+ >> "${archive_root}/iso/${file##*/}"
+ fi
+ [ -f "${archive_root}/iso/${file##*/}" ] && continue
+ ln "${file}" "${archive_root}/iso/${file##*/}"
+done
+
+# copy the packages
+find "${master_mirror_root}/pool" \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -type f \
+| while read -r file; do
+ target="${file##*/}"
+ target="${archive_root}/packages/${target:0:1}/${target%-*-*-*}/${target}"
+ [ -f "${target}" ] && continue
+ mkdir -p "${target%/*}"
+ ln "${file}" "${target}"
+done
+
+# copy the repositories
+todays_path=$(date '+%Y/%m/%d')
+todays_path="${archive_root}/repos/${todays_path}"
+if [ ! -d "${todays_path}" ]; then
+ for arch in i486 i686 pentium4; do
+ find "${master_mirror_root}/${arch}" \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -type d \
+ -printf '%f\n' \
+ | while read -r repo; do
+ mkdir -p "${todays_path}/${arch}/${repo}"
+ cp -a \
+ "${master_mirror_root}/${arch}/${repo}/${repo}.db" \
+ "${master_mirror_root}/${arch}/${repo}/${repo}.db.tar.gz" \
+ "${master_mirror_root}/${arch}/${repo}/${repo}.files" \
+ "${master_mirror_root}/${arch}/${repo}/${repo}.files.tar.gz" \
+ "${todays_path}/${arch}/${repo}/"
+ find "${master_mirror_root}/${arch}/${repo}" \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -type l \
+ \( \
+ -name '*.pkg.tar.xz' \
+ -o -name '*.pkg.tar.xz.sig' \
+ \) \
+ -printf '%f\n' \
+ | while read -r file; do
+ ln -s \
+ "../../../../../../packages/${file:0:1}/${file%-*-*-*}/${file}" \
+ "${todays_path}/${arch}/${repo}/${file}"
+ done
+ done
+ done
+fi
+
+# release lock
+rm -f "${lock_file}"