about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-04-20 18:19:36 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-04-20 18:19:36 +0200
commite8511075e68921056b1cefdf4ef29a76a830423d (patch)
tree32ef1d9b61b1310af8825c457b0f4ba7c4fcb134
parent6485e862c182beb830c7fdcac967fda817e19345 (diff)
parent06f8beb62844d34e2c310d80f9f0721e34e0934f (diff)
downloadhrmpf-e8511075e68921056b1cefdf4ef29a76a830423d.tar.gz
hrmpf-e8511075e68921056b1cefdf4ef29a76a830423d.tar.xz
hrmpf-e8511075e68921056b1cefdf4ef29a76a830423d.zip
Merge branch 'master' of https://github.com/voidlinux/void-mklive
* 'master' of https://github.com/voidlinux/void-mklive:
  *rootfs: fix remaining x86 rootfs issues.
  mkrootfs: generate x86 tarballs correctly, requested by scaleway.
  installer.sh.in: improve primary user setup
  build-x86-images: added dejavu-fonts-ttf as suggested by chris2.
  build-x86-images: switch to firefox-esr.
  build-x86-images: also pass -r arg to mklive.
  mkimage.sh.in: fix truncate size argument
  mklive: fix print_step()...
  installer.sh.in: add user account dialog
  installer.sh.in: avoid scrolling for wep/wpa input
  mklive: add -I directory inclusion option
  installer: check network configured on source
  mkrootfs: Added -k to run post hook
-rw-r--r--build-rootfs.sh.in10
-rw-r--r--build-x86-images.sh.in26
-rw-r--r--installer.sh.in161
-rw-r--r--mkimage.sh.in2
-rw-r--r--mklive.sh.in38
-rw-r--r--mkrootfs.sh.in27
6 files changed, 216 insertions, 48 deletions
diff --git a/build-rootfs.sh.in b/build-rootfs.sh.in
index 526ae96..ae6985e 100644
--- a/build-rootfs.sh.in
+++ b/build-rootfs.sh.in
@@ -3,10 +3,10 @@
 TARGET="$1"
 [ -n "$TARGET" ] && shift
 
-: ${PLATFORMS:="beaglebone cubieboard2 odroid-u2 rpi rpi2 usbarmory"}
+: ${PLATFORMS:="beaglebone cubieboard2 odroid-u2 rpi rpi2 usbarmory x86_64 i686"}
 DATE=$(date '+%Y%m%d')
 
-for f in ${PLATFORMS} x ${PLATFORMS} ; do
+for f in ${PLATFORMS} x ${PLATFORMS}; do
 	if [ "$f" = "x" ]; then
 		musl=1
 		continue
@@ -15,7 +15,11 @@ for f in ${PLATFORMS} x ${PLATFORMS} ; do
 	if [ -n "$musl" ]; then
 		target=${f}-musl
 	fi
-        if [ -z "$ARGET" -o "$TARGET" = "$target" ]; then
+	if [ "$target" = "i686-musl" ]; then
+		# XXX no i686-musl repo yet
+		continue
+	fi
+        if [ -z "$TARGET" -o "$TARGET" = "$target" ]; then
 		./mkrootfs.sh $@ $target
 	fi
 done
diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in
index 5ea5b04..7bd84b1 100644
--- a/build-x86-images.sh.in
+++ b/build-x86-images.sh.in
@@ -31,13 +31,13 @@ case "$ARCH" in
 esac
 
 readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm $GRUB"
-readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font alsa-plugins-pulseaudio"
-readonly E_PKGS="$X_PKGS lxdm enlightenment terminology econnman udisks2 firefox"
-readonly XFCE_PKGS="$X_PKGS lxdm xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
-readonly MATE_PKGS="$X_PKGS lxdm mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
-readonly CINNAMON_PKGS="$X_PKGS lxdm cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
+readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio"
+readonly E_PKGS="$X_PKGS lxdm enlightenment terminology econnman udisks2 firefox-esr"
+readonly XFCE_PKGS="$X_PKGS lxdm xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
+readonly MATE_PKGS="$X_PKGS lxdm mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
+readonly CINNAMON_PKGS="$X_PKGS lxdm cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
 readonly KDE_PKGS="$X_PKGS kde"
-readonly LXDE_PKGS="$X_PKGS lxdm lxde gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
+readonly LXDE_PKGS="$X_PKGS lxdm lxde gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
 readonly LXQT_PKGS="$X_PKGS lxdm lxqt gvfs-afc gvfs-mtp gvfs-smb udisks2 qupzilla"
 
 [ ! -x mklive.sh ] && exit 0
@@ -49,36 +49,36 @@ if [ -z "$IMAGE" -o "$IMAGE" = base ]; then
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = e ]; then
 	if [ ! -e $E_IMG ]; then
-		./mklive.sh -a $ARCH -o $E_IMG -p "$E_PKGS" $@
+		./mklive.sh -a $ARCH -o $E_IMG -p "$E_PKGS" ${REPO} $@
 	fi
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = xfce ]; then
 	if [ ! -e $XFCE_IMG ]; then
-		./mklive.sh -a $ARCH -o $XFCE_IMG -p "$XFCE_PKGS" $@
+		./mklive.sh -a $ARCH -o $XFCE_IMG -p "$XFCE_PKGS" ${REPO} $@
 	fi
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = mate ]; then
 	if [ ! -e $MATE_IMG ]; then
-		./mklive.sh -a $ARCH -o $MATE_IMG -p "$MATE_PKGS" $@
+		./mklive.sh -a $ARCH -o $MATE_IMG -p "$MATE_PKGS" ${REPO} $@
 	fi
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = cinnamon ]; then
 	if [ ! -e $CINNAMON_IMG ]; then
-		./mklive.sh -a $ARCH -o $CINNAMON_IMG -p "$CINNAMON_PKGS" $@
+		./mklive.sh -a $ARCH -o $CINNAMON_IMG -p "$CINNAMON_PKGS" ${REPO} $@
 	fi
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = lxde ]; then
 	if [ ! -e $LXDE_IMG ]; then
-		./mklive.sh -a $ARCH -o $LXDE_IMG -p "$LXDE_PKGS" $@
+		./mklive.sh -a $ARCH -o $LXDE_IMG -p "$LXDE_PKGS" ${REPO} $@
 	fi
 fi
 if [ -z "$IMAGE" -o "$IMAGE" = lxqt ]; then
 	if [ ! -e $LXQT_IMG ]; then
-		./mklive.sh -a $ARCH -o $LXQT_IMG -p "$LXQT_PKGS" $@
+		./mklive.sh -a $ARCH -o $LXQT_IMG -p "$LXQT_PKGS" ${REPO} $@
 	fi
 fi
 if [ "$IMAGE" = kde ]; then
 	if [ ! -e $KDE_IMG ]; then
-		./mklive.sh -a $ARCH -o $KDE_IMG -p "$KDE_PKGS" $@
+		./mklive.sh -a $ARCH -o $KDE_IMG -p "$KDE_PKGS" ${REPO} $@
 	fi
 fi
diff --git a/installer.sh.in b/installer.sh.in
index 6705f09..ce2ba00 100644
--- a/installer.sh.in
+++ b/installer.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #-
 # Copyright (c) 2012-2015 Juan Romero Pardines <xtraeme@voidlinux.eu>.
 #               2012 Dave Elusive <davehome@redthumb.info.tm>.
@@ -32,6 +32,10 @@ KEYBOARD_DONE=
 LOCALE_DONE=
 TIMEZONE_DONE=
 ROOTPASSWORD_DONE=
+USERLOGIN_DONE=
+USERPASSWORD_DONE=
+USERNAME_DONE=
+USERGROUPS_DONE=
 BOOTLOADER_DONE=
 PARTITIONS_DONE=
 NETWORK_DONE=
@@ -386,15 +390,15 @@ set_hostname() {
 }
 
 menu_rootpassword() {
-    local _firstpass= _secondpass= _desc=
+    local _firstpass _secondpass _desc
 
     while true; do
         if [ -n "${_firstpass}" ]; then
-            _desc="Enter the root password again (password won't be displayed)"
+            _desc="Enter the root password again"
         else
-            _desc="Enter the root password (password won't be displayed)"
+            _desc="Enter the root password"
         fi
-        DIALOG --passwordbox "${_desc}" ${MSGBOXSIZE}
+        DIALOG --insecure --passwordbox "${_desc}" ${INPUTSIZE}
         if [ $? -eq 0 ]; then
             if [ -z "${_firstpass}" ]; then
                 _firstpass="$(cat $ANSWER)"
@@ -403,7 +407,7 @@ menu_rootpassword() {
             fi
             if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
                 if [ "${_firstpass}" != "${_secondpass}" ]; then
-                    DIALOG --infobox "Passwords do not match! please reenter it again" 6 80
+                    DIALOG --infobox "Passwords do not match! Please enter again." 6 80
                     unset _firstpass _secondpass
                     sleep 2 && continue
                 fi
@@ -421,6 +425,101 @@ set_rootpassword() {
     echo "root:$(get_option ROOTPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512
 }
 
+menu_useraccount() {
+    local _firstpass _secondpass _desc
+    local _groups _status _group _checklist
+
+    while true; do
+        DIALOG --inputbox "Enter a primary login name:" ${INPUTSIZE} "void"
+        if [ $? -eq 0 ]; then
+            set_option USERLOGIN "$(cat $ANSWER)"
+            USERLOGIN_DONE=1
+            break
+        else
+            return
+        fi
+    done
+
+    while true; do
+        DIALOG --inputbox "Enter a user name for login '$(get_option USERLOGIN)' :" \
+            ${INPUTSIZE} "$(get_option USERLOGIN)"
+        if [ $? -eq 0 ]; then
+            set_option USERNAME "$(cat $ANSWER)"
+            USERNAME_DONE=1
+            break
+        else
+            return
+        fi
+    done
+
+    while true; do
+        if [ -n "${_firstpass}" ]; then
+            _desc="Enter the password for login '$(get_option USERLOGIN)' again"
+        else
+            _desc="Enter the password for login '$(get_option USERLOGIN)'"
+        fi
+        DIALOG --insecure --passwordbox "${_desc}" ${INPUTSIZE}
+        if [ $? -eq 0 ]; then
+            if [ -z "${_firstpass}" ]; then
+                _firstpass="$(cat $ANSWER)"
+            else
+                _secondpass="$(cat $ANSWER)"
+            fi
+            if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
+                if [ "${_firstpass}" != "${_secondpass}" ]; then
+                    DIALOG --infobox "Passwords do not match! Please enter again." 6 80
+                    unset _firstpass _secondpass
+                    sleep 2 && continue
+                fi
+                set_option USERPASSWORD "${_firstpass}"
+                USERPASSWORD_DONE=1
+                break
+            fi
+        else
+            return
+        fi
+    done
+
+    _groups="wheel,audio,video,floppy,cdrom,optical,kvm,xbuilder"
+    while true; do
+        _desc="Select group membership for login '$(get_option USERLOGIN)':"
+        for _group in $(cat /etc/group); do
+            _gid="$(echo ${_group} | cut -d: -f3)"
+            _group="$(echo ${_group} | cut -d: -f1)"
+            _status="$(echo ${_groups} | grep -w ${_group})"
+            if [ -z "${_status}" ]; then
+                _status=off
+            else
+                _status=on
+            fi
+            if [ -z "${_checklist}" ]; then
+                _checklist="${_group} ${_group}:${_gid} ${_status}"
+            else
+                _checklist="${_checklist} ${_group} ${_group}:${_gid} ${_status}"
+            fi
+        done
+        DIALOG --no-tags --checklist "${_desc}" 20 60 18 ${_checklist}
+        if [ $? -eq 0 ]; then
+            set_option USERGROUPS $(cat $ANSWER | sed -e's| |,|g')
+            USERGROUPS_DONE=1
+            break
+        else
+            return
+        fi
+    done
+}
+
+set_useraccount() {
+    [ -z "$USERLOGIN_DONE" ] && return
+    [ -z "$USERPASSWORD_DONE" ] && return
+    [ -z "$USERNAME_DONE" ] && return
+    [ -z "$USERGROUPS_DONE" ] && return
+    useradd -R $TARGETDIR -m -G $(get_option USERGROUPS) \
+        -c "$(get_option USERNAME)" $(get_option USERLOGIN)
+    echo "$(get_option USERLOGIN):$(get_option USERPASSWORD)" | \
+        chpasswd -R $TARGETDIR -c SHA512
+}
+
 menu_bootloader() {
     while true; do
         DIALOG --title " Select the disk to install the bootloader" \
@@ -433,6 +532,18 @@ menu_bootloader() {
             return
         fi
     done
+    while true; do
+        DIALOG --yesno "Use a graphical terminal for the boot loader?" ${YESNOSIZE}
+        if [ $? -eq 0 ]; then
+            set_option TEXTCONSOLE 0
+            break
+        elif [ $? -eq 1 ]; then
+            set_option TEXTCONSOLE 1
+            break
+        else
+            return
+        fi
+    done
 }
 
 set_bootloader() {
@@ -476,7 +587,7 @@ configure_wifi() {
 
     DIALOG --form "Wireless configuration for ${dev}\n(encryption type: wep or wpa)" 0 0 0 \
         "SSID:" 1 1 "" 1 16 30 0 \
-        "Encryption:" 2 1 "" 2 16 3 0 \
+        "Encryption:" 2 1 "" 2 16 4 3 \
         "Password:" 3 1 "" 3 16 50 0 || return 1
     set -- $(cat $ANSWER)
     ssid="$1"; enc="$2"; pass="$3";
@@ -883,12 +994,13 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
     echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >> $TARGETDIR/etc/fstab
 
 
-    # set up keymap, locale, timezone, hostname and root passwd.
+    # set up keymap, locale, timezone, hostname, root passwd and user account.
     set_keymap
     set_locale
     set_timezone
     set_hostname
     set_rootpassword
+    set_useraccount
 
     # Copy /etc/skel files for root.
     cp $TARGETDIR/etc/skel/.[bix]* $TARGETDIR/root
@@ -921,6 +1033,25 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
         fi
     fi
 
+    if [ -f $TARGETDIR/etc/sudoers ]; then
+        if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" ]; then
+            # enable sudo for primary user USERLOGIN
+            echo "# Enable sudo for login '$(get_option USERLOGIN)'" >> $TARGETDIR/etc/sudoers
+            echo "$(get_option USERLOGIN) ALL=(ALL) ALL" >> $TARGETDIR/etc/sudoers
+        else
+            # enable sudoers entry for members of group wheel for primary user
+            sed -i $TARGETDIR/etc/sudoers \
+                -e "s;#.*%wheel ALL=(ALL) ALL;%wheel ALL=(ALL) ALL;"
+        fi
+    fi
+
+    # enable text console for grub if chosen
+    if [ "$(get_option TEXTCONSOLE)" = "1" ]; then
+        sed -i $TARGETDIR/etc/default/grub \
+            -e 's|#\(GRUB_TERMINAL_INPUT\).*|\1=console|' \
+            -e 's|#\(GRUB_TERMINAL_OUTPUT\).*|\1=console|'
+    fi
+
     # install bootloader.
     set_bootloader
     sync && sync && sync
@@ -947,7 +1078,10 @@ menu_source() {
         "Network" "Packages from official remote reposity"
     case "$(cat $ANSWER)" in
         "Local") src="local";;
-        "Network") src="net"; menu_network;;
+        "Network") src="net";
+            if [ -z "$NETWORK_DONE" ]; then
+                menu_network;
+            fi;;
         *) return 1;;
     esac
     SOURCE_DONE=1
@@ -970,6 +1104,7 @@ menu() {
         "Locale" "Set system locale" \
         "Timezone" "Set system time zone" \
         "RootPassword" "Set system root password" \
+        "UserAccount" "Set primary user name and password" \
         "BootLoader" "Set disk to install bootloader" \
         "Partition" "Partition disk(s)" \
         "Filesystems" "Configure filesystems and mount points" \
@@ -992,7 +1127,9 @@ menu() {
         "Hostname") menu_hostname && [ -n "$HOSTNAME_DONE" ] && DEFITEM="Locale";;
         "Locale") menu_locale && [ -n "$LOCALE_DONE" ] && DEFITEM="Timezone";;
         "Timezone") menu_timezone && [ -n "$TIMEZONE_DONE" ] && DEFITEM="RootPassword";;
-        "RootPassword") menu_rootpassword && [ -n "$ROOTPASSWORD_DONE" ] && DEFITEM="BootLoader";;
+        "RootPassword") menu_rootpassword && [ -n "$ROOTPASSWORD_DONE" ] && DEFITEM="UserAccount";;
+        "UserAccount") menu_useraccount && [ -n "$USERNAME_DONE" ] && [ -n "$USERPASSWORD_DONE" ] \
+		&& DEFITEM="BootLoader";;
         "BootLoader") menu_bootloader && [ -n "$BOOTLOADER_DONE" ] && DEFITEM="Partition";;
         "Partition") menu_partitions && [ -n "$PARTITIONS_DONE" ] && DEFITEM="Filesystems";;
         "Filesystems") menu_filesystems && [ -n "$FILESYSTEMS_DONE" ] && DEFITEM="Install";;
@@ -1013,8 +1150,8 @@ DIALOG --title "${BOLD}${RED} Enter the void ... ${RESET}" --msgbox "\n
 Welcome to the Void Linux installation. A simple and minimal \
 Linux distribution made from scratch and built from the source package tree \
 available for XBPS, a new alternative binary package system.\n\n
-The installation should be pretty straightforward, if you are in trouble \
-please join us at ${BOLD}#xbps on irc.freenode.org${RESET}.\n\n
+The installation should be pretty straightforward. If you are in trouble \
+please join us at ${BOLD}#xbps${RESET} on ${BOLD}irc.freenode.org${RESET}.\n\n
 ${BOLD}http://www.voidlinux.eu${RESET}\n\n" 16 80
 
 while true; do
diff --git a/mkimage.sh.in b/mkimage.sh.in
index 4888c66..26007dd 100644
--- a/mkimage.sh.in
+++ b/mkimage.sh.in
@@ -131,7 +131,7 @@ case "$DD_VERSION" in
 esac
 
 info_msg "Creating disk image ($IMGSIZE) ..."
-truncate -s "${IMGSIZE}M" $FILENAME >/dev/null 2>&1
+truncate -s "${IMGSIZE}" $FILENAME >/dev/null 2>&1
 
 ROOTFSDIR=$(mktemp -d)
 
diff --git a/mklive.sh.in b/mklive.sh.in
index 35589b2..c54b3be 100644
--- a/mklive.sh.in
+++ b/mklive.sh.in
@@ -39,6 +39,10 @@ die() {
     info_msg "ERROR: $@"
     error_out 1
 }
+print_step() {
+    CURRENT_STEP=$((CURRENT_STEP+1))
+    info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $@"
+}
 mount_pseudofs() {
     for f in sys dev proc; do
         mkdir -p $ROOTFS/$f
@@ -72,6 +76,7 @@ Options:
  -S <freesize>      Allocate this free size (MB) for the rootfs.
  -o <file>          Output file name for the ISO image (auto if unset).
  -p "pkg pkgN ..."  Install additional packages into the ISO image.
+ -I <includedir>    Include directory structure under given path into rootfs
 
  -C "cmdline args"  Add additional kernel command line arguments.
  -T "title"         Modify the bootloader title.
@@ -142,6 +147,10 @@ install_packages() {
     rm -rf $ROOTFS/var/cache/* $ROOTFS/run/* $ROOTFS/var/run/*
 }
 
+copy_include_directory() {
+    find $INCLUDE_DIRECTORY -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} $ROOTFS/ \;
+}
+
 generate_initramfs() {
     local _args
 
@@ -294,7 +303,7 @@ generate_iso_image() {
 #
 # main()
 #
-while getopts "a:b:B:r:c:C:T:Kk:l:i:s:S:o:p:h" opt; do
+while getopts "a:B:b:r:c:C:T:Kk:l:i:I:s:S:o:p:h" opt; do
     case $opt in
         a) BASE_ARCH="$OPTARG";;
         b) BASE_SYSTEM_PKG="$OPTARG";;
@@ -305,6 +314,7 @@ while getopts "a:b:B:r:c:C:T:Kk:l:i:s:S:o:p:h" opt; do
         k) KEYMAP="$OPTARG";;
         l) LOCALE="$OPTARG";;
         i) INITRAMFS_COMPRESSION="$OPTARG";;
+        I) INCLUDE_DIRECTORY="$OPTARG";;
         s) SQUASHFS_COMPRESSION="$OPTARG";;
         S) ROOTFS_FREESIZE="$OPTARG";;
         o) OUTPUT_FILE="$OPTARG";;
@@ -355,6 +365,9 @@ BOOT_DIR="$IMAGEDIR/boot"
 ISOLINUX_DIR="$BOOT_DIR/isolinux"
 GRUB_DIR="$BOOT_DIR/grub"
 ISOLINUX_CFG="$ISOLINUX_DIR/isolinux.cfg"
+CURRENT_STEP=0
+STEP_COUNT=9
+[ -n "${INCLUDE_DIRECTORY}" ] && ((STEP_COUNT=STEP_COUNT+1))
 
 : ${SYSLINUX_DATADIR:=$VOIDHOSTDIR/usr/share/syslinux}
 : ${GRUB_DATADIR:=$VOIDHOSTDIR/usr/share/grub}
@@ -368,7 +381,7 @@ ISOLINUX_CFG="$ISOLINUX_DIR/isolinux.cfg"
 
 mkdir -p $ROOTFS $VOIDHOSTDIR $ISOLINUX_DIR $GRUB_DIR
 
-info_msg "[1/8] Synchronizing XBPS repository data..."
+print_step "Synchronizing XBPS repository data..."
 copy_void_keys $ROOTFS
 copy_void_keys $VOIDHOSTDIR
 XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r $ROOTFS ${XBPS_REPOSITORY} -S
@@ -380,32 +393,37 @@ KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
 
 : ${OUTPUT_FILE="hrmpf-${BASE_ARCH}-${KERNELVERSION}-$(date +%Y%m%d).iso"}
 
-info_msg "[2/9] Installing software to generate the image: ${REQUIRED_PKGS} ..."
+print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
 install_prereqs
 
 mkdir -p "$ROOTFS"/etc
 [ -s data/motd ] && cp data/motd $ROOTFS/etc
 [ -s data/issue.in ] && sed "s/@@VERSION@@/hrmpf-${BASE_ARCH}-${KERNELVERSION}-$(date +%Y%m%d)/" data/issue.in >$ROOTFS/etc/issue
 
-info_msg "[3/9] Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
+print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
 install_packages
 
-info_msg "[4/9] Generating initramfs image ($INITRAMFS_COMPRESSION)..."
+if [ -n "${INCLUDE_DIRECTORY}" ];then
+    print_step "Copying directory structure into the rootfs: ${INCLUDE_DIRECTORY} ..."
+    copy_include_directory
+fi
+
+print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
 generate_initramfs
 
-info_msg "[5/9] Generating isolinux support for PC-BIOS systems..."
+print_step "Generating isolinux support for PC-BIOS systems..."
 generate_isolinux_boot
 
-info_msg "[6/9] Generating GRUB support for EFI systems..."
+print_step "Generating GRUB support for EFI systems..."
 generate_grub_efi_boot
 
-info_msg "[7/9] Cleaning up rootfs..."
+print_step "Cleaning up rootfs..."
 cleanup_rootfs
 
-info_msg "[8/9] Generating squashfs image ($SQUASHFS_COMPRESSION) from rootfs..."
+print_step "Generating squashfs image ($SQUASHFS_COMPRESSION) from rootfs..."
 generate_squashfs
 
-info_msg "[9/9] Generating ISO image..."
+print_step "Generating ISO image..."
 generate_iso_image
 
 hsize=$(du -sh "$CURDIR/$OUTPUT_FILE"|awk '{print $1}')
diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in
index bedcb0c..583044c 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
 }
@@ -75,7 +76,10 @@ umount_pseudofs() {
 
 run_cmd_target() {
     info_msg "Running $@ for target $_ARCH ..."
-    eval XBPS_TARGET_ARCH=${_TARGET_ARCH:=${_ARCH}} "$@"
+    case "${_TARGET_ARCH}" in
+        i686*|x86_64*) eval XBPS_ARCH=${_TARGET_ARCH} "$@";;
+        *) eval XBPS_TARGET_ARCH=${_TARGET_ARCH:=${_ARCH}} "$@";;
+    esac
     [ $? -ne 0 ] && die "Failed to run $@"
 }
 
@@ -104,7 +108,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 +116,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
@@ -121,10 +126,8 @@ PLATFORM="$1"
 SUBPLATFORM=$PLATFORM
 
 case "$PLATFORM" in
-    i686-musl) _TARGET_ARCH="$PLATFORM"; _ARCH="i386";;
-    i686) _TARGET_ARCH="$PLATFORM"; _ARCH="i386";;
-    x86_64-musl) _TARGET_ARCH="$PLATFORM"; _ARCH="x86_64";;
-    x86_64) _TARGET_ARCH="$PLATFORM"; _ARCH="x86_64";;
+    i686*) _TARGET_ARCH="$PLATFORM"; _ARCH="i686";;
+    x86_64*) _TARGET_ARCH="$PLATFORM"; _ARCH="x86_64";;
     dockstar) _TARGET_ARCH="armv5tel"; _ARCH="armv5tel";;
     rpi-musl) _TARGET_ARCH="armv6l-musl"; _ARCH="armv6l";;
     rpi) _TARGET_ARCH="armv6l"; _ARCH="armv6l";;
@@ -134,7 +137,10 @@ esac
 
 : ${XBPS_REPOSITORY:=--repository=http://repo.voidlinux.eu/current --repository=http://muslrepo.voidlinux.eu/current}
 : ${XBPS_CACHEDIR:=--cachedir=$PWD/xbps-cachedir-${_TARGET_ARCH}}
-: ${PKGBASE:=base-system}
+case "$PLATFORM" in
+    i686*|x86_64*) PKGBASE="base-voidstrap";;
+    *) PKGBASE="base-system";;
+esac
 
 if [ -z "$PLATFORM" ]; then
     echo "$PROGNAME: platform was not set!"
@@ -184,7 +190,7 @@ run_cmd_target "xbps-query -R -r $rootfs $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REP
 chmod 755 $rootfs
 
 case "$PLATFORM" in
-    i686*|x86_64*) PKGS="${PKGBASE} grub" ;;
+    i686*|x86_64*) PKGS="${PKGBASE}" ;;
     *) PKGS="${PKGBASE} ${SUBPLATFORM}-base" ;;
 esac
 [ -n "$EXTRA_PKGS" ] && PKGS="${PKGS} ${EXTRA_PKGS}"
@@ -209,7 +215,7 @@ if [ -n "${_ARCH}" ]; then
     info_msg "Reconfiguring packages for ${_ARCH} ..."
     case "$PLATFORM" in
         i686*|x86_64*)
-            run_cmd "XBPS_ARCH=$_ARCH xbps-reconfigure -r $rootfs base-files"
+            run_cmd "XBPS_ARCH=${PLATFORM} xbps-reconfigure -r $rootfs base-files"
             ;;
         *)
             register_binfmt
@@ -226,6 +232,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.