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 --- make_slackware_live.sh | 52 +++++++++++++++++++++++++++++++ setup2hd.tpl | 64 +++++++++++++++++++++++--------------- 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 +++++++++------- 9 files changed, 207 insertions(+), 70 deletions(-) diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 0245ed4..c9603dd 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -1786,6 +1786,10 @@ if [ -f ${DEF_SL_PKGROOT}/../isolinux/initrd.img ]; then -e 's, /mnt, ${T_PX},g' \ -e 's,=/mnt$,=${T_PX},g' \ -e 's,=/mnt/,=${T_PX}/,g' + # Allow a choice of dialog: + sed -i ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* \ + -e '1a \\nDIALOG=${DIALOG:-dialog}\n' \ + -e 's/dialog -/${DIALOG} -/' # If T_PX is used in a script, it should be defined first: for FILE in ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* ; do if grep -q T_PX $FILE ; then @@ -1950,6 +1954,54 @@ if [ ! -L ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/gimp/2.0/plug-ins/xsane ]; then ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/gimp/2.0/plug-ins/xsane fi +## Enable this only after we checked all dialog calls for compatibility ## +## If Xdialog is installed, set DIALOG environment variable: ## +mkdir -p ${LIVE_ROOTDIR}/etc/profile.d +cat < ${LIVE_ROOTDIR}/etc/profile.d/dialog.sh +#!/bin/sh +if [ -x /usr/bin/Xdialog ]; then + DIALOG=Xdialog + XDIALOG_HIGH_DIALOG_COMPAT=1 + XDIALOG_FORCE_AUTOSIZE=1 + export DIALOG XDIALOG_HIGH_DIALOG_COMPAT XDIALOG_FORCE_AUTOSIZE +fi +EOT +cat < ${LIVE_ROOTDIR}/etc/profile.d/dialog.csh +#!/bin/csh +if (-x /usr/bin/Xdialog) then + setenv DIALOG Xdialog + setenv XDIALOG_HIGH_DIALOG_COMPAT 1 + setenv XDIALOG_FORCE_AUTOSIZE 1 +endif +EOT +# Once we are certain this works, make the scripts executable: +chmod 0644 ${LIVE_ROOTDIR}/etc/profile.d/dialog.{c,}sh + +# Add a shortcut to 'setup2hd' on the user's desktop: +mkdir -p ${LIVE_ROOTDIR}/usr/share/pixmaps +install -m 0644 ${LIVE_TOOLDIR}/media/slackware/icons/graySW_512px.png \ + ${LIVE_ROOTDIR}/usr/share/pixmaps/liveslak.png +mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop +cat < ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/.directory +[Desktop Entry] +Encoding=UTF-8 +Icon=user-desktop +Type=Directory +EOT +cat < ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/setup2hd.desktop +#!/usr/bin/env xdg-open +[Desktop Entry] +Type=Application +Terminal=true +Name=Install ${DISTRO^} +Comment=Install ${DISTRO^} (live or regular) to Harddisk +Icon=/usr/share/pixmaps/liveslak.png +Exec=sudo -i /usr/local/sbin/setup2hd +EOT +# Let Plasma5 trust the desktop shortcut: +chmod 0544 ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/setup2hd.desktop + + # -------------------------------------------------------------------------- # echo "-- Configuring XFCE." # -------------------------------------------------------------------------- # diff --git a/setup2hd.tpl b/setup2hd.tpl index d600996..8a47755 100755 --- a/setup2hd.tpl +++ b/setup2hd.tpl @@ -37,8 +37,29 @@ export LANG=C export LC_ALL=C +# The script defaults to curses dialog but Xdialog is a good alternative: +DIALOG=${DIALOG:-"dialog"} + +# Script needs to be run as root: +if [ ${EUID} -ne 0 ]; then + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "NOT ROOT" --msgbox "\ +\n\ +You must be root to run this program!" 7 68 + exit 1 +fi + +# The terminal window needs to be sufficiently large for cgdisk to fit: +if [ $(tput cols) -lt 80 ] || [ $(tput lines) -lt 24 ]; then + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "TERMINAL TOO SMALL" --msgbox "\ +\n\ +Before you continue, re-size your terminal\nso it measures at least 80 x 24 characters.\n\ +Otherwise you will not be able to use disk partition tools." 11 68 +fi + if [ ! -d /mnt/livemedia/@LIVEMAIN@/system ]; then - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "LIVE MEDIA NOT ACCESSIBLE" --msgbox "\ \n\ Before you can install software, complete the following tasks:\n\ @@ -66,7 +87,7 @@ echo "on" > $TMP/SeTcolor # turn on color menus PATH="$PATH:/usr/share/@LIVEMAIN@" export PATH; export COLOR=on -dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" --infobox "\n +${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" --infobox "\n Scanning your system for partition information...\n \n" 5 55 # In case the machine is full of fast SSDs: @@ -77,7 +98,7 @@ vgchange -ay 1> /dev/null 2> /dev/null if probe -l 2> /dev/null | grep -E 'Linux$' 1> /dev/null 2> /dev/null ; then RUNPART=no probe -l 2> /dev/null | grep -E 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "LINUX PARTITIONS DETECTED" \ --yes-label "Continue" --no-label "Skip" --defaultno \ --yesno "Setup detected partitions on this machine of type Linux.\n\ @@ -92,7 +113,7 @@ Otherwise, select 'Skip' to skip disk partitioning and go on with the setup." \ fi else RUNPART=yes - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "NO LINUX PARTITIONS DETECTED" \ --msgbox "There don't seem to be any partitions on this machine of type \ Linux. You'll need to make at least one of these to install Linux. \ @@ -102,7 +123,7 @@ fi if [ -d /sys/firmware/efi ]; then if ! probe -l 2> /dev/null | grep "EFI System Partition" 1> /dev/null 2> /dev/null ; then RUNPART=yes - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "NO EFI SYSTEM PARTITION DETECTED" \ --msgbox "This machine appears to be using EFI/UEFI, but no EFI System \ Partition was found. You'll need to make an EFI System Partition in order \ @@ -157,14 +178,15 @@ rm -f /var/log/mount 2> /dev/null rmdir /var/log/mount 2> /dev/null mkdir /var/log/mount 2> /dev/null +MAINSELECT="ADDSWAP" while [ 0 ]; do - dialog --title "@CDISTRO@ Linux Setup (version @SL_VERSION@)" \ + ${DIALOG} --title "@CDISTRO@ Linux Setup (version @SL_VERSION@)" \ --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --default-item "$MAINSELECT" \ --menu "Welcome to @CDISTRO@ Linux Setup (Live Edition).\n\ Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\ -Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \ -"KEYMAP" "Remap your keyboard if you're not using a US one" \ +Alternate keys may also be used: '+', '-', and TAB." 14 72 5 \ "ADDSWAP" "Set up your swap partition(s)" \ "TARGET" "Set up your target partitions" \ "INSTALL" "Install @CDISTRO@ to disk" \ @@ -180,17 +202,6 @@ Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \ # Start checking what to do. Some modules may reset MAINSELECT to run the # next item in line. - if [ "$MAINSELECT" = "KEYMAP" ]; then - SeTkeymap - if [ -r $TMP/SeTkeymap ]; then - MAINSELECT="ADDSWAP" - fi - fi - - if [ "$MAINSELECT" = "MAKE TAGS" ]; then - SeTmaketag - fi - if [ "$MAINSELECT" = "ADDSWAP" ]; then SeTswap if [ -r $TMP/SeTswap ]; then @@ -256,7 +267,7 @@ Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \ REPLACE_FSTAB=Y if [ -r $TMP/SeTnative ]; then if [ -r $T_PX/etc/fstab ]; then - dialog --title "REPLACE /etc/fstab?" --yesno "You already have an \ + ${DIALOG} --title "REPLACE /etc/fstab?" --yesno "You already have an \ /etc/fstab on your install partition. If you were just adding software, \ you should probably keep your old /etc/fstab. If you've changed your \ partitioning scheme, you should use the new /etc/fstab. Do you want \ @@ -280,9 +291,10 @@ to replace your old /etc/fstab with the new one?" 10 58 printf "%-16s %-16s %-11s %-16s %-3s %s\n" "proc" "/proc" "proc" "defaults" "0" "0" >> $T_PX/etc/fstab printf "%-16s %-16s %-11s %-16s %-3s %s\n" "tmpfs" "/dev/shm" "tmpfs" "defaults" "0" "0" >> $T_PX/etc/fstab fi - dialog --title "SETUP COMPLETE" --msgbox "System configuration \ + ${DIALOG} --title "SETUP COMPLETE" --msgbox "System configuration \ and installation is complete. \ \n\nYou may now reboot your system." 7 55 + MAINSELECT="DONE" fi fi @@ -290,6 +302,10 @@ and installation is complete. \ break fi + if [ "$MAINSELECT" = "DONE" ]; then + MAINSELECT="EXIT" + fi + done # end of main loop sync @@ -329,13 +345,13 @@ if [ -f ${T_PX}/etc/fstab ]; then eject -s `cat $TMP/SeTCDdev` # Tell the user to remove the disc, if one had previously been mounted # (it should now be ejected): - dialog \ + ${DIALOG} \ --clear \ --title "@CDISTRO@ Linux Setup is complete" "$@" \ --msgbox "\nPlease remove the installation disc.\n" 7 40 fi # Sign off to the user: - dialog \ + ${DIALOG} \ --clear \ --title "@CDISTRO@ Linux Setup is complete" "$@" \ --msgbox "\nInstallation is complete.\n\n @@ -348,7 +364,7 @@ fi fixdate # final cleanup -rm -f $TMP/tagfile $TMP/SeT* $TMP/tar-error $TMP/unsquash_output $TMP/unsquash_error $TMP/PKGTOOL_REMOVED +rm -f $TMP/tagfile $TMP/temp* $TMP/tmp* $TMP/SeT* $TMP/tar-error $TMP/unsquash_output $TMP/unsquash_error $TMP/PKGTOOL_REMOVED $TMP/LILO* $TMP/avail* rm -f /var/log/mount/treecache rmdir /var/log/mntiso 2>/dev/null rm -rf $TMP/treecache 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