aboutsummaryrefslogtreecommitdiff
path: root/rpi2-gen-image.sh
diff options
context:
space:
mode:
authorChris Landa <stylesuxx@gmail.com>2016-03-05 14:01:44 +0100
committerChris Landa <stylesuxx@gmail.com>2016-03-05 14:01:44 +0100
commitf13fca1705c41ee32a26d87588bee44a59c7d82a (patch)
tree9aa0d5bed7974ba7624807bcab3f875e56b14741 /rpi2-gen-image.sh
parent57c039de88cb94968c4ae6417c4ce42ce23118ea (diff)
downloadrpi2-gen-image-f13fca1705c41ee32a26d87588bee44a59c7d82a.tar.gz
rpi2-gen-image-f13fca1705c41ee32a26d87588bee44a59c7d82a.tar.bz2
rpi2-gen-image-f13fca1705c41ee32a26d87588bee44a59c7d82a.zip
Added functionality to run custom scripts after base bootstrap
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 ff677d2..ebf4e82 100755
--- a/rpi2-gen-image.sh
+++ b/rpi2-gen-image.sh
@@ -74,6 +74,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"
@@ -813,6 +814,13 @@ LANG=C chroot $R apt-get -y clean
LANG=C chroot $R apt-get -y autoclean
LANG=C chroot $R 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