diff options
author | drtyhlpr <its_sead4@gmx.de> | 2016-03-07 22:00:42 +0100 |
---|---|---|
committer | drtyhlpr <its_sead4@gmx.de> | 2016-03-07 22:00:42 +0100 |
commit | f6d8c17fbf01d3c095ac644ed539f472ceba3950 (patch) | |
tree | 64d0f5fba2dd50d0319b8ffc259c34cd1077d856 /rpi2-gen-image.sh | |
parent | 172ae22b25dc43501e15df4f2ee956cdb2014805 (diff) | |
parent | f13fca1705c41ee32a26d87588bee44a59c7d82a (diff) | |
download | rpi2-gen-image-f6d8c17fbf01d3c095ac644ed539f472ceba3950.tar.gz rpi2-gen-image-f6d8c17fbf01d3c095ac644ed539f472ceba3950.tar.bz2 rpi2-gen-image-f6d8c17fbf01d3c095ac644ed539f472ceba3950.zip |
Merge pull request #28 from stylesuxx/run-scripts-in-chroot
Added functionality to run custom scripts after base bootstrap
Diffstat (limited to 'rpi2-gen-image.sh')
-rwxr-xr-x | rpi2-gen-image.sh | 8 |
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 |