about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-11-21 13:49:57 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-11-21 13:49:57 +0100
commit8ec095d458014b0d2d8a4f1fe477176e29b9a2ee (patch)
tree07e8af9503041735fdc0a6aea121f2e014f477b8
parentbe17e1922030cbd39fd0ec3d6cc4342f4286bf1c (diff)
parent58f6a3e7c081acc534167db5c82c10fddb9fd2cf (diff)
downloadhrmpf-8ec095d458014b0d2d8a4f1fe477176e29b9a2ee.tar.gz
hrmpf-8ec095d458014b0d2d8a4f1fe477176e29b9a2ee.tar.xz
hrmpf-8ec095d458014b0d2d8a4f1fe477176e29b9a2ee.zip
Merge branch 'master' of https://github.com/voidlinux/void-mklive
* 'master' of https://github.com/voidlinux/void-mklive:
  mkimage.sh.in: odroid-c2: u-boot doesn't understand new ext4 features, disable.
  mkrootfs.sh.in: fix for odroid-c2.
  installer.sh.in: fixes and improvements
  installer.sh.in: change irc channel to be correct
-rw-r--r--installer.sh.in85
-rw-r--r--mkimage.sh.in2
-rw-r--r--mkrootfs.sh.in2
3 files changed, 63 insertions, 26 deletions
diff --git a/installer.sh.in b/installer.sh.in
index c1e4407..40b0074 100644
--- a/installer.sh.in
+++ b/installer.sh.in
@@ -93,6 +93,13 @@ DIALOG() {
     return $?
 }
 
+INFOBOX() {
+    # Note: dialog --infobox and --keep-tite don't work together
+    dialog --colors --no-shadow --no-mouse \
+        --backtitle "${BOLD}${WHITE}Void Linux installation -- http://www.voidlinux.eu/ (@@MKLIVE_VERSION@@)${RESET}" \
+        --title "${TITLE}" --aspect 20 --infobox "$@"
+}
+
 DIE() {
     rval=$1
     [ -z "$rval" ] && rval=0
@@ -517,13 +524,13 @@ menu_locale() {
     local _locales="$(grep -E '\.UTF-8' /etc/default/libc-locales|awk '{print $1}'|sed -e 's/^#//')"
     local LOCALES ISO639 ISO3166
     local TMPFILE=$(mktemp -t vinstall-XXXXXXXX || exit 1)
-
-    echo "Scanning locales..."
+    INFOBOX "Scanning locales ..." 4 60
     for f in ${_locales}; do
         eval $(echo $f | awk 'BEGIN { FS="." } \
             { FS="_"; split($1, a); printf "ISO639=%s ISO3166=%s\n", a[1], a[2] }')
         echo "$f|$(iso639_language $ISO639) ($(iso3166_country $ISO3166))|" >> $TMPFILE
     done
+    clear
     # Sort by ISO-639 language names
     LOCALES=$(sort -t '|' -k 2 < $TMPFILE | xargs | sed -e's/| /|/g')
     rm -f $TMPFILE
@@ -596,10 +603,10 @@ menu_rootpassword() {
     local _firstpass _secondpass _desc
 
     while true; do
-        if [ -n "${_firstpass}" ]; then
-            _desc="Enter the root password again"
-        else
+        if [ -z "${_firstpass}" ]; then
             _desc="Enter the root password"
+        else
+            _desc="$_desc again"
         fi
         DIALOG --insecure --passwordbox "${_desc}" ${INPUTSIZE}
         if [ $? -eq 0 ]; then
@@ -610,9 +617,9 @@ menu_rootpassword() {
             fi
             if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
                 if [ "${_firstpass}" != "${_secondpass}" ]; then
-                    DIALOG --infobox "Passwords do not match! Please enter again." 6 80
+                    INFOBOX "Passwords do not match! Please enter again." 6 60
                     unset _firstpass _secondpass
-                    sleep 2 && continue
+                    sleep 2 && clear && continue
                 fi
                 set_option ROOTPASSWORD "${_firstpass}"
                 ROOTPASSWORD_DONE=1
@@ -631,9 +638,12 @@ set_rootpassword() {
 menu_useraccount() {
     local _firstpass _secondpass _desc
     local _groups _status _group _checklist
+    local _preset
 
     while true; do
-        DIALOG --inputbox "Enter a primary login name:" ${INPUTSIZE} "void"
+        _preset=$(get_option USERLOGIN)
+        [ -z "$_preset" ] && _preset="void"
+        DIALOG --inputbox "Enter a primary login name:" ${INPUTSIZE} "$_preset"
         if [ $? -eq 0 ]; then
             set_option USERLOGIN "$(cat $ANSWER)"
             USERLOGIN_DONE=1
@@ -644,8 +654,10 @@ menu_useraccount() {
     done
 
     while true; do
+        _preset=$(get_option USERNAME)
+        [ -z "$_preset" ] && _preset="Void User"
         DIALOG --inputbox "Enter a user name for login '$(get_option USERLOGIN)' :" \
-            ${INPUTSIZE} "$(get_option USERLOGIN)"
+            ${INPUTSIZE} "$_preset"
         if [ $? -eq 0 ]; then
             set_option USERNAME "$(cat $ANSWER)"
             USERNAME_DONE=1
@@ -656,10 +668,10 @@ menu_useraccount() {
     done
 
     while true; do
-        if [ -n "${_firstpass}" ]; then
-            _desc="Enter the password for login '$(get_option USERLOGIN)' again"
-        else
+        if [ -z "${_firstpass}" ]; then
             _desc="Enter the password for login '$(get_option USERLOGIN)'"
+        else
+            _desc="$_desc again"
         fi
         DIALOG --insecure --passwordbox "${_desc}" ${INPUTSIZE}
         if [ $? -eq 0 ]; then
@@ -670,9 +682,9 @@ menu_useraccount() {
             fi
             if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then
                 if [ "${_firstpass}" != "${_secondpass}" ]; then
-                    DIALOG --infobox "Passwords do not match! Please enter again." 6 80
+                    INFOBOX "Passwords do not match! Please enter again." 6 60
                     unset _firstpass _secondpass
-                    sleep 2 && continue
+                    sleep 2 && clear && continue
                 fi
                 set_option USERPASSWORD "${_firstpass}"
                 USERPASSWORD_DONE=1
@@ -1003,7 +1015,8 @@ failed to activate swap on $dev!\ncheck $LOG for errors." ${MSGBOXSIZE}
             vfat) MKFS="mkfs.vfat -F32"; modprobe vfat >$LOG 2>&1;;
             xfs) MKFS="mkfs.xfs -f"; modprobe xfs >$LOG 2>&1;;
             esac
-            DIALOG --infobox "Creating filesystem $fstype on $dev for $mntpt ..." 8 60
+            TITLE="Check $LOG for details ..."
+            INFOBOX "Creating filesystem $fstype on $dev for $mntpt ..." 8 60
             echo "Running $MKFS $dev..." >$LOG
             $MKFS $dev >$LOG 2>&1; rv=$?
             if [ $rv -ne 0 ]; then
@@ -1087,13 +1100,38 @@ umount_filesystems() {
     umount $TARGETDIR >$LOG 2>&1
 }
 
+log_and_count() {
+    local progress whole tenth
+    while read line; do
+        echo "$line" >$LOG
+        copy_count=$((copy_count + 1))
+        progress=$((1000 * copy_count / copy_total))
+        if [ "$progress" != "$copy_progress" ]; then
+            whole=$((progress / 10))
+            tenth=$((progress % 10))
+            printf "Progress: %d.%d%% (%d of %d files)\n" $whole $tenth $copy_count $copy_total
+            copy_progress=$progress
+        fi
+    done
+}
+
 copy_rootfs() {
-    DIALOG --title "Check $LOG for details" \
-        --infobox "Copying live image to target rootfs, please wait ..." 4 60
-    LANG=C cp -axvnu / $TARGETDIR >$LOG 2>&1
+    local tar_in="--create --one-file-system"
+    local tar_out="--extract --preserve-permissions"
+    TITLE="Check $LOG for details ..."
+    INFOBOX "Counting files, please be patient ..." 4 60
+    copy_total=$(tar ${tar_in} -v -f /dev/null / 2>/dev/null | wc -l)
+    export copy_total copy_count=0 copy_progress=
+    clear
+    tar ${tar_in} -f - / 2>/dev/null | \
+        tar ${tar_out} -v -f - -C $TARGETDIR | \
+        log_and_count | \
+        DIALOG --title "${TITLE}" \
+            --progressbox "Copying live image to target rootfs." 5 60
     if [ $? -ne 0 ]; then
         DIE 1
     fi
+    unset copy_total copy_count copy_percent
 }
 
 install_packages() {
@@ -1171,14 +1209,13 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
         echo "Removing $USERNAME live user from targetdir ..." >$LOG
         chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1
         sed -i -e "/$USERNAME ALL=.*/d" $TARGETDIR/etc/sudoers
-        DIALOG --title "Check $LOG for details" \
-            --infobox "Rebuilding initramfs for target ..." 4 60
+        TITLE="Check $LOG for details ..."
+        INFOBOX "Rebuilding initramfs for target ..." 4 60
         echo "Rebuilding initramfs for target ..." >$LOG
         # mount required fs
         mount_filesystems
         chroot $TARGETDIR dracut --no-hostonly --add-drivers "ahci" --force >>$LOG 2>&1
-        DIALOG --title "Check $LOG for details" \
-            --infobox "Removing temporary packages from target ..." 4 60
+        INFOBOX "Removing temporary packages from target ..." 4 60
         echo "Removing temporary packages from target ..." >$LOG
         xbps-remove -r $TARGETDIR -Ry dialog >>$LOG 2>&1
         rmdir $TARGETDIR/mnt/target
@@ -1189,7 +1226,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
         install_packages
     fi
 
-    DIALOG --infobox "Applying installer settings..." 4 60
+    INFOBOX "Applying installer settings..." 4 60
 
     # copy target fstab.
     install -Dm644 $TARGET_FSTAB $TARGETDIR/etc/fstab
@@ -1354,7 +1391,7 @@ 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${RESET} on ${BOLD}irc.freenode.org${RESET}.\n\n
+please join us at ${BOLD}#voidlinux${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 1c70f92..858bdd5 100644
--- a/mkimage.sh.in
+++ b/mkimage.sh.in
@@ -147,7 +147,7 @@ label: dos
 2048,,L
 _EOF
     LOOPDEV=$(losetup --show --find --partscan $FILENAME)
-    mkfs.${ROOT_FSTYPE} $disable_journal ${LOOPDEV}p1 >/dev/null 2>&1
+    mkfs.${ROOT_FSTYPE} -O '^64bit,^extra_isize,^has_journal' ${LOOPDEV}p1 >/dev/null 2>&1
     mount ${LOOPDEV}p1 $ROOTFSDIR
     ROOT_UUID=$(blkid -o value -s UUID ${LOOPDEV}p1)
     ;;
diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in
index 9425d0b..f902c1d 100644
--- a/mkrootfs.sh.in
+++ b/mkrootfs.sh.in
@@ -168,7 +168,7 @@ case "$PLATFORM" in
     rpi*) SUBPLATFORM=${PLATFORM%-*}; QEMU_BIN=qemu-arm-static;;
     usbarmory*) SUBPLATFORM=${PLATFORM%-*}; QEMU_BIN=qemu-arm-static;;
     ci20*) SUBPLATFORM=${PLATFORM%-*}; QEMU_BIN=qemu-mipsel-static;;
-    odroid-c2*) SUBPLATFORM=${PLATFORM%-*}; QEMU_BIN=qemu-aarch64-static;;
+    odroid-c2*) SUBPLATFORM=${PLATFORM%-musl}; QEMU_BIN=qemu-aarch64-static;;
     i686*) QEMU_BIN=qemu-i386-static;;
     x86_64*) QEMU_BIN=qemu-x86_64-static;;
     *) die "$PROGNAME: invalid platform!";;