summaryrefslogtreecommitdiff
path: root/src/chroot-tools/hooks-chcleanup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/chroot-tools/hooks-chcleanup.sh')
-rw-r--r--src/chroot-tools/hooks-chcleanup.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/chroot-tools/hooks-chcleanup.sh b/src/chroot-tools/hooks-chcleanup.sh
new file mode 100644
index 0000000..6a95dfb
--- /dev/null
+++ b/src/chroot-tools/hooks-chcleanup.sh
@@ -0,0 +1,15 @@
+#!/bin/bash -euE
+
+hooks_pre_build+=("clean_chroot")
+
+clean_chroot() (
+ set +x
+ local copydir=$1
+ if $INCHROOT; then
+ cd /build
+ sudo -u nobody "$(librelib chroot/chcleanup)"
+ else
+ librechroot -l "$copydir" clean-pkgs
+ fi
+ r=$?; echo clean_chroot returning $r; return $r
+)