From 0ee9284606fbb600aa05eb5d7a2425bbab5a4855 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 5 Dec 2020 20:41:00 +0100 Subject: setup2hd: major changes - use $DIALOG instead of calling dialog; hopefully we can use Xdialog at some time - warn user if terminal is too small to display fdisk/gdisk interfaces - improve installation time of squashfs modules to harddisk with a factor 6, by using a different way to show progress - tweak dialogs so that they show less empty space - if possible, set sane default selections in menu's to make the installation process smoother - fix many small bugs in user account creation, password dialog, user config extraction, removal of redundant configuration questions etc --- setup2hd/SeTpasswd.tpl | 5 ++- setup2hd/SeTuacct.tpl | 6 +++- setup2hd/SeTudiskpart.tpl | 8 +++-- setup2hd/SeTumedia.tpl | 11 +++++-- setup2hd/SeTupass.tpl | 31 +++++++++++++------ setup2hd/setup.liveslak.tpl | 73 ++++++++++++++++++++++++++++++++------------ setup2hd/setup.slackware.tpl | 27 +++++++++------- 7 files changed, 115 insertions(+), 46 deletions(-) (limited to 'setup2hd') diff --git a/setup2hd/SeTpasswd.tpl b/setup2hd/SeTpasswd.tpl index 04d7c8c..29d9943 100644 --- a/setup2hd/SeTpasswd.tpl +++ b/setup2hd/SeTpasswd.tpl @@ -1,3 +1,6 @@ +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + #!/bin/sh # Liveslak replacement for Slackware's SeTpassword script. @@ -22,7 +25,7 @@ if [ -r $TMP/SeTlive ]; then else SUTEXT="" fi -dialog --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ +${DIALOG} --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --msgbox "You will first get the chance to create your user account, \ and set its password.${SUTEXT}\n\n\ diff --git a/setup2hd/SeTuacct.tpl b/setup2hd/SeTuacct.tpl index e07564f..f6d6464 100644 --- a/setup2hd/SeTuacct.tpl +++ b/setup2hd/SeTuacct.tpl @@ -1,4 +1,8 @@ #!/bin/sh + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + TMP=/var/log/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP @@ -25,7 +29,7 @@ UACCTNR="$FREEUID" USHELL="/bin/bash" UFORM="Fill out your user details:" while [ 0 ]; do - dialog --stdout --ok-label "Submit" --no-cancel \ + ${DIALOG} --stdout --ok-label "Submit" --no-cancel \ --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ --form "$UFORM" \ 11 64 0 \ diff --git a/setup2hd/SeTudiskpart.tpl b/setup2hd/SeTudiskpart.tpl index 46bf26b..de671f4 100644 --- a/setup2hd/SeTudiskpart.tpl +++ b/setup2hd/SeTudiskpart.tpl @@ -1,4 +1,8 @@ #!/bin/sh + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + TMP=/var/log/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP @@ -6,7 +10,7 @@ fi # If we do not find any useful disks at all, we must bail: if [ -z "$(lsblk -a -o NAME,SIZE,RM,RO,TYPE,MODEL |tr -s '[:blank:]' ' ' |grep '0 *0 *disk' | grep -v '^ram')" ]; then - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "NO HARD DRIVE DETECTED" \ --msgbox "This machine appears not to have any hard drives installed.\ This setup will not work. Please add a hard drive to the computer first." 10 64 @@ -16,7 +20,7 @@ This setup will not work. Please add a hard drive to the computer first." 10 64 # Generate a list of local hard drives we can write to: rm -f $TMP/tempscript cat < $TMP/tempscript -dialog --stdout \\ +${DIALOG} --stdout \\ --title "SELECT DISK DRIVES" \\ --backtitle "Creating Linux, swap and EFI partitions" \\ --checklist "Select from available drives.\nA disk partitioning utility \\ diff --git a/setup2hd/SeTumedia.tpl b/setup2hd/SeTumedia.tpl index f14e37c..7035fcc 100644 --- a/setup2hd/SeTumedia.tpl +++ b/setup2hd/SeTumedia.tpl @@ -1,13 +1,18 @@ #!/bin/sh + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + TMP=/var/log/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP fi -dialog --backtitle "Select Slackware installation source." \ ---title "SOURCE MEDIA SELECTION" --menu \ +${DIALOG} --backtitle "Select Slackware installation source." \ +--title "SOURCE MEDIA SELECTION" \ +--default-item '4' --menu \ "Please select the media from which to install Slackware Linux:" \ -14 70 7 \ +11 70 4 \ "1" "Install Slackware from NFS (Network File System)" \ "2" "Install Slackware from FTP/HTTP server" \ "3" "Install Slackware from Samba share" \ diff --git a/setup2hd/SeTupass.tpl b/setup2hd/SeTupass.tpl index 8cbadea..fcc7523 100644 --- a/setup2hd/SeTupass.tpl +++ b/setup2hd/SeTupass.tpl @@ -1,4 +1,8 @@ #!/bin/sh + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + TMP=/var/log/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP @@ -6,17 +10,26 @@ fi UACCOUNT="$1" - UPASS1="" - UPASS2="" - UFORM="Define a new password for user '$UACCOUNT'" +UPASS1="" +UPASS2="" +UFORM="Define a new password for user '$UACCOUNT'" + while [ 0 ]; do - dialog --stdout --insecure --ok-label "Submit" --no-cancel \ - --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ - --passwordform "$UFORM" \ - 9 64 0 \ - "Password:" 1 1 "$UPASS1" 1 18 40 0 \ - "Repeat password:" 2 1 "$UPASS2" 2 18 40 0 \ + if [ "${DIALOG}" == "Xdialog" ]; then + ${DIALOG} --stdout --ok-label "Submit" --no-cancel \ + --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ + --left --separator="\n" --password --password \ + --2inputsbox "$UFORM" 20 40 \ + "Password: " "$UPASS1" "Repeat password: " "$UPASS2" \ 2>&1 1> $TMP/tempupass + else + ${DIALOG} --stdout --ok-label "Submit" --no-cancel \ + --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ + --insecure --passwordform "$UFORM" 9 64 0 "Password:" \ + 1 1 "$UPASS1" 1 18 40 0 "Repeat password:" 2 1 "$UPASS2" 2 18 40 0 \ + 2>&1 1> $TMP/tempupass + fi + iii=0 declare -a USERATTR while read LINE ; do diff --git a/setup2hd/setup.liveslak.tpl b/setup2hd/setup.liveslak.tpl index ce99461..2ea7860 100644 --- a/setup2hd/setup.liveslak.tpl +++ b/setup2hd/setup.liveslak.tpl @@ -1,7 +1,12 @@ +# This script is sourced from setup2hd. + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + # Liveslak installation routine: if [ "$MAINSELECT" = "INSTALL" ]; then if [ ! -r $TMP/SeTnative ]; then - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\ \n\ Before you can install software, complete the following tasks:\n\ @@ -20,7 +25,7 @@ Press ENTER to return to the main menu." 16 68 # --------------------------------------------- # # Buy us some time while we are calculating disk usage: - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "WELCOME TO @UDISTRO@ LIVE (@LIVEDE@)" --infobox \ "\nCalculating disk usage, please be patient ..." 5 65 @@ -32,7 +37,7 @@ Press ENTER to return to the main menu." 16 68 # Warn when it looks we have insufficient room: if [ $PARTFREE -lt $(($DU_LIVE/1024)) ]; then - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "WELCOME TO @UDISTRO@ LIVE (@LIVEDE@)" --yesno \ "\nAvailable space: $PARTFREE MB\nRequired space: $(($DU_LIVE/1024))\nIt looks like your hard drive partition is too small.\nDo you want to continue?" 10 65 retval=$? @@ -41,19 +46,32 @@ Press ENTER to return to the main menu." 16 68 exit 1 fi else - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "WELCOME TO @UDISTRO@ LIVE (@LIVEDE@)" --msgbox \ "\nAvailable space: $PARTFREE MB\nRequired space: $(($DU_LIVE/1024)) MB\nIt looks like you're good to go!" 10 65 fi - ( - # Install the Live OS by rsyncing the readonly overlay to the harddisk: - rsync -HAXa --whole-file --checksum-choice=none --inplace \ - --info=progress2 --no-inc-recursive \ - /mnt/liveslakfs/ $T_PX/ ; echo DONE \ - ) | dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ - --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --programbox \ - "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 80 + # Install the Live OS by rsyncing the readonly overlay to the harddisk: + if [ "${DIALOG}" == "Xdialog" ]; then + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --infobox \ + "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 80 5000 + ( + rsync -HAXa --whole-file --checksum-choice=none --inplace \ + --info=progress2 --no-inc-recursive \ + /mnt/liveslakfs/ $T_PX/ ; echo DONE \ + ) | ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --tailbox \ + - 8 80 + else + ( + rsync -HAXa --whole-file --checksum-choice=none --inplace \ + --info=progress2 --no-inc-recursive \ + /mnt/liveslakfs/ $T_PX/ ; echo DONE \ + ) | ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --programbox \ + "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 80 + fi # # Live OS Post Install routine. If you want, you can override this routine @@ -64,10 +82,10 @@ Press ENTER to return to the main menu." 16 68 live_post_install () { # --------------------- # Set up a user account, - dialog --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ + ${DIALOG} --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --msgbox "You will first get the chance to create your user account, \ -and set its password.\nYour account will be added to sudoers and suauth.\n\n\ +and set its password.\nYour account will be added to 'sudoers'.\n\n\ After that, you will be asked to set the root password." 11 55 # This will set UFULLNAME, UACCOUNT, UACCTNR and USHELL variables: SeTuacct 2>&1 1> $TMP/uacctresult @@ -109,7 +127,7 @@ EOT # Re-use some of the custom configuration from 0099-@DISTRO@_zzzconf-*.sxz # (some of these may not be present but the command will not fail): - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \ "\nCopying Live modifications to hard disk ..." 5 65 sleep 1 # It's too fast... @@ -130,11 +148,22 @@ EOT /etc/rc.d/rc.font \ /etc/rc.d/rc.gpm \ /etc/slackpkg \ - /etc/vconsole.conf + /etc/vconsole.conf \ + /var/lib/slackpkg/current # Point xdm to the custom /etc/X11/xdm/liveslak-xdm/xdm-config: sed -i ${T_PX}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/xdm/liveslak-xdm/xdm-config,' + # If gcc was not installed, create a symlink to cpp pointing to mcpp; + # liveslak's XDM theme needs a C preprocessor to calculate screen positions: + if [ ! -x ${T_PX}/usr/bin/cpp ]; then + ln -s mcpp ${T_PX}/usr/bin/cpp + fi + # If nvi was not installed, do not use it as a default selection: + if [ ! -x ${T_PX}/usr/bin/nvi ] && [ -e ${T_PX}/var/log/setup/setup.vi-ex ]; + then + sed -e 's/default-item "nvi/"default-item "elvis"/' -i ${T_PX}/var/log/setup/setup.vi-ex + fi # Prevent SeTconfig from asking redundant questions later on: - sed -i ${T_PX}/usr/share/@LIVEMAIN@/SeTconfig \ + sed -i /usr/share/@LIVEMAIN@/SeTconfig \ -e '/.\/var\/log\/setup\/$SCRIPT $T_PX $ROOT_DEVICE/i # Skip stuff that was taken care of by liveslak\nif echo $SCRIPT |grep -E "(make-bootdisk|mouse|setconsolefont|xwmconfig)"; then continue; fi' # If a user account was created, we restore some of the user customization: @@ -142,9 +171,15 @@ EOT unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /home/@LIVEUID@/.face \ - /home/@LIVEUID@/.face.icon + /home/@LIVEUID@/.face.icon \ + /home/@LIVEUID@/.bashrc \ + /home/@LIVEUID@/.profile \ + /home/@LIVEUID@/.screenrc \ + /home/@LIVEUID@/.xprofile \ + /home/@LIVEUID@/.xscreensaver if [ "@LIVEUID@" != ${UACCOUNT} ]; then rsync -a $T_PX/home/@LIVEUID@/ $T_PX/home/${UACCOUNT}/ + chroot ${T_PX} /usr/bin/chown -R ${UACCOUNT} /home/${UACCOUNT} rm -rf $T_PX/home/@LIVEUID@ fi fi @@ -207,7 +242,7 @@ then # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz EOF - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ 20 65 rm $TMP/tempmsg diff --git a/setup2hd/setup.slackware.tpl b/setup2hd/setup.slackware.tpl index 9461d90..eff6b9a 100644 --- a/setup2hd/setup.slackware.tpl +++ b/setup2hd/setup.slackware.tpl @@ -1,7 +1,12 @@ +# This script is sourced from setup2hd. + +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + # Slackware installation routine as taken from original 'setup': if [ "$MAINSELECT" = "INSTALL" ]; then if [ ! -r $TMP/SeTSERIES -o ! -r $TMP/SeTsource -o ! -r $TMP/SeTnative ]; then - dialog --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\ + ${DIALOG} --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\ \n\ Before you can install software, complete the following tasks:\n\ \n\ @@ -19,7 +24,7 @@ Press ENTER to return to the main menu." 16 68 SOURCE_DEVICE="`cat $TMP/SeTsource`" IGNORE_TAGFILES="" while [ 0 ]; do - dialog --title "SELECT PROMPTING MODE" --default-item "terse" --menu \ + ${DIALOG} --title "SELECT PROMPTING MODE" --default-item "terse" --menu \ "Now you must select the type of prompts you'd like to see during the \ installation process. If you have the drive space, the 'full' option \ is quick, easy, and by far the most foolproof choice. The 'newbie' \ @@ -44,10 +49,10 @@ to use?" \ MODE="`cat $TMP/SeTpmode`" rm -f $TMP/SeTtagext if [ "$MODE" = "help" ]; then - dialog --title "PROMPT MODE HELP" --exit-label OK --textbox "/usr/lib/setup/PROMPThelp" 19 65 + ${DIALOG} --title "PROMPT MODE HELP" --exit-label OK --textbox "/usr/lib/setup/PROMPThelp" 19 65 fi if [ "$MODE" = "tagpath" ]; then - dialog --title "PROVIDE A CUSTOM PATH TO YOUR TAGFILES" --inputbox \ + ${DIALOG} --title "PROVIDE A CUSTOM PATH TO YOUR TAGFILES" --inputbox \ "If you're installing from CD or DVD, it's impossible to edit the \ tagfiles that are in the package directories. In this case, you might \ want to provide a path to your custom tagfiles. As an example, you \ @@ -68,7 +73,7 @@ custom tagfiles:" \ if [ "`cat $TMP/SeTtagpath`" = "" ]; then rm -f $TMP/SeTtagpath elif [ ! -d "$(cat $TMP/SeTtagpath)" ]; then - dialog --title "NOT A VALID DIRECTORY" --msgbox \ + ${DIALOG} --title "NOT A VALID DIRECTORY" --msgbox \ "Sorry, but the $(cat $TMP/SeTtagpath) directory could not be located. \ Press ENTER to go back to the SELECT PROMPTING MODE menu." \ 7 65 @@ -79,12 +84,12 @@ Press ENTER to go back to the SELECT PROMPTING MODE menu." \ break; fi if [ "$MODE" = "newbie" ]; then - dialog --infobox "'newbie' prompt mode selected. Using default tagfiles \ + ${DIALOG} --infobox "'newbie' prompt mode selected. Using default tagfiles \ and verbose package prompting." 4 50 break; fi if [ "$MODE" = "custom" ]; then - dialog --title "ENTER CUSTOM EXTENSION" --inputbox "Now, enter the custom \ + ${DIALOG} --title "ENTER CUSTOM EXTENSION" --inputbox "Now, enter the custom \ extension you have used for your tagfiles. This must be a valid MS-DOS format \ file extension consisting of a period followed by three characters. For \ example, I use '.pat'. You might see my tagfiles on your disks. :^)" \ @@ -97,13 +102,13 @@ example, I use '.pat'. You might see my tagfiles on your disks. :^)" \ rm -f $TMP/SeTtagext fi fi - dialog --infobox "'custom' prompt mode selected. Using prompting defaults \ + ${DIALOG} --infobox "'custom' prompt mode selected. Using prompting defaults \ found in custom tagfiles." 4 50 break; fi if [ "$MODE" = "full" ]; then IGNORE_TAGFILES="-ignore_tagfiles" - dialog --infobox "Full installation mode. Installing all software \ + ${DIALOG} --infobox "Full installation mode. Installing all software \ packages without prompting." 4 45 break; fi @@ -120,12 +125,12 @@ packages without prompting." 4 45 break; fi if [ "$MODE" = "menu" ]; then - dialog --infobox "'menu' prompt mode selected. Using interactive menus \ + ${DIALOG} --infobox "'menu' prompt mode selected. Using interactive menus \ to choose subsystems of related packages." 4 60 break; fi if [ "$MODE" = "expert" ]; then - dialog --infobox "'expert' prompt mode selected. Using interactive menus \ + ${DIALOG} --infobox "'expert' prompt mode selected. Using interactive menus \ to choose packages individually." 4 60 break; fi -- cgit v1.2.3