##// END OF EJS Templates
Added functionality to run custom scripts after base bootstrap
Chris Landa -
r40:f13fca1705c4
parent child
Show More
@@ -92,6 +92,9 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing conne
92 ##### `ENABLE_HARDNET`=false
92 ##### `ENABLE_HARDNET`=false
93 Enable IPv4/IPv6 network stack hardening settings.
93 Enable IPv4/IPv6 network stack hardening settings.
94
94
95 ##### `CHROOT_SCRIPTS`=""
96 Path to a directory with scripts that should be run in the chroot before the image is finally built. Every executable file in this direcory is run in lexicographical order.
97
95 ## Logging of the bootstrapping process
98 ## Logging of the bootstrapping process
96 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
99 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
97
100
@@ -74,6 +74,7 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
74
74
75 # Image chroot path
75 # Image chroot path
76 R=${BUILDDIR}/chroot
76 R=${BUILDDIR}/chroot
77 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
77
78
78 # Packages required for bootstrapping
79 # Packages required for bootstrapping
79 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
80 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
813 LANG=C chroot $R apt-get -y autoclean
814 LANG=C chroot $R apt-get -y autoclean
814 LANG=C chroot $R apt-get -y autoremove
815 LANG=C chroot $R apt-get -y autoremove
815
816
817 # Invoke custom scripts
818 if [ -n "${CHROOT_SCRIPTS}" ]; then
819 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
820 LANG=C chroot $R bash -c 'for SCRIPT in /chroot_scripts/*; do if [ -f $SCRIPT -a -x $SCRIPT ]; then $SCRIPT; fi done;'
821 rm -rf "${R}/chroot_scripts"
822 fi
823
816 # Unmount mounted filesystems
824 # Unmount mounted filesystems
817 umount -l $R/proc
825 umount -l $R/proc
818 umount -l $R/sys
826 umount -l $R/sys
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant