about summary refs log tree commit diff
path: root/mkrootfs.sh.in
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2016-01-18 15:18:30 +0000
committerRui Abreu Ferreira <raf-ep@gmx.com>2016-01-18 15:18:30 +0000
commit465166a80fd6add7fa1cb981665ecf5acc96d35b (patch)
tree99797e3af369c4129cf2d479ef5317de77fb85e2 /mkrootfs.sh.in
parent62406cba3f2b1c80e2b1703b4682e57a6086da06 (diff)
downloadhrmpf-465166a80fd6add7fa1cb981665ecf5acc96d35b.tar.gz
hrmpf-465166a80fd6add7fa1cb981665ecf5acc96d35b.tar.xz
hrmpf-465166a80fd6add7fa1cb981665ecf5acc96d35b.zip
mkrootfs: Added -k to run post hook
New flag -k <cmd>. "<cmd> <path>" is executed after the rootfs
is created, <path> points to the new rootfs.
Diffstat (limited to 'mkrootfs.sh.in')
-rw-r--r--mkrootfs.sh.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in
index bedcb0c..472cec9 100644
--- a/mkrootfs.sh.in
+++ b/mkrootfs.sh.in
@@ -56,6 +56,7 @@ Options
     -h          Show this help
     -p <pkgs>   Additional packages to install into the rootfs (separated by blanks)
     -r <repo>   Set XBPS repository (may be set multiple times)
+    -k <cmd>    Call "cmd <ROOTFSPATH>" after building the rootfs
     -V          Show version
 _EOF
 }
@@ -104,7 +105,7 @@ register_binfmt() {
 #
 # main()
 #
-while getopts "b:C:c:hp:r:V" opt; do
+while getopts "b:C:c:hp:r:k:V" opt; do
     case $opt in
         b) PKGBASE="$OPTARG";;
         C) XBPS_CONFFILE="-C $OPTARG";;
@@ -112,6 +113,7 @@ while getopts "b:C:c:hp:r:V" opt; do
         h) usage; exit 0;;
         p) EXTRA_PKGS="$OPTARG";;
         r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";;
+        k) POST_HOOK="$OPTARG";;
         V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
     esac
 done
@@ -226,6 +228,9 @@ fi
 # Setup default root password.
 #
 run_cmd "chroot $rootfs sh -c 'echo "root:voidlinux" | chpasswd -c SHA512'"
+if [ -n "$POST_HOOK" ]; then
+    run_cmd "$POST_HOOK $rootfs"
+fi
 umount_pseudofs
 #
 # Cleanup rootfs.