]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
Add new sbuild-post-build-copy-chroot-to-tmp script
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 24 Jul 2014 13:47:47 +0000 (15:47 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 24 Jul 2014 13:47:47 +0000 (15:47 +0200)
sbuild-post-build-copy-chroot-to-tmp [new file with mode: 0755]

diff --git a/sbuild-post-build-copy-chroot-to-tmp b/sbuild-post-build-copy-chroot-to-tmp
new file mode 100755 (executable)
index 0000000..bda111e
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+# FIXME: Fix sbuild to pass the chroot base path to this script!
+dsc=$1
+chroots=$(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc | wc -l)
+if test "$chroots" -eq 0; then
+    echo "$0: Failed to find chroot in /var/lib/schroot/mount." >&2
+    exit 1
+elif test "$chroots" -gt 1; then
+    echo "$0: Found multiple chroots (but only one wanted):" >&2
+    find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc >&2
+    exit 1
+fi
+# FIXME: possible race condition
+chroot=$(readlink -f "$(dirname $(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc))/../..")
+
+echo "sudo rsync -a --exclude=/dev/ --exclude=/proc/ --exclude=/sys/ $chroot/ /tmp/$(basename $chroot)"
+sudo rsync -a --exclude=/dev/ --exclude=proc/ --exclude=/sys/ $chroot/ /tmp/$(basename $chroot)