Merge pull request #52 from equalsraf/tb-post-hook

mkrootfs: Added -k to run post hook
This commit is contained in:
Juan RP 2016-01-30 08:36:37 +01:00
commit 8affcef52c
1 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,7 @@ Options
-h Show this help -h Show this help
-p <pkgs> Additional packages to install into the rootfs (separated by blanks) -p <pkgs> Additional packages to install into the rootfs (separated by blanks)
-r <repo> Set XBPS repository (may be set multiple times) -r <repo> Set XBPS repository (may be set multiple times)
-k <cmd> Call "cmd <ROOTFSPATH>" after building the rootfs
-V Show version -V Show version
_EOF _EOF
} }
@ -104,7 +105,7 @@ register_binfmt() {
# #
# main() # 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 case $opt in
b) PKGBASE="$OPTARG";; b) PKGBASE="$OPTARG";;
C) XBPS_CONFFILE="-C $OPTARG";; C) XBPS_CONFFILE="-C $OPTARG";;
@ -112,6 +113,7 @@ while getopts "b:C:c:hp:r:V" opt; do
h) usage; exit 0;; h) usage; exit 0;;
p) EXTRA_PKGS="$OPTARG";; p) EXTRA_PKGS="$OPTARG";;
r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";; r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";;
k) POST_HOOK="$OPTARG";;
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;; V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
esac esac
done done
@ -226,6 +228,9 @@ fi
# Setup default root password. # Setup default root password.
# #
run_cmd "chroot $rootfs sh -c 'echo "root:voidlinux" | chpasswd -c SHA512'" 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 umount_pseudofs
# #
# Cleanup rootfs. # Cleanup rootfs.