From 70b689e6bf00338f55ae2daf1c2d0c2d972e00e8 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Mon, 5 Oct 2020 15:34:46 +0200 Subject: setup2hd: add option to install regular Slackware via network mirror The setup2hd script is a modified Slackware installer. For liveslak I had originally removed all the usual SOURCE selections and only allowed for the installation of the Live OS to harddisk. However, requests were sent to also support a regular installation of Slackware using the Live ISO. That is why I have now re-added all the Slackware network install choices (via NFS, HTTP, FTP or Samba mirror). I still left out the Slackware installation using local media; the Live ISO does not contain regular Slackware packages so that would not make sense. --- SeTuacct.tpl | 92 --------------------- SeTudiskpart.tpl | 61 -------------- SeTupass.tpl | 42 ---------- make_slackware_live.sh | 27 ++++--- setup2hd.local | 81 ------------------- setup2hd.local.tpl | 81 +++++++++++++++++++ setup2hd.tpl | 188 ++++++------------------------------------- setup2hd/SeTuacct.tpl | 92 +++++++++++++++++++++ setup2hd/SeTudiskpart.tpl | 61 ++++++++++++++ setup2hd/SeTumedia.tpl | 32 ++++++++ setup2hd/SeTupass.tpl | 42 ++++++++++ setup2hd/setup.liveslak.tpl | 173 +++++++++++++++++++++++++++++++++++++++ setup2hd/setup.slackware.tpl | 155 +++++++++++++++++++++++++++++++++++ 13 files changed, 675 insertions(+), 452 deletions(-) delete mode 100755 SeTuacct.tpl delete mode 100644 SeTudiskpart.tpl delete mode 100755 SeTupass.tpl delete mode 100644 setup2hd.local create mode 100644 setup2hd.local.tpl create mode 100644 setup2hd/SeTuacct.tpl create mode 100644 setup2hd/SeTudiskpart.tpl create mode 100644 setup2hd/SeTumedia.tpl create mode 100644 setup2hd/SeTupass.tpl create mode 100644 setup2hd/setup.liveslak.tpl create mode 100644 setup2hd/setup.slackware.tpl diff --git a/SeTuacct.tpl b/SeTuacct.tpl deleted file mode 100755 index 5024f5d..0000000 --- a/SeTuacct.tpl +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -#TMP=/var/log/setup/tmp -TMP=/tmp -if [ ! -d $TMP ]; then - mkdir -p $TMP -fi - -freeuid() { - # Get the first free UIDNumber after 999: - local UIDS=$( cat ${T_PX}/etc/passwd | cut -d: -f3 | sort -n ) - local UID=999 - while true; do - UID=$(( $UID + 1)) - if ! echo $UIDS | grep -F -q -w "$UID"; then - break; - fi - done - echo $UID -} -FREEUID="$(freeuid)" - -UFULLNAME="" -UACCOUNT="" -UACCTNR="$FREEUID" -USHELL="/bin/bash" -UFORM="Fill out your user details:" -while [ 0 ]; do - dialog --stdout --ok-label "Submit" --no-cancel \ - --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ - --form "$UFORM" \ - 11 64 0 \ - "Full Name:" 1 1 "$UFULLNAME" 1 14 40 0 \ - "Logonname:" 2 1 "$UACCOUNT" 2 14 32 0 \ - "UIDNumber:" 3 1 "$UACCTNR" 3 14 12 0 \ - "Login Shell:" 4 1 "$USHELL" 4 14 12 0 \ - 2>&1 1> $TMP/tempresult - iii=0 - declare -a USERATTR - while read LINE ; do - USERATTR[$iii]="$LINE" - iii=$(expr $iii + 1) - done < $TMP/tempresult - rm -f $TMP/tempresult - UFULLNAME="${USERATTR[0]}" - UACCOUNT="${USERATTR[1]}" - UACCTNR="${USERATTR[2]}" - USHELL="${USERATTR[3]}" - unset USERATTR - UINPUT=0 - # Validate the input: - UACC_INVALID1="$(echo ${UACCOUNT:0:1} |tr -d 'a-z_')" - UACC_INVALID="$(echo ${UACCOUNT:1} |tr -d 'a-z0-9_-')" - if [ -n "$UACC_INVALID1" -o -n "$UACC_INVALID" ]; then - # User account contains invalid characters, let's remove them all: - UINPUT=1 - UACCOUNT="$(echo ${UACCOUNT} |tr -cd 'a-z_')" - fi - if [ -z "$UACCOUNT" -o -z "$UFULLNAME" ]; then - # User account or fullname is empty, let's try again: - UINPUT=$(expr $UINPUT + 2) - fi - if chroot ${T_PX} /usr/bin/id -u ${UACCTNR} 1>/dev/null 2>/dev/null ; then - # UidNumber is already in use, fall back to sane default: - UINPUT=$(expr $UINPUT + 4) - UACCTNR=$FREEUID - fi - if ! grep -q ${USHELL} ${T_PX}/etc/shells ; then - # Login shell is invalid, suggest the bash shell again: - UINPUT=$(expr $UINPUT + 8) - USHELL=/bin/bash - fi - if [ $UINPUT -eq 0 ]; then - break - elif [ $UINPUT -eq 1 ]; then - UFORM="Please only use valid characters for logonname" - elif [ $UINPUT -eq 2 ]; then - UFORM="Please enter your logon and full name" - elif [ $UINPUT -eq 3 ]; then - UFORM="Use valid characters for logonname, and enter full name" - elif [ $UINPUT -eq 4 ]; then - UFORM="Enter unused number for your account, $FREEUID is a good default" - elif [ $UINPUT -eq 8 ]; then - UFORM="Please enter a valid shell" - else - UFORM="Fill all fields, using valid logonname/uidnumber values" - fi -done - -echo "UACCOUNT=$UACCOUNT" -echo "UFULLNAME='$UFULLNAME'" -echo "UACCTNR=$UACCTNR" -echo "USHELL=$USHELL" diff --git a/SeTudiskpart.tpl b/SeTudiskpart.tpl deleted file mode 100644 index 5a244a8..0000000 --- a/SeTudiskpart.tpl +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -TMP=/var/log/setup/tmp -if [ ! -d $TMP ]; then - mkdir -p $TMP -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)" \ - --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 - exit - fi - - # Generate a list of local hard drives we can write to: - rm -f $TMP/tempscript - cat < $TMP/tempscript -dialog --stdout \\ - --title "SELECT DISK DRIVES" \\ - --backtitle "Creating Linux, swap and EFI partitions" \\ - --checklist "Select from available drives.\nA disk partitioning utility \\ -will be presented for any drive you select here:" \\ - 19 0 9 \\ -EOT - lsblk -a -o NAME,SIZE,RM,RO,TYPE,MODEL | \ - tr -s '[:blank:]' ' ' | grep '0 *0 *disk' | grep -v '^ram' | \ - while read LINE ; do - DISKATTR=($LINE) - DISKVENDOR="${DISKATTR[@]:5}" - if [ -z "${DISKVENDOR}" ]; then - DISKVENDOR="UnknownVendor" - fi - echo "\"/dev/${DISKATTR[0]}\" \"${DISKATTR[1]}: ${DISKVENDOR}\" off \\" >> $TMP/tempscript - done - echo '2>&1 1>$TMP/availdisks' >> $TMP/tempscript - - # Loop until the user makes a choice: - while [ 0 ]; do - source $TMP/tempscript - if [ ! $? = 0 ] || [ ! -s $TMP/availdisks ]; then - # Canceled the dialog, or did not select anything: - rm -f $TMP/availdisks - else - # We got an answer: - for DISKDRIVE in $(cat $TMP/availdisks) ; do - # Determine which disk partitioning tool to use: - if gdisk -l $DISKDRIVE |tr -s '[:blank:]' ' ' |grep -q "MBR: MBR only" ; then - PARTTOOL=cfdisk - else - PARTTOOL=cgdisk - fi - # Now let the user create her partitions: - $PARTTOOL $DISKDRIVE - done - break - fi - done - # We should have partitions now, so re-run probe and collect that list: - probe -l 2> /dev/null | grep -E 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null - diff --git a/SeTupass.tpl b/SeTupass.tpl deleted file mode 100755 index ff662ab..0000000 --- a/SeTupass.tpl +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -TMP=/var/log/setup/tmp -if [ ! -d $TMP ]; then - mkdir -p $TMP -fi - -UACCOUNT="$1" - - 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 \ - 2>&1 1> $TMP/tempresult - iii=0 - declare -a USERATTR - while read LINE ; do - USERATTR[$iii]="$LINE" - iii=$(expr $iii + 1) - done < $TMP/tempresult - rm -f $TMP/tempresult - UPASS1="${USERATTR[0]}" - UPASS2="${USERATTR[1]}" - unset USERATTR - if [ -z "$UPASS1" ]; then - UFORM="Password must not be empty, try again for user '$UACCOUNT'" - elif [ "$UPASS1" == "$UPASS2" ]; then - break - else - UFORM="Passwords do not match, try again for user '$UACCOUNT'" - fi - done - echo "${UPASS1}" - unset UPASS1 - unset UPASS2 - unset USERATTR - diff --git a/make_slackware_live.sh b/make_slackware_live.sh index a829d7b..fca54ef 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -1660,14 +1660,15 @@ cat ${LIVE_TOOLDIR}/pxeserver.tpl | sed \ > ${LIVE_ROOTDIR}/usr/local/sbin/pxeserver chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/pxeserver -# Only when we find a huge kernel, we will add a harddisk installer -# to the ISO. The huge kernel does not require an initrd and installation -# to the hard drive will not be complicated. -if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then - if [ -f ${DEF_SL_PKGROOT}/../isolinux/initrd.img ]; then +# Add a harddisk installer to the ISO. +# The huge kernel does not require an initrd and installation to the +# hard drive will not be complicated, so a liveslak install is recommended +# for newbies only if the ISO contains huge kernel... +if [ -f ${DEF_SL_PKGROOT}/../isolinux/initrd.img ]; then + echo "-- Adding 'setup2hd' hard disk installer to /usr/share/${LIVEMAIN}/." # Extract the 'setup' files we need from the Slackware installer # and move them to a single directory in the ISO: - mkdir -p ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN} + mkdir -p ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN} cd ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN} uncompressfs ${DEF_SL_PKGROOT}/../isolinux/initrd.img | cpio -i -d -m -H newc usr/lib/setup/* sbin/probe sbin/fixdate mv -i usr/lib/setup/* sbin/probe sbin/fixdate . @@ -1721,13 +1722,18 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then # Fix some occurrences of '/usr/lib/setup/' that are covered by $PATH: sed -i -e 's,/usr/lib/setup/,,g' -e 's,:/usr/lib/setup,:/usr/share/${LIVEMAIN},g' ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* # Add the Slackware Live HD installer scripts: - for USCRIPT in SeTuacct SeTudiskpart SeTupass ; do - cat ${LIVE_TOOLDIR}/${USCRIPT}.tpl | sed \ + for USCRIPT in SeTuacct SeTudiskpart SeTumedia SeTupass setup.liveslak setup.slackware ; do + cat ${LIVE_TOOLDIR}/setup2hd/${USCRIPT}.tpl | sed \ + -e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \ -e "s/@DISTRO@/$DISTRO/g" \ -e "s/@CDISTRO@/${DISTRO^}/g" \ -e "s/@UDISTRO@/${DISTRO^^}/g" \ + -e "s/@KVER@/$KVER/g" \ -e "s/@LIVEDE@/$LIVEDE/g" \ + -e "s/@LIVEMAIN@/$LIVEMAIN/g" \ + -e "s/@MARKER@/$MARKER/g" \ -e "s/@SL_VERSION@/$SL_VERSION/g" \ + -e "s/@VERSION@/$VERSION/g" \ > ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${USCRIPT} chmod 755 ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${USCRIPT} done @@ -1746,9 +1752,9 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then > ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd # Slackware Live HD post-install customization hook: - if [ -f ${LIVE_TOOLDIR}/setup2hd.local ]; then + if [ -f ${LIVE_TOOLDIR}/setup2hd.local.tpl ]; then # The '.local' suffix means: install it as a sample file only: - HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.local" + HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.local.tpl" HOOK_DST="${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/setup2hd.$DISTRO.sample" elif [ -f ${LIVE_TOOLDIR}/setup2hd.$DISTRO ]; then # Install the hook; the file will be sourced by "setup2hd". @@ -1770,7 +1776,6 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then chmod 644 ${HOOK_DST} else echo "-- Could not find ${DEF_SL_PKGROOT}/../isolinux/initrd.img - not adding 'setup2hd'!" - fi fi # Add the documentation: diff --git a/setup2hd.local b/setup2hd.local deleted file mode 100644 index 8edb7a5..0000000 --- a/setup2hd.local +++ /dev/null @@ -1,81 +0,0 @@ -# ------------------------------------------------------------------------- -# Live OS Post Install routine. -# This is where you can override the default post-installation routine -# by (re-)defining the function "live_post_install()". -# ------------------------------------------------------------------------- - -# The example below is an extension to what the setup2hd script does. -# By default, setup2hd will only copy a few customizations from the Live OS -# to the hard drive. Things that do *not* get installed are (among others): -# - the 'live' user plus homedirectory -# - the runlevel (Slackware Live starts in runlevel 4) -# - sudo and su configuration -# These *are* copied in the example below. - -live_post_install () { - # 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 --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \ - "\nCopying Live modifications to hard disk ..." 5 65 - # Do not overwrite a custom keymap: - if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then - unsquashfs -f -dest $T_PX \ - /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ - /etc/rc.d/rc.keymap - fi - unsquashfs -f -dest $T_PX \ - /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ - /etc/X11/xdm/liveslak-xdm \ - /etc/X11/xorg.conf.d/30-keyboard.conf \ - /etc/group \ - /etc/hardwareclock \ - /etc/inittab \ - /etc/localtime* \ - /etc/passwd \ - /etc/profile.d/lang.sh \ - /etc/rc.d/rc.font \ - /etc/rc.d/rc.gpm \ - /etc/shadow \ - /etc/skel \ - /etc/slackpkg \ - /etc/suauth \ - /etc/sudoers \ - /etc/vconsole.conf \ - /home/live - # 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,' - # Remove the marker file from the filesystem root: - rm -f ${T_PX}/@MARKER@ - - cat << EOF > $TMP/tempmsg - - @CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive! - We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available). - After rebooting, your installed computer will look exactly like the Live OS. - - After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this: - # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz - -EOF - dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ - 20 65 - rm $TMP/tempmsg - - # Setting MAINSELECT to "CONFIGURE" will call the usual Slackware - # setup scripts next (timeconfig, netconfig, mouseconfig etc...). - # If you want to skip all that and do your own config instead, - # add it right below these lines and then set MAINSELECT to - # "EXIT" instead of "CONFIGURE". - - # ... one thing you must NOT FORGET TO DO is: - #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "#/dev/cdrom" "/mnt/cdrom" "auto" "noauto,owner,ro,comment=x-gvfs-show" "0" "0" >> $T_PX/etc/fstab - #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "/dev/fd0" "/mnt/floppy" "auto" "noauto,owner" "0" "0" >> $T_PX/etc/fstab - #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "devpts" "/dev/pts" "devpts" "gid=5,mode=620" "0" "0" >> $T_PX/etc/fstab - #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 - - # Remember, change to "EXIT" if you want to skip Slackware's post-config! - MAINSELECT="CONFIGURE" - -} # END live_post_install() - diff --git a/setup2hd.local.tpl b/setup2hd.local.tpl new file mode 100644 index 0000000..8edb7a5 --- /dev/null +++ b/setup2hd.local.tpl @@ -0,0 +1,81 @@ +# ------------------------------------------------------------------------- +# Live OS Post Install routine. +# This is where you can override the default post-installation routine +# by (re-)defining the function "live_post_install()". +# ------------------------------------------------------------------------- + +# The example below is an extension to what the setup2hd script does. +# By default, setup2hd will only copy a few customizations from the Live OS +# to the hard drive. Things that do *not* get installed are (among others): +# - the 'live' user plus homedirectory +# - the runlevel (Slackware Live starts in runlevel 4) +# - sudo and su configuration +# These *are* copied in the example below. + +live_post_install () { + # 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 --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \ + "\nCopying Live modifications to hard disk ..." 5 65 + # Do not overwrite a custom keymap: + if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then + unsquashfs -f -dest $T_PX \ + /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ + /etc/rc.d/rc.keymap + fi + unsquashfs -f -dest $T_PX \ + /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ + /etc/X11/xdm/liveslak-xdm \ + /etc/X11/xorg.conf.d/30-keyboard.conf \ + /etc/group \ + /etc/hardwareclock \ + /etc/inittab \ + /etc/localtime* \ + /etc/passwd \ + /etc/profile.d/lang.sh \ + /etc/rc.d/rc.font \ + /etc/rc.d/rc.gpm \ + /etc/shadow \ + /etc/skel \ + /etc/slackpkg \ + /etc/suauth \ + /etc/sudoers \ + /etc/vconsole.conf \ + /home/live + # 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,' + # Remove the marker file from the filesystem root: + rm -f ${T_PX}/@MARKER@ + + cat << EOF > $TMP/tempmsg + + @CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive! + We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available). + After rebooting, your installed computer will look exactly like the Live OS. + + After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this: + # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz + +EOF + dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ + 20 65 + rm $TMP/tempmsg + + # Setting MAINSELECT to "CONFIGURE" will call the usual Slackware + # setup scripts next (timeconfig, netconfig, mouseconfig etc...). + # If you want to skip all that and do your own config instead, + # add it right below these lines and then set MAINSELECT to + # "EXIT" instead of "CONFIGURE". + + # ... one thing you must NOT FORGET TO DO is: + #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "#/dev/cdrom" "/mnt/cdrom" "auto" "noauto,owner,ro,comment=x-gvfs-show" "0" "0" >> $T_PX/etc/fstab + #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "/dev/fd0" "/mnt/floppy" "auto" "noauto,owner" "0" "0" >> $T_PX/etc/fstab + #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "devpts" "/dev/pts" "devpts" "gid=5,mode=620" "0" "0" >> $T_PX/etc/fstab + #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 + + # Remember, change to "EXIT" if you want to skip Slackware's post-config! + MAINSELECT="CONFIGURE" + +} # END live_post_install() + diff --git a/setup2hd.tpl b/setup2hd.tpl index 4bc48bb..92bbdbc 100755 --- a/setup2hd.tpl +++ b/setup2hd.tpl @@ -211,180 +211,38 @@ Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \ SeTEFI SeTDOS if [ -r $TMP/SeTnative ]; then - MAINSELECT="INSTALL" + MAINSELECT="SOURCE" fi fi - if [ "$MAINSELECT" = "INSTALL" ]; then - if [ ! -r $TMP/SeTnative ]; then - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ - --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\ -\n\ -Before you can install software, complete the following tasks:\n\ -\n\ -1. Set up your target Linux partition(s).\n\ -\n\ -You may also optionally remap your keyboard and set up your\n\ -swap partition(s). \n\ -\n\ -Press ENTER to return to the main menu." 16 68 - continue + if [ "$MAINSELECT" = "SOURCE" ]; then + SeTumedia + if [ -r $TMP/SeTsource ]; then + if [ -r $TMP/SeTlive ]; then + MAINSELECT="INSTALL" + else + MAINSELECT="SELECT" + fi fi + fi - # --------------------------------------------- # - # Slackware Live Edition - install to disk: # - # --------------------------------------------- # - - # Buy us some time while we are calculating disk usage: - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ - --title "WELCOME TO @UDISTRO@ LIVE (@LIVEDE@)" --infobox \ - "\nCalculating disk usage, please be patient ..." 5 65 - - ACT_MODS=$(ls -rt --indicator-style=none /mnt/live/modules/ |wc -l) - TOT_MODS=$(find /mnt/livemedia/@LIVEMAIN@/ -type f -name "*.sxz" |wc -l) - DU_LIVE=$(du -s /mnt/live/modules/ 2>/dev/null |tr -s '\t' ' ' |cut -f1 -d' ') - PARTFREE=$(df -P -BM $T_PX |tail -1 |tr -s '\t' ' ' |cut -d' ' -f4) - PARTFREE=${PARTFREE%M} - - # Warn when it looks we have insufficient room: - if [ $PARTFREE -lt $(($DU_LIVE/1024)) ]; then - 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=$? - if [ $retval = 1 ]; then - umount $T_PX - exit 1 - fi + if [ "$MAINSELECT" = "SELECT" ]; then + if [ -r /var/log/mount/isolinux/setpkg ]; then + sh /var/log/mount/isolinux/setpkg else - 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 + SeTPKG fi - - ( - # Install the Live OS by rsyncing the readonly overlay to the harddisk: - rsync -HAXav --whole-file --checksum-choice=none --inplace --progress --no-inc-recursive \ - /mnt/@LIVEMAIN@fs/ $T_PX/ \ - | awk '{ if (index($0, "to-chk=") > 0) { split($0, pieces, "to-chk="); split(pieces[2], term, ")"); split(term[1], division, "/"); print (1-(division[1]/division[2]))*100 }; fflush(); }' \ - | sed --unbuffered 's/^\([0-9]*\).*/\1/' - ) | dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ - --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --gauge \ - "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 65 - - # - # Live OS Post Install routine. If you want, you can override this routine - # by (re-)defining this function "live_post_install()" in a file called - # "/usr/share/@LIVEMAIN@/setup2hd.@DISTRO@". - # - - live_post_install () { - # 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)" \ - --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \ - "\nCopying Live modifications to hard disk ..." 5 65 - sleep 1 # It's too fast... - # Do not overwrite a custom keymap: - if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then - unsquashfs -f -dest $T_PX \ - /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ - /etc/rc.d/rc.keymap - fi - unsquashfs -f -dest $T_PX \ - /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ - /etc/X11/xdm/liveslak-xdm \ - /etc/X11/xorg.conf.d/30-keyboard.conf \ - /etc/inittab \ - /etc/skel \ - /etc/profile.d/lang.sh \ - /etc/rc.d/rc.font \ - /etc/rc.d/rc.gpm \ - /etc/slackpkg \ - /etc/vconsole.conf - # 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,' - # Remove the marker file from the filesystem root: - rm -f ${T_PX}/@MARKER@ - - # --------------------- - # Set up a user account, - 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\ -Next you will be asked to set root's password." 9 55 - # This will set UFULLNAME, UACCOUNT and USHELL variables: - SeTuacct 2>&1 1> $TMP/tempresult - if [ $? = 0 ]; then - # User filled out the form, so let's get the results for - # UFULLNAME, UACCOUNT and USHELL: - source $TMP/tempresult - rm -f $TMP/tempresult - # Set a password for the new account: - UPASS=$(SeTupass $UACCOUNT) - # Create the account and set the password: - chroot ${T_PX} /usr/sbin/useradd -c "$UFULLNAME" -g users -G wheel,audio,cdrom,floppy,plugdev,video,power,netdev,lp,scanner,kmem,dialout,games,disk,input -u 1000 -d /home/${UACCOUNT} -m -s ${USHELL} ${UACCOUNT} - echo "${UACCOUNT}:${UPASS}" | chroot ${T_PX} /usr/sbin/chpasswd - unset UPASS - - # Configure suauth: - cat <${T_PX}/etc/suauth -root:${UACCOUNT}:OWNPASS -root:ALL EXCEPT GROUP wheel:DENY -EOT - chmod 600 ${LIVE_ROOTDIR}/etc/suauth - - # Configure sudoers: - chmod 640 ${T_PX}/etc/sudoers - sed -i ${T_PX}/etc/sudoers -e 's/# *\(%wheel\sALL=(ALL)\sALL\)/\1/' - chmod 440 ${T_PX}/etc/sudoers - fi # End user creation - # --------------------------- - - if [ "$(cat $T_PX/etc/shadow | grep 'root:' | cut -f 2 -d :)" = "" ]; then - # There is no root password yet: - UPASS=$(SeTupass root) - echo "root:${UPASS}" | chroot ${T_PX} /usr/sbin/chpasswd - unset UPASS - fi - - cat << EOF > $TMP/tempmsg - - @CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive! - We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available). - The following configuration was copied from the Live OS to your harddisk: - - console font - - default runlevel - - keyboard layout - - language setting - After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this: - # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz - -EOF - dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ - --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ - 20 65 - rm $TMP/tempmsg - - MAINSELECT="CONFIGURE" - } # END live_post_install() function - - - if [ -f /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@ ]; then - # If the setup2hd post-configuration file exists, source it. - # The file should re-define the live_post_install() function. - . /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@ + if [ -r $TMP/SeTSERIES ]; then + MAINSELECT="INSTALL" fi + fi - # Now, execute the function - either our own built-in version - # or the re-defined function from the custom setup2hd.@DISTRO@ file. - live_post_install - - # --------------------------------------------- # - # Slackware Live Edition - end install to disk: # - # --------------------------------------------- # - + if [ "$MAINSELECT" = "INSTALL" ]; then + if [ -r $TMP/SeTlive ]; then + source setup.liveslak + else + source setup.slackware + fi fi if [ "$MAINSELECT" = "CONFIGURE" ]; then diff --git a/setup2hd/SeTuacct.tpl b/setup2hd/SeTuacct.tpl new file mode 100644 index 0000000..5024f5d --- /dev/null +++ b/setup2hd/SeTuacct.tpl @@ -0,0 +1,92 @@ +#!/bin/sh +#TMP=/var/log/setup/tmp +TMP=/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +freeuid() { + # Get the first free UIDNumber after 999: + local UIDS=$( cat ${T_PX}/etc/passwd | cut -d: -f3 | sort -n ) + local UID=999 + while true; do + UID=$(( $UID + 1)) + if ! echo $UIDS | grep -F -q -w "$UID"; then + break; + fi + done + echo $UID +} +FREEUID="$(freeuid)" + +UFULLNAME="" +UACCOUNT="" +UACCTNR="$FREEUID" +USHELL="/bin/bash" +UFORM="Fill out your user details:" +while [ 0 ]; do + dialog --stdout --ok-label "Submit" --no-cancel \ + --title "@UDISTRO@ (@LIVEDE@) USER CREATION" \ + --form "$UFORM" \ + 11 64 0 \ + "Full Name:" 1 1 "$UFULLNAME" 1 14 40 0 \ + "Logonname:" 2 1 "$UACCOUNT" 2 14 32 0 \ + "UIDNumber:" 3 1 "$UACCTNR" 3 14 12 0 \ + "Login Shell:" 4 1 "$USHELL" 4 14 12 0 \ + 2>&1 1> $TMP/tempresult + iii=0 + declare -a USERATTR + while read LINE ; do + USERATTR[$iii]="$LINE" + iii=$(expr $iii + 1) + done < $TMP/tempresult + rm -f $TMP/tempresult + UFULLNAME="${USERATTR[0]}" + UACCOUNT="${USERATTR[1]}" + UACCTNR="${USERATTR[2]}" + USHELL="${USERATTR[3]}" + unset USERATTR + UINPUT=0 + # Validate the input: + UACC_INVALID1="$(echo ${UACCOUNT:0:1} |tr -d 'a-z_')" + UACC_INVALID="$(echo ${UACCOUNT:1} |tr -d 'a-z0-9_-')" + if [ -n "$UACC_INVALID1" -o -n "$UACC_INVALID" ]; then + # User account contains invalid characters, let's remove them all: + UINPUT=1 + UACCOUNT="$(echo ${UACCOUNT} |tr -cd 'a-z_')" + fi + if [ -z "$UACCOUNT" -o -z "$UFULLNAME" ]; then + # User account or fullname is empty, let's try again: + UINPUT=$(expr $UINPUT + 2) + fi + if chroot ${T_PX} /usr/bin/id -u ${UACCTNR} 1>/dev/null 2>/dev/null ; then + # UidNumber is already in use, fall back to sane default: + UINPUT=$(expr $UINPUT + 4) + UACCTNR=$FREEUID + fi + if ! grep -q ${USHELL} ${T_PX}/etc/shells ; then + # Login shell is invalid, suggest the bash shell again: + UINPUT=$(expr $UINPUT + 8) + USHELL=/bin/bash + fi + if [ $UINPUT -eq 0 ]; then + break + elif [ $UINPUT -eq 1 ]; then + UFORM="Please only use valid characters for logonname" + elif [ $UINPUT -eq 2 ]; then + UFORM="Please enter your logon and full name" + elif [ $UINPUT -eq 3 ]; then + UFORM="Use valid characters for logonname, and enter full name" + elif [ $UINPUT -eq 4 ]; then + UFORM="Enter unused number for your account, $FREEUID is a good default" + elif [ $UINPUT -eq 8 ]; then + UFORM="Please enter a valid shell" + else + UFORM="Fill all fields, using valid logonname/uidnumber values" + fi +done + +echo "UACCOUNT=$UACCOUNT" +echo "UFULLNAME='$UFULLNAME'" +echo "UACCTNR=$UACCTNR" +echo "USHELL=$USHELL" diff --git a/setup2hd/SeTudiskpart.tpl b/setup2hd/SeTudiskpart.tpl new file mode 100644 index 0000000..46bf26b --- /dev/null +++ b/setup2hd/SeTudiskpart.tpl @@ -0,0 +1,61 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +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)" \ + --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 + exit 1 + fi + + # Generate a list of local hard drives we can write to: + rm -f $TMP/tempscript + cat < $TMP/tempscript +dialog --stdout \\ + --title "SELECT DISK DRIVES" \\ + --backtitle "Creating Linux, swap and EFI partitions" \\ + --checklist "Select from available drives.\nA disk partitioning utility \\ +will be presented for any drive you select here:" \\ + 19 0 9 \\ +EOT + lsblk -a -o NAME,SIZE,RM,RO,TYPE,MODEL | \ + tr -s '[:blank:]' ' ' | grep '0 *0 *disk' | grep -v '^ram' | \ + while read LINE ; do + DISKATTR=($LINE) + DISKVENDOR="${DISKATTR[@]:5}" + if [ -z "${DISKVENDOR}" ]; then + DISKVENDOR="UnknownVendor" + fi + echo "\"/dev/${DISKATTR[0]}\" \"${DISKATTR[1]}: ${DISKVENDOR}\" off \\" >> $TMP/tempscript + done + echo '2>&1 1>$TMP/availdisks' >> $TMP/tempscript + + # Loop until the user makes a choice: + while [ 0 ]; do + source $TMP/tempscript + if [ ! $? = 0 ] || [ ! -s $TMP/availdisks ]; then + # Canceled the dialog, or did not select anything: + rm -f $TMP/availdisks + else + # We got an answer: + for DISKDRIVE in $(cat $TMP/availdisks) ; do + # Determine which disk partitioning tool to use: + if gdisk -l $DISKDRIVE |tr -s '[:blank:]' ' ' |grep -q "MBR: MBR only" ; then + PARTTOOL=cfdisk + else + PARTTOOL=cgdisk + fi + # Now let the user create her partitions: + $PARTTOOL $DISKDRIVE + done + break + fi + done + # We should have partitions now, so re-run probe and collect that list: + probe -l 2> /dev/null | grep -E 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null + diff --git a/setup2hd/SeTumedia.tpl b/setup2hd/SeTumedia.tpl new file mode 100644 index 0000000..8510acb --- /dev/null +++ b/setup2hd/SeTumedia.tpl @@ -0,0 +1,32 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +dialog --backtitle "Select Slackware installation source." \ +--title "SOURCE MEDIA SELECTION" --menu \ +"Please select the media from which to install Slackware Linux:" \ +14 70 7 \ +"1" "Install from NFS (Network File System)" \ +"2" "Install from FTP/HTTP server" \ +"3" "Install from Samba share" \ +"4" "Install @UDISTRO@ (@LIVEDE@) Live OS to disk" \ +2> $TMP/media +if [ ! $? = 0 ]; then + rm $TMP/media + exit +fi + +SOURCE_MEDIA="`cat $TMP/media`" +rm -f $TMP/media +if [ "$SOURCE_MEDIA" = "1" ]; then + INSNFS +elif [ "$SOURCE_MEDIA" = "2" ]; then + INSURL +elif [ "$SOURCE_MEDIA" = "3" ]; then + INSSMB +elif [ "$SOURCE_MEDIA" = "4" ]; then + touch $TMP/SeTlive +fi + diff --git a/setup2hd/SeTupass.tpl b/setup2hd/SeTupass.tpl new file mode 100644 index 0000000..ff662ab --- /dev/null +++ b/setup2hd/SeTupass.tpl @@ -0,0 +1,42 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +UACCOUNT="$1" + + 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 \ + 2>&1 1> $TMP/tempresult + iii=0 + declare -a USERATTR + while read LINE ; do + USERATTR[$iii]="$LINE" + iii=$(expr $iii + 1) + done < $TMP/tempresult + rm -f $TMP/tempresult + UPASS1="${USERATTR[0]}" + UPASS2="${USERATTR[1]}" + unset USERATTR + if [ -z "$UPASS1" ]; then + UFORM="Password must not be empty, try again for user '$UACCOUNT'" + elif [ "$UPASS1" == "$UPASS2" ]; then + break + else + UFORM="Passwords do not match, try again for user '$UACCOUNT'" + fi + done + echo "${UPASS1}" + unset UPASS1 + unset UPASS2 + unset USERATTR + diff --git a/setup2hd/setup.liveslak.tpl b/setup2hd/setup.liveslak.tpl new file mode 100644 index 0000000..396412b --- /dev/null +++ b/setup2hd/setup.liveslak.tpl @@ -0,0 +1,173 @@ + # Liveslak installation routine: + if [ "$MAINSELECT" = "INSTALL" ]; then + if [ ! -r $TMP/SeTnative ]; then + dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\ +\n\ +Before you can install software, complete the following tasks:\n\ +\n\ +1. Set up your target Linux partition(s).\n\ +\n\ +You may also optionally remap your keyboard and set up your\n\ +swap partition(s). \n\ +\n\ +Press ENTER to return to the main menu." 16 68 + continue + fi + + # --------------------------------------------- # + # Slackware Live Edition - install to disk: # + # --------------------------------------------- # + + # Buy us some time while we are calculating disk usage: + dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "WELCOME TO @UDISTRO@ LIVE (@LIVEDE@)" --infobox \ + "\nCalculating disk usage, please be patient ..." 5 65 + + ACT_MODS=$(ls -rt --indicator-style=none /mnt/live/modules/ |wc -l) + TOT_MODS=$(find /mnt/livemedia/@LIVEMAIN@/ -type f -name "*.sxz" |wc -l) + DU_LIVE=$(du -s /mnt/live/modules/ 2>/dev/null |tr -s '\t' ' ' |cut -f1 -d' ') + PARTFREE=$(df -P -BM $T_PX |tail -1 |tr -s '\t' ' ' |cut -d' ' -f4) + PARTFREE=${PARTFREE%M} + + # Warn when it looks we have insufficient room: + if [ $PARTFREE -lt $(($DU_LIVE/1024)) ]; then + 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=$? + if [ $retval = 1 ]; then + umount $T_PX + exit 1 + fi + else + 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 -HAXav --whole-file --checksum-choice=none --inplace --progress --no-inc-recursive \ + /mnt/@LIVEMAIN@fs/ $T_PX/ \ + | awk '{ if (index($0, "to-chk=") > 0) { split($0, pieces, "to-chk="); split(pieces[2], term, ")"); split(term[1], division, "/"); print (1-(division[1]/division[2]))*100 }; fflush(); }' \ + | sed --unbuffered 's/^\([0-9]*\).*/\1/' + ) | dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --gauge \ + "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 65 + + # + # Live OS Post Install routine. If you want, you can override this routine + # by (re-)defining this function "live_post_install()" in a file called + # "/usr/share/@LIVEMAIN@/setup2hd.@DISTRO@". + # + + live_post_install () { + # 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)" \ + --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \ + "\nCopying Live modifications to hard disk ..." 5 65 + sleep 1 # It's too fast... + # Do not overwrite a custom keymap: + if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then + unsquashfs -f -dest $T_PX \ + /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ + /etc/rc.d/rc.keymap + fi + unsquashfs -f -dest $T_PX \ + /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ + /etc/X11/xdm/liveslak-xdm \ + /etc/X11/xorg.conf.d/30-keyboard.conf \ + /etc/inittab \ + /etc/skel \ + /etc/profile.d/lang.sh \ + /etc/rc.d/rc.font \ + /etc/rc.d/rc.gpm \ + /etc/slackpkg \ + /etc/vconsole.conf + # 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,' + # Remove the marker file from the filesystem root: + rm -f ${T_PX}/@MARKER@ + + # --------------------- + # Set up a user account, + 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\ +Next you will be asked to set root's password." 9 55 + # This will set UFULLNAME, UACCOUNT and USHELL variables: + SeTuacct 2>&1 1> $TMP/tempresult + if [ $? = 0 ]; then + # User filled out the form, so let's get the results for + # UFULLNAME, UACCOUNT and USHELL: + source $TMP/tempresult + rm -f $TMP/tempresult + # Set a password for the new account: + UPASS=$(SeTupass $UACCOUNT) + # Create the account and set the password: + chroot ${T_PX} /usr/sbin/useradd -c "$UFULLNAME" -g users -G wheel,audio,cdrom,floppy,plugdev,video,power,netdev,lp,scanner,kmem,dialout,games,disk,input -u 1000 -d /home/${UACCOUNT} -m -s ${USHELL} ${UACCOUNT} + echo "${UACCOUNT}:${UPASS}" | chroot ${T_PX} /usr/sbin/chpasswd + unset UPASS + + # Configure suauth: + cat <${T_PX}/etc/suauth +root:${UACCOUNT}:OWNPASS +root:ALL EXCEPT GROUP wheel:DENY +EOT + chmod 600 ${LIVE_ROOTDIR}/etc/suauth + + # Configure sudoers: + chmod 640 ${T_PX}/etc/sudoers + sed -i ${T_PX}/etc/sudoers -e 's/# *\(%wheel\sALL=(ALL)\sALL\)/\1/' + chmod 440 ${T_PX}/etc/sudoers + fi # End user creation + # --------------------------- + + if [ "$(cat $T_PX/etc/shadow | grep 'root:' | cut -f 2 -d :)" = "" ]; then + # There is no root password yet: + UPASS=$(SeTupass root) + echo "root:${UPASS}" | chroot ${T_PX} /usr/sbin/chpasswd + unset UPASS + fi + + cat << EOF > $TMP/tempmsg + + @CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive! + We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available). + The following configuration was copied from the Live OS to your harddisk: + - console font + - default runlevel + - keyboard layout + - language setting + After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this: + # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz + +EOF + dialog --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ + --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ + 20 65 + rm $TMP/tempmsg + + MAINSELECT="CONFIGURE" + } # END live_post_install() function + + + if [ -f /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@ ]; then + # If the setup2hd post-configuration file exists, source it. + # The file should re-define the live_post_install() function. + . /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@ + fi + + # Now, execute the function - either our own built-in version + # or the re-defined function from the custom setup2hd.@DISTRO@ file. + live_post_install + + # --------------------------------------------- # + # Slackware Live Edition - end install to disk: # + # --------------------------------------------- # + + fi + # End liveslak installation routine. diff --git a/setup2hd/setup.slackware.tpl b/setup2hd/setup.slackware.tpl new file mode 100644 index 0000000..9461d90 --- /dev/null +++ b/setup2hd/setup.slackware.tpl @@ -0,0 +1,155 @@ + # 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 "\ +\n\ +Before you can install software, complete the following tasks:\n\ +\n\ +1. Select your source media.\n\ +2. Set up your target Linux partition(s).\n\ +3. Select which software categories to install.\n\ +\n\ +You may also optionally remap your keyboard and set up your\n\ +swap partition(s). \n\ +\n\ +Press ENTER to return to the main menu." 16 68 + continue + fi + SERIES="`cat $TMP/SeTSERIES`" + SOURCE_DEVICE="`cat $TMP/SeTsource`" + IGNORE_TAGFILES="" + while [ 0 ]; do + 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' \ +mode provides the most information but is much more time-consuming \ +(presenting the packages one by one) than the menu-based choices. \ +Otherwise, you can pick packages from menus \ +using 'expert' or 'menu' mode. Which type of prompting would you like \ +to use?" \ + 20 76 7 \ + "full" "Install everything (9+ GB of software, RECOMMENDED!)" \ + "terse" "Like 'full', but display one line per package during install" \ + "menu" "Choose individual packages from interactive menus" \ + "expert" "This is actually the same as the \"menu\" option" \ + "newbie" "Use verbose prompting (the X series takes one year)" \ + "custom" "Use custom tagfiles in the package directories" \ + "tagpath" "Use tagfiles in the subdirectories of a custom path" \ + "help" "Read the prompt mode help file" 2> $TMP/SeTpmode + if [ ! $? = 0 ]; then + rm -f $TMP/SeTpmode + exit + fi + 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 + fi + if [ "$MODE" = "tagpath" ]; then + 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 \ +could create a /tagfiles directory and mount a floppy disk containing \ +the tagfiles on that directory. Then you'd enter '/tagfiles' at the \ +prompt below. The setup program will look for your tagfile in \ +SUBDIRECTORIES of the path you provide, such as /tagfiles/a, \ +/tagfiles/ap, /tagfiles/d, and so on. You only need to provide a \ +subdirectory and tagfile for the first disk of each series to be \ +installed. If a custom tagfile is not found at the path you provide, \ +setup will revert to the default tagfiles. Please enter the path to your \ +custom tagfiles:" \ + 19 71 2> $TMP/SeTtagpath + if [ ! $? = 0 ]; then + continue + fi + if [ -r $TMP/SeTtagpath ]; then + if [ "`cat $TMP/SeTtagpath`" = "" ]; then + rm -f $TMP/SeTtagpath + elif [ ! -d "$(cat $TMP/SeTtagpath)" ]; then + 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 + rm -f $TMP/SeTtagpath + continue + fi + fi + break; + fi + if [ "$MODE" = "newbie" ]; then + 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 \ +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. :^)" \ +12 60 2> $TMP/SeTtagext + if [ ! $? = 0 ]; then + continue + fi + if [ -r $TMP/SeTtagext ]; then + if [ "`cat $TMP/SeTtagext`" = "" ]; then + rm -f $TMP/SeTtagext + fi + fi + 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 \ +packages without prompting." 4 45 + break; + fi + if [ "$MODE" = "terse" ]; then + setterm -background cyan -foreground black -blank 0 + clear + IGNORE_TAGFILES="-ignore_tagfiles" + echo + echo + echo "Full (terse display) installation mode." + echo + echo "A one-line description will be displayed as each package is installed." + echo + break; + fi + if [ "$MODE" = "menu" ]; then + 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 \ +to choose packages individually." 4 60 + break; + fi + done + export MAKETAG; + sleep 1 + # On a new system, make /etc/mtab a symlink to /proc/mounts: + if [ ! -r $T_PX/etc/mtab ]; then + mkdir -p $T_PX/etc + ( cd $T_PX/etc ; ln -sf /proc/mounts mtab ) + fi + # Do the package install: + if [ -r $TMP/SeTCDdev ]; then # only try to remount media if it's a CD/DVD + slackinstall --device `cat $TMP/SeTCDdev` --promptmode $MODE --srcpath `cat $TMP/SeTDS` --mountpoint /var/log/mount --target $T_PX --series $SERIES + elif [ -r $TMP/SeTremotesvr ]; then + slackinstall --device noremount --promptmode $MODE --srcpath `cat $TMP/SeTDS` --mountpoint /var/log/mount --target $T_PX --series $SERIES --net `cat $TMP/SeTremotesvr` + else + slackinstall --device noremount --promptmode $MODE --srcpath `cat $TMP/SeTDS` --mountpoint /var/log/mount --target $T_PX --series $SERIES + fi + if [ $MODE = terse ]; then + # Let's pause a moment and then restore the terminal settings + sleep 1 + setterm -background black -foreground white -blank 0 + fi + MAINSELECT="CONFIGURE" + fi + # End Slackware installation routine. -- cgit v1.2.3