diff options
-rwxr-xr-x | make_slackware_live.sh | 37 | ||||
-rwxr-xr-x | setup2hd | 363 |
2 files changed, 399 insertions, 1 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh index e76549c..abd1e97 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -1016,9 +1016,44 @@ fi # Add our scripts to the Live OS: mkdir -p ${LIVE_ROOTDIR}/usr/local/sbin install -m0755 ${LIVE_TOOLDIR}/makemod ${LIVE_TOOLDIR}/iso2usb.sh ${LIVE_ROOTDIR}/usr/local/sbin/ -# And the documentation: + +# 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 [ -f ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* ]; then + # 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} + cd ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN} + gunzip -cd ${SL_PKGROOT}/../isolinux/initrd.img | cpio -i -d -H newc --no-absolute-filenames usr/lib/setup/* sbin/probe sbin/fixdate + mv -i usr/lib/setup/* sbin/probe . + rm -r usr sbin + cd - + # Fix some occurrences of '/mnt' that should not be used in the Live ISO: + sed -i -e 's, /mnt, ${T_PX},g' -e 's,T_PX=/mnt,T_PX=/setup2hd,g' ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* + # Fix some occurrences of '/usr/lib/setup/' 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: + mkdir -p ${LIVE_ROOTDIR}/usr/local/sbin + cat ${LIVE_TOOLDIR}/setup2hd | sed \ + -e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \ + -e "s/@KVER@/$KVER/g" \ + -e "s/@LIVEDE@/$LIVEDE/g" \ + -e "s/@LIVEMAIN@/$LIVEMAIN/g" \ + -e "s/@SL_VERSION@/$SL_VERSION/g" \ + -e "s/@VERSION@/$VERSION/g" \ + > ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd + chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd +fi + +# Add the documentation: mkdir -p ${LIVE_ROOTDIR}/usr/doc/liveslak-${VERSION} install -m0644 ${LIVE_TOOLDIR}/README* ${LIVE_ROOTDIR}/usr/doc/liveslak-${VERSION}/ +mkdir -p ${LIVE_ROOTDIR}/usr/doc/slackware${DIRSUFFIX}-${SL_VERSION} +install -m0644 \ + ${DEF_SL_REPO}/slackware${DIRSUFFIX}-${SL_VERSION}/{CHANGES_AND_HINTS,COPY,README,RELEASE_NOTES,Slackware-HOWTO}* \ + ${DEF_SL_REPO}/slackware${DIRSUFFIX}-${SL_VERSION}/usb-and-pxe-installers/README* \ + ${LIVE_ROOTDIR}/usr/doc/slackware${DIRSUFFIX}-${SL_VERSION}/ # -------------------------------------------------------------------------- # echo "-- Configuring the X base system." diff --git a/setup2hd b/setup2hd new file mode 100755 index 0000000..9f6df9e --- /dev/null +++ b/setup2hd @@ -0,0 +1,363 @@ +#!/bin/sh +# +# Copyright 1993,1994,1999 Patrick Volkerding, Moorhead, Minnesota USA +# Copyright 2001, 2003, 2004 Slackware Linux, Inc., Concord, CA +# Copyright 2006, 2007 Patrick Volkerding, Sebeka, Minnesota USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# As always, bug reports, suggestions, etc: volkerdi@slackware.com +# +# Modifications 2016 by Eric Hameleers <alien@slackware.com> +# +if [ ! -d /mnt/livemedia/@LIVEMAIN@/system ]; then + dialog --title "LIVE MEDIA NOT ACCESSIBLE" --msgbox "\ +\n\ +Before you can install software, complete the following tasks:\n\ +\n\ +1. Mount your Live media partition on /mnt/livemedia." 16 68 + exit 1 +fi +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +rm -f $TMP/SeT* +# If a keymap was set up, restore that data: +if [ -r $TMP/Pkeymap ]; then + cp $TMP/Pkeymap $TMP/SeTkeymap +fi +echo "on" > $TMP/SeTcolor # turn on color menus +PATH="$PATH:/usr/share/@LIVEMAIN@" +export PATH; +export COLOR=on +#echo +#echo +#echo "Probing disk partitions. (Hint: if your ATAPI CD-ROM causes timeouts" +#echo "during the probe process, try hitting the eject button)" +#echo +#sleep 5 +# +# Before probing, activate any LVM partitions +# that may exist from before the boot: +vgchange -ay 1> /dev/null 2> /dev/null +if probe -l 2> /dev/null | grep -E 'Linux$' 1> /dev/null 2> /dev/null ; then + probe -l 2> /dev/null | grep -E 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null +else + dialog --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. \ +To do this, you'll need to leave 'setup', and make the partitions using \ +'cfdisk' (MBR partitions) or 'cgdisk' (GPT partitions). For more \ +information, read the 'setup' help file from the next menu." 10 64 +fi +if [ -d /sys/firmware/efi ]; then + if ! probe -l 2> /dev/null | grep "EFI System Partition" 1> /dev/null 2> /dev/null ; then + dialog --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 \ +to boot from the hard drive. To do this, leave 'setup', and \ +use 'cgdisk' to make a 100MB partition of type EF00. For more information, \ +read the 'setup' help file from the next menu." 10 64 + fi +fi +T_PX="/setup2hd" +mkdir -p ${T_PX} +echo "$T_PX" > $TMP/SeTT_PX +ROOT_DEVICE="`mount | grep "on / " | cut -f 1 -d ' '`" +echo "$ROOT_DEVICE" > $TMP/SeTrootdev +if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then # clear source + umount /var/log/mount # location +fi +# Anything mounted on /var/log/mount now is a fatal error: +if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then + echo "Can't umount /var/log/mount. Reboot machine and run setup again." + exit +fi +# If the mount table is corrupt, the above might not do it, so we will +# try to detect Linux and FAT32 partitions that have slipped by: +if [ -d /var/log/mount/lost+found -o -d /var/log/mount/recycled \ + -o -r /var/log/mount/io.sys ]; then + echo "Mount table corrupt. Reboot machine and run setup again." + exit +fi +rm -f /var/log/mount 2> /dev/null +rmdir /var/log/mount 2> /dev/null +mkdir /var/log/mount 2> /dev/null + +while [ 0 ]; do + + dialog --title "Slackware Linux Setup (version current)" \ +--menu \ +"Welcome to Slackware 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 \ +"HELP" "Read the Slackware Setup HELP file" \ +"KEYMAP" "Remap your keyboard if you're not using a US one" \ +"ADDSWAP" "Set up your swap partition(s)" \ +"TARGET" "Set up your target partitions" \ +"INSTALL" "Install Slackware Live to disk" \ +"CONFIGURE" "Reconfigure your Linux system" \ +"EXIT" "Exit Slackware Linux Setup" 2> $TMP/hdset + if [ ! $? = 0 ]; then + rm -f $TMP/hdset $TMP/SeT* + exit + fi + MAINSELECT="`cat $TMP/hdset`" + rm $TMP/hdset + + # Start checking what to do. Some modules may reset MAINSELECT to run the + # next item in line. + + if [ "$MAINSELECT" = "HELP" ]; then + SeTfdHELP + fi + + 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 + MAINSELECT="TARGET" + elif [ -r $TMP/SeTswapskip ]; then + # Go ahead to TARGET without swap space: + MAINSELECT="TARGET" + fi + fi + + if [ "$MAINSELECT" = "TARGET" ]; then + SeTpartitions + SeTEFI + SeTDOS + if [ -r $TMP/SeTnative ]; then + MAINSELECT="INSTALL" + fi + fi + + if [ "$MAINSELECT" = "INSTALL" ]; then + if [ ! -r $TMP/SeTnative ]; then + dialog --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: # + # --------------------------------------------- # + + 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_MODS=0 + let DU_MODS=DU_MODS+$(du -s /mnt/livemedia/@LIVEMAIN@/system/ |tr -s '\t' ' ' |cut -f1 -d' ') + let DU_MODS=DU_MODS+$(du -s /mnt/livemedia/@LIVEMAIN@/addons/ |tr -s '\t' ' ' |cut -f1 -d' ') + let DU_MODS=DU_MODS+$(du -s /mnt/livemedia/@LIVEMAIN@/optional/ |tr -s '\t' ' ' |cut -f1 -d' ') + ( + GAUGE=0 + NUM_MOD=0 + SIZ_MOD=0 + + # Take all modules mounted in the Live OS, and install them in that order: + for LIVE_MOD_BASE in $(ls -rt --indicator-style=none /mnt/live/modules/) ; do + # Do not install 0099-slackware_zzzconf-*.sxz: + if echo ${LIVE_MOD_BASE} |grep -q "zzzconf" ; then + continue + fi + # Could be system, addons or optional: + LIVE_MOD=$(find /mnt/livemedia/@LIVEMAIN@/ -type f -name ${LIVE_MOD_BASE}.sxz) + echo "XXX" + echo "$GAUGE" + echo "" + echo "Processed ${NUM_MOD} of ${TOT_MODS} Slackware Live modules ($(( $SIZ_MOD/1024 )) of $(( $DU_MODS/1024 )) MB)\nProcessing ${LIVE_MOD_BASE} ..." + echo "XXX" + unsquashfs -f -dest $T_PX ${LIVE_MOD} 1>>$TMP/unsquash_output 2>>$TMP/unsquash_error + let NUM_MOD=NUM_MOD+1 + let SIZ_MOD=SIZ_MOD+$(du -s $LIVE_MOD |tr -s '\t' ' ' |cut -f1 -d' ') + GAUGE=$(( (100 * ${SIZ_MOD})/${DU_MODS} )) + echo "$GAUGE" + done + ) | dialog --title "INSTALLING SLACKWARE @LIVEDE@ LIVE TO DISK" --gauge \ + "\nProcessing ${TOT_MODS} Slackware Live modules..." 8 65 + + # Short intermezzo: + dialog --title "POST-INSTALL SLACKWARE @LIVEDE@ LIVE DATA" --infobox \ + "\nCopying Live modifications to hard disk ..." 5 65 + # Pick the goodies from 0099-slackware_zzzconf-*.sxz: + unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz /etc/slackpkg /etc/X11/xdm/liveslak-xdm + # 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,' + + cat << EOF > $TMP/tempmsg + + Slackware @LIVEDE@ Live Edition has been installed to your hard drive! + We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available). + 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/some_module.sxz + +EOF + dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ + 17 65 + rm $TMP/tempmsg + + # --------------------------------------------- # + # Slackware Live Edition - end install to disk: # + # --------------------------------------------- # + + MAINSELECT="CONFIGURE" + fi + + if [ "$MAINSELECT" = "CONFIGURE" ]; then + SeTconfig + 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 \ +/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 \ +to replace your old /etc/fstab with the new one?" 10 58 + if [ ! $? = 0 ]; then + REPLACE_FSTAB=N + fi + fi + if [ "$REPLACE_FSTAB" = "Y" ]; then + cat /dev/null > $T_PX/etc/fstab + if [ -r $TMP/SeTswap ]; then + cat $TMP/SeTswap > $T_PX/etc/fstab + fi + cat $TMP/SeTnative >> $T_PX/etc/fstab + if [ -r $TMP/SeTDOS ]; then + cat $TMP/SeTDOS >> $T_PX/etc/fstab + fi + 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 + fi + dialog --title "SETUP COMPLETE" --msgbox "System configuration \ +and installation is complete. \ +\n\nYou may now reboot your system." 7 55 + fi + fi + + if [ "$MAINSELECT" = "EXIT" ]; then + break + fi + +done # end of main loop +sync + +chmod 755 $T_PX +if [ -d $T_PX/tmp ]; then + chmod 1777 $T_PX/tmp +fi +if mount | grep /var/log/mntiso 1> /dev/null 2> /dev/null ; then + umount -f /var/log/mntiso +fi +if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then + umount /var/log/mount +fi +# Anything mounted on /var/log/mount now is a fatal error: +if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then + exit +fi +# If the mount table is corrupt, the above might not do it, so we will +# try to detect Linux and FAT32 partitions that have slipped by: +if [ -d /var/log/mount/lost+found -o -d /var/log/mount/recycled \ + -o -r /var/log/mount/io.sys ]; then + exit +fi +rm -f /var/log/mount 2> /dev/null +rmdir /var/log/mount 2> /dev/null +mkdir /var/log/mount 2> /dev/null +chmod 755 /var/log/mount + +# An fstab file is indicative of an OS installation, rather than +# just loading the "setup" script and selecting "EXIT" +if [ -f ${T_PX}/etc/fstab ]; then + # umount CD: + if [ -r $TMP/SeTCDdev ]; then + if mount | grep iso9660 > /dev/null 2> /dev/null ; then + umount `mount | grep iso9660 | cut -f 1 -d ' '` + fi + eject -s `cat $TMP/SeTCDdev` + # Tell the user to remove the disc, if one had previously been mounted + # (it should now be ejected): + dialog \ + --clear \ + --title "Slackware Linux Setup is complete" "$@" \ + --msgbox "\nPlease remove the installation disc.\n" 7 40 + fi + # Offer to reboot or drop to shell: + dialog \ + --title "Slackware Linux Setup is complete" "$@" \ + --yesno \ + "\nWould you like to reboot your system?\n\n\n\ +If you choose \"No\", you will be dropped to a shell.\n" 11 50 + retval=$? + if [ $retval = 1 ]; then + clear + echo + echo "You may now reboot your system once you are ready." + echo "You can issue the 'reboot' command; or if your system has" + echo "a keyboard attached, you can use the key combination: control+alt+delete" + echo + else + touch /reboot + fi +fi + +# Fix the date: +fixdate + +# final cleanup +rm -f $TMP/tagfile $TMP/SeT* $TMP/tar-error $TMP/unsquash_output $TMP/unsquash_error $TMP/PKGTOOL_REMOVED +rm -f /var/log/mount/treecache +rmdir /var/log/mntiso 2>/dev/null +rm -rf $TMP/treecache +rm -rf $TMP/pkgcache +rmdir ${T_PX}/tmp/orbit-root 2> /dev/null + +# If the OS had been installed and the user elected to reboot: +if [ -f /reboot ]; then + clear + echo "** Starting reboot **" + sleep 1 + reboot +fi + +# end slackware setup script |