Support execution of further scripts
[grml-debootstrap.git] / chroot-script
index 2be4689..eaf39f6 100755 (executable)
@@ -393,6 +393,17 @@ grub() {
 }
 # }}}
 
+# execute all scripts present in /etc/debootstrap/chroot-scripts/ {{{
+custom_scripts() {
+  [ -d /etc/debootstrap/chroot-scripts/ ] || return 0
+
+  for script in /etc/debootstrap/chroot-scripts/* ; do
+      echo "Executing script $script"
+      $script && echo "done" || echo "failed"
+  done
+}
+# }}}
+
 # make sure we don't have any running processes left {{{
 services() {
   for service in ssh mdadm mdadm-raid ; do
@@ -418,10 +429,11 @@ finalize() {
 # execute the functions {{{
  for i in chrootmirror grmlrepos kernelimg_conf makedev install_policy_rcd \
      packages extrapackages mkinitrd kernel reconfigure hosts interfaces   \
-     timezone fstab hostname initrd grub passwords services finalize ; do
-    if stage $i ; then
+     timezone fstab hostname initrd grub passwords custom_scripts \
+     services finalize ; do
+     if stage $i ; then
        $i && stage $i done || exit 1
-    fi
+     fi
   done
 # }}}