aboutsummaryrefslogtreecommitdiff
path: root/rpi2-gen-image.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rpi2-gen-image.sh')
-rwxr-xr-xrpi2-gen-image.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/rpi2-gen-image.sh b/rpi2-gen-image.sh
index f47e8c2..5b61ae2 100755
--- a/rpi2-gen-image.sh
+++ b/rpi2-gen-image.sh
@@ -97,6 +97,7 @@ ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
# Image chroot path
R=${BUILDDIR}/chroot
+CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
# Packages required for bootstrapping
REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
@@ -615,6 +616,13 @@ chroot_exec apt-get -y clean
chroot_exec apt-get -y autoclean
chroot_exec apt-get -y autoremove
+# Invoke custom scripts
+if [ -n "${CHROOT_SCRIPTS}" ]; then
+ cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
+ LANG=C chroot $R bash -c 'for SCRIPT in /chroot_scripts/*; do if [ -f $SCRIPT -a -x $SCRIPT ]; then $SCRIPT; fi done;'
+ rm -rf "${R}/chroot_scripts"
+fi
+
# Unmount mounted filesystems
umount -l $R/proc
umount -l $R/sys