summaryrefslogtreecommitdiffstats
path: root/bin/reprepro_pull.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/reprepro_pull.sh')
-rwxr-xr-xbin/reprepro_pull.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/bin/reprepro_pull.sh b/bin/reprepro_pull.sh
new file mode 100755
index 0000000..f9e42f1
--- /dev/null
+++ b/bin/reprepro_pull.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+set -e
+
+HOSTNAME="$(hostname -f)"
+
+_ARCHITECTURE="${1:-amd64}"
+
+if ! ls /mnt/${_ARCHITECTURE}/*.changes > /dev/null 2>&1
+then
+ echo "E: no changes found in /mnt/${_ARCHITECTURE}"
+ exit 1
+fi
+
+for _CHANGES in /mnt/${_ARCHITECTURE}/*.changes
+do
+ if [ -z "${_CHANGES}" ]
+ then
+ exit 0
+ fi
+
+ _SOURCE="$(grep -m1 '^Source: ' ${_CHANGES} | awk '{ print $2 }')"
+ _VERSION="$(grep -m1 '^Version: ' ${_CHANGES} | awk '{ print $2 }')"
+ _DISTRIBUTION="$(grep -m1 '^Distribution: ' ${_CHANGES} | awk '{ print $2 }')"
+ _RELEASE="$(echo ${_DISTRIBUTION} | sed -e 's|-security||' -e 's|-updates||' -e 's|-extras||')"
+
+ if [ -e "/srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE}" ]
+ then
+ echo "E: /srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE} - already exists"
+ exit 1
+ fi
+
+ mkdir -p "/srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE}"
+
+ echo "Moving files "
+
+ for _FILE in $(awk '{ print $3 }' ${_CHANGES} | grep -E '(\.dsc$|\.deb$|\.udeb$|\.tar.*$)' | sort -u)
+ do
+ echo -n "."
+ mv /mnt/${_ARCHITECTURE}/${_FILE} "/srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE}"
+ done
+
+ echo " done."
+
+ mv ${_CHANGES} "/srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE}"
+
+ cd "/srv/${HOSTNAME}/files/releases/${_RELEASE}/packages/${_SOURCE}/${_VERSION}_${_ARCHITECTURE}"
+ debsign.sh
+done