about summary refs log tree commit diff
path: root/installer.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'installer.sh.in')
-rw-r--r--installer.sh.in86
1 files changed, 49 insertions, 37 deletions
diff --git a/installer.sh.in b/installer.sh.in
index 6f5a00a..84dbcb0 100644
--- a/installer.sh.in
+++ b/installer.sh.in
@@ -39,7 +39,7 @@ FILESYSTEMS_DONE=
 SYSTEMD_INIT=
 
 TARGETDIR=/mnt/target
-LOG=/dev/tty7
+LOG=/dev/tty8
 CONF_FILE=/tmp/.void-installer.conf
 if [ ! -f $CONF_FILE ]; then
     touch -f $CONF_FILE
@@ -134,7 +134,7 @@ show_disks() {
         fi
     done
     # SATA/SCSI and Virtual disks (virtio)
-    for dev in $(ls /sys/block|grep -E '^([sv]|xv)d'); do
+    for dev in $(ls /sys/block|grep -E '^([sv]|xv)d|mmcblk'); do
         echo "/dev/$dev"
         size=$(cat /sys/block/$dev/size)
         sectorsize=$(cat /sys/block/$dev/queue/hw_sector_size)
@@ -163,24 +163,26 @@ show_partitions() {
                 echo "size:${fssize:-unknown};fstype:${fstype:-none}"
             fi
         done
-        # Software raid (md)
-        for p in $(ls -d /dev/md* 2>/dev/null|grep '[0-9]'); do
-            if cat /proc/mdstat|grep -qw $(echo $p|sed -e 's|/dev/||g'); then
-                fstype=$(lsblk -nfr /dev/$part|awk '{print $2}')
-                fssize=$(lsblk -nr /dev/$p|awk '{print $4}')
-                echo "$p"
-                echo "size:${fssize:-unknown};fstype:${fstype:-none}"
-            fi
-        done
-        if [ ! -e /sbin/lvs ]; then
-            continue
+    done
+    # Software raid (md)
+    for p in $(ls -d /dev/md* 2>/dev/null|grep '[0-9]'); do
+        part=$(basename $p)
+        if cat /proc/mdstat|grep -qw $part; then
+            fstype=$(lsblk -nfr /dev/$part|awk '{print $2}')
+            [ "$fstype" = "crypto_LUKS" ] && continue
+            [ "$fstype" = "LVM2_member" ] && continue
+            fssize=$(lsblk -nr /dev/$part|awk '{print $4}')
+            echo "$p"
+            echo "size:${fssize:-unknown};fstype:${fstype:-none}"
         fi
+    done
+    if [ -e /sbin/lvs ]; then
         # LVM
         lvs --noheadings|while read lvname vgname perms size; do
             echo "/dev/mapper/${vgname}-${lvname}"
             echo "size:${size};fstype:lvm"
         done
-    done
+    fi
 }
 
 menu_filesystems() {
@@ -252,13 +254,13 @@ ${BOLD}NOTE: you don't need this on EFI systems.${RESET}\n\n
 For EFI systems GPT is mandatory and a FAT32 partition with at least\n
 100MB must be created with the TOGGLE \`boot', this will be used as\n
 EFI System Partition. This partition must have mountpoint as \`/boot/efi'.\n\n
-At least 2 partitions are required: swap and rootfs (/).\n
+At least 1 partitions is required for the rootfs (/).\n
 For swap, RAM*2 must be really enough. For / 600MB are required.\n\n
 ${BOLD}WARNING: /usr is not supported as a separate partition.${RESET}\n
 ${RESET}\n" 18 80
         if [ $? -eq 0 ]; then
             while true; do
-                clear; cfdisk $device; PARTITIONS_DONE=1; partx -a $device; partx -u $device
+                clear; cfdisk $device; PARTITIONS_DONE=1
                 break
             done
         else
@@ -297,7 +299,7 @@ set_keymap() {
     if [ -f /etc/vconsole.conf ]; then
         sed -i -e "s|KEYMAP=.*|KEYMAP=$KEYMAP|g" $TARGETDIR/etc/vconsole.conf
     else
-        sed -i -e "s|KEYMAP=.*|KEYMAP=$KEYMAP|g" $TARGETDIR/etc/rc.conf
+        sed -i -e "s|#\?KEYMAP=.*|KEYMAP=$KEYMAP|g" $TARGETDIR/etc/rc.conf
     fi
 }
 
@@ -321,13 +323,14 @@ menu_locale() {
 }
 
 set_locale() {
-    local LOCALE=$(get_option LOCALE)
-
-    sed -i -e "s|LANG=.*|LANG=$LOCALE|g" $TARGETDIR/etc/locale.conf
-    # Uncomment locale from /etc/default/libc-locales and regenerate it.
-    sed -e "/${LOCALE}/s/^\#//" -i $TARGETDIR/etc/default/libc-locales
-    echo "Running xbps-reconfigure -f glibc-locales ..." >$LOG
-    chroot $TARGETDIR xbps-reconfigure -f glibc-locales >$LOG 2>&1
+    if [ -f $TARGETDIR/etc/default/libc-locales ]; then
+        local LOCALE=$(get_option LOCALE)
+        sed -i -e "s|LANG=.*|LANG=$LOCALE|g" $TARGETDIR/etc/locale.conf
+        # Uncomment locale from /etc/default/libc-locales and regenerate it.
+        sed -e "/${LOCALE}/s/^\#//" -i $TARGETDIR/etc/default/libc-locales
+        echo "Running xbps-reconfigure -f glibc-locales ..." >$LOG
+        chroot $TARGETDIR xbps-reconfigure -f glibc-locales >$LOG 2>&1
+    fi
 }
 
 menu_timezone() {
@@ -419,7 +422,7 @@ set_rootpassword() {
 menu_bootloader() {
     while true; do
         DIALOG --title " Select the disk to install the bootloader" \
-            --menu "$MENULABEL" ${MENUSIZE} $(show_disks)
+            --menu "$MENULABEL" ${MENUSIZE} $(show_disks) none "Manage bootloader otherwise"
         if [ $? -eq 0 ]; then
             set_option BOOTLOADER "$(cat $ANSWER)"
             BOOTLOADER_DONE=1
@@ -433,6 +436,8 @@ menu_bootloader() {
 set_bootloader() {
     local dev=$(get_option BOOTLOADER) grub_args=
 
+    if [ "$dev" = "none" ]; then return; fi
+
     # Check if it's an EFI system via efivars module.
     if [ -n "$EFI_SYSTEM" ]; then
         grub_args="--target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=void_grub --recheck"
@@ -470,7 +475,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 \
-        "Password:" 3 1 "" 3 16 30 0 || return 1
+        "Password:" 3 1 "" 3 16 50 0 || return 1
     set -- $(cat $ANSWER)
     ssid="$1"; enc="$2"; pass="$3";
 
@@ -598,7 +603,7 @@ menu_network() {
 }
 
 validate_filesystems() {
-    local mnts dev size fstype mntpt mkfs rootfound swapfound fmt
+    local mnts dev size fstype mntpt mkfs rootfound fmt
     local usrfound efi_system_partition
 
     unset TARGETFS
@@ -767,7 +772,7 @@ umount_filesystems() {
 }
 
 copy_rootfs() {
-    DIALOG --title "Check /dev/tty7 for details" \
+    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
     if [ $? -ne 0 ]; then
@@ -786,16 +791,22 @@ install_packages() {
 
     _syspkg="base-system"
 
-    mkdir -p $TARGETDIR/var/db/xbps/keys $TARGETDIR/usr/share/xbps
-    cp -a /usr/share/xbps/repo.d $TARGETDIR/usr/share/xbps/
+    mkdir -p $TARGETDIR/var/db/xbps/keys $TARGETDIR/usr/share
+    cp -a /usr/share/xbps.d $TARGETDIR/usr/share/
     cp /var/db/xbps/keys/*.plist $TARGETDIR/var/db/xbps/keys
     mkdir -p $TARGETDIR/boot/grub
-    stdbuf -oL xbps-install  -r $TARGETDIR -Sy ${_syspkg} ${_grub} 2>&1 | \
+
+    _arch=$(xbps-uhelper arch)
+
+    stdbuf -oL env XBPS_ARCH=${_arch} \
+        xbps-install  -r $TARGETDIR -SyU ${_syspkg} ${_grub} 2>&1 | \
         DIALOG --title "Installing base system packages..." \
         --programbox 24 80
     if [ $? -ne 0 ]; then
         DIE 1
     fi
+    xbps-reconfigure -r $TARGETDIR -f base-files >/dev/null 2>&1
+    chroot $TARGETDIR xbps-reconfigure -a
 }
 
 enable_dhcpd() {
@@ -843,20 +854,21 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
         . /etc/default/live.conf
         rm -f $TARGETDIR/etc/motd
         rm -f $TARGETDIR/etc/issue
+        rm -f $TARGETDIR/usr/sbin/void-installer
         # Remove live user.
         echo "Removing $USERNAME live user from targetdir ..." >$LOG
         chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1
-        DIALOG --title "Check /dev/tty7 for details" \
+        DIALOG --title "Check $LOG for details" \
             --infobox "Rebuilding initramfs for target ..." 4 60
         echo "Rebuilding initramfs for target ..." >$LOG
-        chroot $TARGETDIR dracut --force >>$LOG 2>&1
-        DIALOG --title "Check /dev/tty7 for details" \
+        # 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
         echo "Removing temporary packages from target ..." >$LOG
         xbps-remove -r $TARGETDIR -Ry dialog >>$LOG 2>&1
         rmdir $TARGETDIR/mnt/target
-        # mount required fs
-        mount_filesystems
     else
         # mount required fs
         mount_filesystems
@@ -901,7 +913,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
             else
                 enable_dhcpd
             fi
-        elif [ -n "$dev" -a -n "$type" = "static" ]; then
+        elif [ -n "$_dev" -a "$_type" = "static" ]; then
             # static IP through dhcpcd.
             mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhdpcd.conf.orig
             echo "# Static IP configuration set by the void-installer for $_dev." \