diff options
author | Eric Hameleers <alien@slackware.com> | 2020-10-24 22:29:54 +0200 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2020-10-24 22:29:54 +0200 |
commit | 3bb48a9c945dbafbbc912ef8d65234d88cb65794 (patch) | |
tree | 63ce1d983031b5a8bb8371bc690c689acac39ed4 /setup2hd | |
parent | 2e29bd396c899fdf2e99504c37c993d4576b8244 (diff) | |
download | liveslak-3bb48a9c945dbafbbc912ef8d65234d88cb65794.tar.gz liveslak-3bb48a9c945dbafbbc912ef8d65234d88cb65794.tar.xz |
setup2hd fixes and enhancements
DAW configuration is now properly copied
Extracting the Live OS to hard disk is roughly 10 times faster now,
after abandoning the fancy progress bar and just showing the rsync status.
Use an enhanced Slackware SeTpasswd to add a non-root user and set
the root password.
Various syntax and logic errors removed.
Diffstat (limited to 'setup2hd')
-rw-r--r-- | setup2hd/SeTpasswd.tpl (renamed from setup2hd/SeTpasswd) | 42 | ||||
-rw-r--r-- | setup2hd/SeTuacct.tpl | 20 | ||||
-rw-r--r-- | setup2hd/SeTumedia.tpl | 6 | ||||
-rw-r--r-- | setup2hd/SeTupass.tpl | 6 | ||||
-rw-r--r-- | setup2hd/setup.liveslak.tpl | 41 |
5 files changed, 66 insertions, 49 deletions
diff --git a/setup2hd/SeTpasswd b/setup2hd/SeTpasswd.tpl index 4208306..04d7c8c 100644 --- a/setup2hd/SeTpasswd +++ b/setup2hd/SeTpasswd.tpl @@ -1,18 +1,39 @@ +#!/bin/sh # Liveslak replacement for Slackware's SeTpassword script. +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +T_PX="$(cat $TMP/SeTT_PX)" + +# Check for root password: +if [ "$(cat $T_PX/etc/shadow | grep 'root:' | cut -f 2 -d :)" != "" ]; then + # Root password has been set, nothing further to be done. + exit 0 +fi + +# No root password has been set yet, which means no user was created either. + # Set up a user account, +if [ -r $TMP/SeTlive ]; then + # We will only configgure su access when installing a Live OS: + SUTEXT="\nYour account will be added to sudoers and suauth." +else + SUTEXT="" +fi 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\ -After that, you will be asked to set the root password." 9 55 +and set its password.${SUTEXT}\n\n\ +After that, you will be asked to set the root password." 11 55 # This will set UFULLNAME, UACCOUNT and USHELL variables: -SeTuacct 2>&1 1> $TMP/tempresult +SeTuacct 2>&1 1> $TMP/temppasswd if [ $? = 0 ]; then # User filled out the form, so let's get the results for # UFULLNAME, UACCOUNT, UACCTNR and USHELL: - source $TMP/tempresult - rm -f $TMP/tempresult + source $TMP/temppasswd + rm -f $TMP/temppasswd # Set a password for the new account: UPASS=$(SeTupass $UACCOUNT) # Create the account and set the password: @@ -21,10 +42,7 @@ if [ $? = 0 ]; then unset UPASS fi # End user creation -# Check for root password: -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 +# Finally, set the root password: +UPASS=$(SeTupass root) +echo "root:${UPASS}" | chroot ${T_PX} /usr/sbin/chpasswd +unset UPASS diff --git a/setup2hd/SeTuacct.tpl b/setup2hd/SeTuacct.tpl index 5024f5d..e07564f 100644 --- a/setup2hd/SeTuacct.tpl +++ b/setup2hd/SeTuacct.tpl @@ -1,21 +1,21 @@ #!/bin/sh -#TMP=/var/log/setup/tmp -TMP=/tmp +TMP=/var/log/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP fi +T_PX="$(cat $TMP/SeTT_PX)" freeuid() { # Get the first free UIDNumber after 999: - local UIDS=$( cat ${T_PX}/etc/passwd | cut -d: -f3 | sort -n ) - local UID=999 + local LUIDS=$( cat ${T_PX}/etc/passwd | cut -d: -f3 | sort -n ) + local LUID=999 while true; do - UID=$(( $UID + 1)) - if ! echo $UIDS | grep -F -q -w "$UID"; then + LUID=$(( $LUID + 1)) + if ! echo $LUIDS | grep -F -q -w "$LUID"; then break; fi done - echo $UID + echo $LUID } FREEUID="$(freeuid)" @@ -33,14 +33,14 @@ while [ 0 ]; do "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 + 2>&1 1> $TMP/tempuacct iii=0 declare -a USERATTR while read LINE ; do USERATTR[$iii]="$LINE" iii=$(expr $iii + 1) - done < $TMP/tempresult - rm -f $TMP/tempresult + done < $TMP/tempuacct + rm -f $TMP/tempuacct UFULLNAME="${USERATTR[0]}" UACCOUNT="${USERATTR[1]}" UACCTNR="${USERATTR[2]}" diff --git a/setup2hd/SeTumedia.tpl b/setup2hd/SeTumedia.tpl index 9a68eaf..f14e37c 100644 --- a/setup2hd/SeTumedia.tpl +++ b/setup2hd/SeTumedia.tpl @@ -8,9 +8,9 @@ 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" \ +"1" "Install Slackware from NFS (Network File System)" \ +"2" "Install Slackware from FTP/HTTP server" \ +"3" "Install Slackware from Samba share" \ "4" "Install @UDISTRO@ (@LIVEDE@) Live OS to disk" \ 2> $TMP/media if [ ! $? = 0 ]; then diff --git a/setup2hd/SeTupass.tpl b/setup2hd/SeTupass.tpl index ff662ab..8cbadea 100644 --- a/setup2hd/SeTupass.tpl +++ b/setup2hd/SeTupass.tpl @@ -16,14 +16,14 @@ UACCOUNT="$1" 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 + 2>&1 1> $TMP/tempupass iii=0 declare -a USERATTR while read LINE ; do USERATTR[$iii]="$LINE" iii=$(expr $iii + 1) - done < $TMP/tempresult - rm -f $TMP/tempresult + done < $TMP/tempupass + rm -f $TMP/tempupass UPASS1="${USERATTR[0]}" UPASS2="${USERATTR[1]}" unset USERATTR diff --git a/setup2hd/setup.liveslak.tpl b/setup2hd/setup.liveslak.tpl index 5b6e65a..ce99461 100644 --- a/setup2hd/setup.liveslak.tpl +++ b/setup2hd/setup.liveslak.tpl @@ -48,13 +48,12 @@ Press ENTER to return to the main menu." 16 68 ( # 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/' + 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" --gauge \ - "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 65 + --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --programbox \ + "\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 80 # # Live OS Post Install routine. If you want, you can override this routine @@ -69,14 +68,14 @@ Press ENTER to return to the main menu." 16 68 --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\ -After that, you will be asked to set the root password." 9 55 +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/tempresult + SeTuacct 2>&1 1> $TMP/uacctresult if [ $? = 0 ]; then # User filled out the form, so let's get the results for # UFULLNAME, UACCOUNT, UACCTNR and USHELL: - source $TMP/tempresult - rm -f $TMP/tempresult + source $TMP/uacctresult + rm -f $TMP/uacctresult # Set a password for the new account: UPASS=$(SeTupass $UACCOUNT) # Create the account and set the password: @@ -116,11 +115,11 @@ EOT 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 \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /etc/rc.d/rc.keymap fi - unsquashfs -f -dest $T_PX \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /etc/X11/xinit/xinitrc \ /etc/X11/xdm/liveslak-xdm \ @@ -134,13 +133,13 @@ EOT /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,' - # Prevent Slackware's SeTconfig from asking redundant questions later on: - sed -i ${T_PX}/usr/lib/setup/SeTconfig \ + # Prevent SeTconfig from asking redundant questions later on: + sed -i ${T_PX}/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: if [ -n "${UACCOUNT}" ] && [ -d "${T_PX}/home/${UACCOUNT}" ]; then - unsquashfs -f -dest $T_PX \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /home/@LIVEUID@/.face \ /home/@LIVEUID@/.face.icon @@ -153,7 +152,7 @@ EOT # If the Live OS is real-time capable we need to apply that to the install: if [ "@LIVEDE@" = "PLASMA5" -o "@LIVEDE@" = "DAW" -o "@LIVEDE@" = "STUDIOWARE" ]; then - unsquashfs -f -dest $T_PX \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /etc/security/limits.d/rt_audio.conf \ /etc/initscript \ @@ -165,7 +164,7 @@ then if [ "@LIVEDE@" = "DAW" ]; then LCLIVEDE=$(echo @LIVEDE@ |tr 'A-Z' 'a-z') - unsquashfs -f -dest $T_PX \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /etc/pulse/daemon.conf \ /etc/xdg/menus/applications-merged/liveslak-daw.menu \ @@ -179,12 +178,12 @@ then # If a user account was created, we restore DAW user customization: if [ -n "${UACCOUNT}" ] && [ -d "${T_PX}/home/${UACCOUNT}" ]; then - unsquashfs -f -dest $T_PX \ + unsquashfs -n -f -dest $T_PX \ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \ /home/@LIVEUID@/.jackdrc \ - /home/${LIVEUID}/.config/autostart/qjackctl.desktop \ - /home/${LIVEUID}/.config/rncbc.org/QjackCtl.conf \ - /home/${LIVEUID}/.config/kscreenlockerrc + /home/@LIVEUID@/.config/autostart/qjackctl.desktop \ + /home/@LIVEUID@/.config/rncbc.org/QjackCtl.conf \ + /home/@LIVEUID@/.config/kscreenlockerrc if [ "@LIVEUID@" != ${UACCOUNT} ]; then rsync -a $T_PX/home/@LIVEUID@/ $T_PX/home/${UACCOUNT}/ rm -rf $T_PX/home/@LIVEUID@ |