diff options
Diffstat (limited to 'source/installer/sources/initrd/usr/lib/setup')
35 files changed, 5043 insertions, 0 deletions
diff --git a/source/installer/sources/initrd/usr/lib/setup/FDhelp b/source/installer/sources/initrd/usr/lib/setup/FDhelp new file mode 100644 index 00000000..1c06d34e --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/FDhelp @@ -0,0 +1,256 @@ + +Slackware Linux Help +____________________ + +First, a little help on help. Whenever you encounter a text +viewer like this during the installation, you can move around +with these commands: + +PGDN/SPACE - Move down one page +PGUP/'b' - Move up one page +ENTER/DOWN/'j' - Move down one line +UP/'k' - Move up one line +LEFT/'h' - Scroll left +RIGHT/'l' - Scroll right +'0' - Move to beginning of line +HOME/'g' - Move to beginning of file +END/'G' - Move to end of file +'/' - Forward search +'?' - Backward search +'n' - Repeat last search (forward) + +Also, you're running a real multitasking operating system now, so +you're not confined to the installation program. You can log into +other consoles and look around at any time without disturbing the +installation process. To do this, you need to learn the commands +that control the Linux console. You'll use these commands all the +time when you're logged into Linux. + +"Virtual" consoles and scrollback: + +Right now, the screen you're looking at is probably VIRTUAL CONSOLE +NUMBER ONE, (or /dev/tty1 in Linux-speak). There are usually +several virtual consoles available. When you log into the install +disk, there are four consoles. To switch among them, use Alt-F1, +Alt-F2, Alt-F3, or Alt-F4 to select which of the four consoles you +wish to use. While you're using a console, you get a small amount +of text scrollback buffer. To scroll the console back, hold down +the right shift key and hit PageUp. To scroll the console forward, +hit PageDown while holding the right shift key down. This can be +especially useful for reading the boot messages, which can go by +too fast to read otherwise. + +On the install disk, the first three consoles are login consoles. +The fourth console is used to show informational messages during +installation, such as disk formatting status, kernel messages, and +so on. + +A useful trick is to log into the second virtual console during the +installation. Then you can use commands such as 'df' to check how +full your hard drive is getting. Also, once the Slackware CD-ROM +has been mounted on /cdrom, most of the commands in the disc's live +filesystem will be usable. + + +PARTITIONING YOUR DRIVE (MBR SYSTEMS) + +If you have a newer machine that uses GPT (all UEFI machines do), +or you wish to use GPT, skip to the section below on GPT PARTITIONING. + +Now lets take a look at how you progress through a typical Linux +installation with the Slackware distribution. First, you'll have +to make sure your hard drive has been partitioned to accept Linux. +The setup program does not do this for you. + +You will need at least one type Linux partition, and optionally a +swap partition. In my opinion, (if you have a fair amount of drive +space) it's easiest to manage a system that's partitioned along these +lines (ignoring any Windows or other partitions for the purposes +of this illustration): + + [ 8 gig or more for / ] + [ whatever space users need for /home ] + [ swap space (match the size of your RAM) ] + +Some people like a separate partition for /usr/local, but I find that +I usually regret dividing my free space when I don't have to... the +partition I want to add to is always full that way. :^) Besides, when +the time comes for an operating system upgrade you can always back up +/usr/local regardless of whether it occupies its own partition. In +fact, having a separate /home partition is also optional. Probably the +simplest way to approach things initially is with just a single root +Linux partition, and a swap partition of about 1-2 gigabytes. + +The amount of drive space you'll want to give Linux depends on what +software you plan to install, and how much space you have to spare. +My primary Linux partition is 23 gigabytes. If you've got that +kind of room to spare, it will make it easier to compile and try out +large pieces of software, or to work with large files such as might be +used in desktop publishing or CD-ROM mastering applications. + +The entire Slackware system (everything - all the X servers, Emacs, +the works) will use about 8 gigabytes of hard drive space, +so 10 - 15 gigs is sufficient for a complete installation. + +In the past, I've actually done development work on a single / +partition of 110 MB. (Of course, that was back in the days of Linux +version 0.99p11 or so...) Still, with careful selection you can still +squeeze a small Linux system onto a system, but this is not recommended +for beginners. It's more useful when utilizing Slackware as a base for +an embedded system. Most people should be going a full installation. +It's faster and easier, and less error-prone. + +Partitioning is done with a partitioning tool such as fdisk. There are +two versions of Linux fdisk available now. 'fdisk' is the standard +version, and 'cfdisk' is a friendlier full screen version. Most +people will probably want to use 'cfdisk' now, unless they're used +to the older version (like me). Either one will get the job done. + +Make sure you use Linux fdisk to tag partitions as type 83 (Linux, the +default) or type 82 (Linux swap) so the Slackware setup program will +recognize them. Use the 't' command for that, and 'w' to write out the +changes. + +If you prefer an easy to use graphical partitioning tool, you can make +all your Linux partitions directly from Linux 'cfdisk'. Or you can +make them with the older 'fdisk' using the 'n' command to create a +partition and the 'w' command to write out the changes when you're done. + +By default, 'fdisk' and 'cfdisk' will partition the first hard drive in +your machine, which is /dev/sda. To partition other drives, you'll +have to specify the drive to partition when you start 'cfdisk'. For +example, to partition the second IDE drive: + + # cfdisk /dev/sdb + + +SWAP SPACE + +If your machine doesn't have much memory, you might have already +learned how to activate a swap partition just to make it this far. +Normally you won't need to format or activate your swap space by +hand, but if you're installing on a machine with low memory you will +need to format and activate a swap partition to be able to install. +Once you've made the partition with fdisk, you need to use 'mkswap' +on it, and then activate it with 'swapon'. Checking the partition +table with 'fdisk -l', we see these lines: + + Device Boot Start End Blocks Id System +/dev/sda8 16650 16898 2000061 82 Linux swap + +So, the command to format would be: + + # mkswap /dev/sda8 + # sync + +And to activate it: + + # swapon /dev/sda8 + + +GPT PARTITIONING + +If you have a Windows partition that you'd like to keep and need to make +free space for Linux, boot the machine into Windows. Move the mouse into +the upper right corner, and select the search function (magnifying glass +icon). Enter diskmgmt.msc to start up the Disk Management tool. The disk +partitions will be displayed as a bar chart at the bottom of the window. +Mouse over the main Windows partition (probably the largest NTFS partition) +and right click to bring up a menu. Select "Shrink Volume..." from this +menu. Shrink the partition to make enough free space for Slackware's root, +swap, and other partitions. + +NOTE: Rather than creating true free space, this resizing operation may +leave the extra space in the form of a generic (but allocated) partition. +Take note of the size of the "free space". When it comes time to partition +on Linux, you may need to delete this partition to make actual free space +before you can install. + +If you are installing to a machine that has Windows installed, then you'll +already have an EFI System Partition (this is used to store boot files on +machines that use UEFI). To check this, you can use gdisk. We'll assume +that you'll be installing to /dev/sda. If you'll be installing to some other +device, use that in the command below. + +gdisk -l /dev/sda + +If you see a partition with Code EF00 listed, then you are good to go. +If not, you will need to make one. To do that, use cgdisk: + +cgdisk /dev/sda + +Select the free space from the menu using the up/down keys, and then select +"New" to make a new partition. Hit ENTER to accept the first sector. Then +enter 100M as the partition size. Give the new partition a hex code of EF00. +You make give the partition a name (such as "EFI System Partition"), or just +hit ENTER to use no name. A name is not required. + +At this point, you've got a GPT disk with an EFI System partition (with or +without Windows). The next step is to make the partitions for Linux. If +you're not already in cgdisk, start that up with "cgdisk /dev/sda" (or +whatever your install device is). Start by making a swap partition. A +good rule of thumb is to make the swap partition equal to the amount of RAM +in your machine. So, select the free space again, and then "New". Again, +hit ENTER to accept the default first sector for the new partition. Then, +enter an appropriate size, such as 2G. Enter the hex code for Linux swap, +which is 8200. Give the partition a name if you like. + +Make your root Linux partition (optionally if you leave some space you can make +any additional Linux partitions that you'll need). Select the free space, and +"New". Accept the default first sector by hitting ENTER. To make the +partition use the rest of the disk space, just hit ENTER again when asked for +a size. Or, you may choose a smaller size if you're planning to make more +Linux partitions. Hit ENTER to accept the default hex code, which is for a +Linux filesystem. Name the partition (if you like), or hit ENTER again. + +If you have any more free space and partitions to make, now is the time to +make them. + +When you're done, select "Write" to write the partition table changes to the +disk (verify by typing "yes" when prompted), hit a key to continue, and then +select "Quit" to leave cgdisk. + + +RUNNING THE SETUP PROGRAM + +Setup has quite a few options, which can be slightly confusing the +first time you look at the menu. It's not really that hard, though. +You just need to start at the top of the screen and work towards +the bottom through the menu options. When I install, I usually do +these options in order: + +ADDSWAP (set up my swapspace) +TARGET (set up my Linux/Windows partitions and /etc/fstab) +SOURCE (select the source location for the Slackware Linux + packages) +SELECT (pick the package categories to install) +INSTALL (install the software, generally with "full") +CONFIGURE (configure the newly installed system) + +Note that after I select the SWAP option, setup will allow me to +run through all of the other options without ever returning to the +main menu. + +I hope that these options will be mostly self-explanatory. Just read +the screen carefully as you install and you should do just fine. + + +REMAPPING YOUR KEYBOARD: + +KEYMAP: This option lets you remap your keyboard to one of the many +international maps provided with Linux. If you are using a US +keyboard, you can skip this option. + + +...WHEN YOU'RE DONE: + + +EXIT: This leaves Slackware Linux setup. + + +Have fun installing and running Linux! + +--- +Patrick Volkerding +volkerdi@slackware.com + diff --git a/source/installer/sources/initrd/usr/lib/setup/INCISO b/source/installer/sources/initrd/usr/lib/setup/INCISO new file mode 100755 index 00000000..e34076c0 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INCISO @@ -0,0 +1,31 @@ +# Determine if there is an ISO image to loop-mount: +check_iso_image () { + local IDIR=$1 + local MNTDIR=$2 + [ ! -d $IDIR ] && return 1 + [ -z "$MNTDIR" ] && MNTDIR=/var/log/mount + + IISO=$(ls --indicator-style=none "$IDIR"/slackwar*-install-dvd.iso 2>/dev/null |tail -1) + + if [ -n "$IISO" ]; then + cat << EOF > $TMP/tempmsg + +An ISO image of Slackware's install DVD was found. +Do you want me to mount the ISO image and use this as the package source? + +EOF + dialog --title "USE ISO IMAGE" --yesno "`cat $TMP/tempmsg`" 9 65 + RET=$? + if [ ! $RET = 0 ]; then + rm -f $TMP/tempmsg + return 1 + fi + + rm -f $TMP/tempmsg + umount -f $MNTDIR 2>/dev/null + mkdir -p $MNTDIR + mount -o loop,ro $IISO $MNTDIR + else + return 1 + fi +} diff --git a/source/installer/sources/initrd/usr/lib/setup/INSCD b/source/installer/sources/initrd/usr/lib/setup/INSCD new file mode 100755 index 00000000..42610aa1 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSCD @@ -0,0 +1,270 @@ +#!/bin/sh +# FIXME: UDF fs support? +RDIR=/dev/tty4 +NDIR=/dev/null +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +T_PX="`cat $TMP/SeTT_PX`" +rm -f $TMP/SeTmount $TMP/SeTDS $TMP/SeTCDdev $TMP/reply + +dialog --title "SCANNING FOR CD or DVD DRIVE" --menu \ +"Make sure the Slackware disc is in your CD/DVD drive, \ +and then press ENTER to begin the scanning process. \ +Or, if you'd rather specify the device name manually \ +(experts only), choose that option below." \ +11 72 2 \ +"auto" "Scan for the CD or DVD drive (recommended)" \ +"manual" "Manually specify CD or DVD by device name" \ +2> $TMP/reply +if [ ! -r $TMP/reply ]; then + # cancel or esc + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit +fi + +if [ "`cat $TMP/reply`" = "manual" ]; then + dialog --title "MANUAL CD/DVD DEVICE SELECTION" --menu \ + "Please select your CD/DVD device from the list below. \ +If you don't see your device listed, choose 'custom'. \ +This will let you type in any device name. (and if necessary, \ +will create the device)" \ + 18 70 9 \ + "custom" "Type in the CD or DVD device to use" \ + "/dev/sr0" "First CD/DVD drive" \ + "/dev/sr1" "Second CD/DVD drive" \ + "/dev/sr2" "Third CD/DVD drive" \ + "/dev/sr3" "Fourth CD/DVD drive" \ + "/dev/hdb" "CD/DVD slave on first IDE bus" \ + "/dev/hda" "CD/DVD master on first IDE bus (unlikely)" \ + "/dev/hdc" "CD/DVD master on second IDE bus" \ + "/dev/hdd" "CD/DVD slave on second IDE bus" \ + "/dev/hde" "CD/DVD master on third IDE bus" \ + "/dev/hdf" "CD/DVD slave on third IDE bus" \ + "/dev/hdg" "CD/DVD master on fourth IDE bus" \ + "/dev/hdh" "CD/DVD slave on fourth IDE bus" \ + "/dev/pcd0" "First parallel port ATAPI CD" \ + "/dev/pcd1" "Second parallel port ATAPI CD" \ + "/dev/pcd2" "Third parallel port ATAPI CD" \ + "/dev/pcd3" "Fourth parallel port ATAPI CD" \ + "/dev/aztcd" "Non-IDE Aztech CD/DVD" \ + "/dev/cdu535" "Sony CDU-535 CD/DVD" \ + "/dev/gscd" "Non-IDE GoldStar CD/DVD" \ + "/dev/sonycd" "Sony CDU-31a CD/DVD" \ + "/dev/optcd" "Optics Storage CD/DVD" \ + "/dev/sjcd" "Sanyo non-IDE CD/DVD" \ + "/dev/mcdx0" "Non-IDE Mitsumi drive 1" \ + "/dev/mcdx1" "Non-IDE Mitsumi drive 2" \ + "/dev/sbpcd" "Old non-IDE SoundBlaster CD/DVD" \ + "/dev/cm205cd" "Philips LMS CM-205 CD/DVD" \ + "/dev/cm206cd" "Philips LMS CM-206 CD/DVD" \ + "/dev/mcd" "Old non-IDE Mitsumi CD/DVD" \ + 2> $TMP/reply + if [ ! -r $TMP/reply ]; then + # cancel or esc + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit + fi + REPLY="`cat $TMP/reply`" + if [ "$REPLY" = "custom" ]; then + dialog --title "ENTER CD/DVD DEVICE MANUALLY" --inputbox \ +"Please enter the name of the CD/DVD device (such as /dev/hdc) that \ +you wish to use to mount the Slackware CD/DVD:" \ +9 70 2> $TMP/reply + if [ ! -r $TMP/reply ]; then + # cancel or esc + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit + fi + DRIVE_FOUND="`cat $TMP/reply`" + if [ ! -r $DRIVE_FOUND ]; then # no such device + rm -f $TMP/majorminor + dialog --title "MKNOD CD/DVD DEVICE" --inputbox \ + "There doesn't seem to be a device by the name of $DRIVE_FOUND in the \ +/dev directory, so we will have to create it using the major and minor \ +numbers for the device. If you're using a bootdisk with a custom CD/DVD \ +driver on it, you should be able to find these numbers in the \ +documentation. Also, see the 'devices.txt' file that comes with the \ +Linux kernel source. If you don't know the numbers, you'll have to hit \ +Esc to abort. Enter the major and minor numbers for the new device, \ +separated by one space:" \ + 15 72 2> $TMP/majorminor + if [ ! -r $TMP/majorminor ]; then + # cancel or esc + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit + fi + MAJOR="`cat $TMP/majorminor`" + dialog --title "MAKING DEVICE IN /dev" --infobox \ + "mknod $DRIVE_FOUND b $MAJOR" 3 40 + mknod $DRIVE_FOUND b $MAJOR 2> $RDIR + sleep 1 + if [ ! -r $DRIVE_FOUND ]; then + dialog --title "MKNOD FAILED" --msgbox \ + "Sorry, but the mknod command failed to make the device. You'll need to \ +go back and try selecting your source media again. Press ENTER to abort \ +the source media selection process." 8 60 + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit + fi + fi + else + DRIVE_FOUND=$REPLY + fi +fi + +# Search for SCSI/PATA/SATA CD/DVD drives: +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "SCANNING" --infobox "Scanning for a \ +CD/DVD drive containing a Slackware disc..." 4 50 + sleep 1 + for device in \ + /dev/sr0 /dev/sr1 /dev/sr2 /dev/sr3 \ + ; do + mount -o ro -t iso9660 $device /var/log/mount 1> $RDIR 2> $RDIR + if [ $? = 0 ]; then + DRIVE_FOUND=$device + umount /var/log/mount + break + fi + done +fi + +# Search the old IDE interfaces: +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "SCANNING" --infobox "Scanning for an IDE \ +CD/DVD drive containing a Slackware disc..." 4 56 + sleep 1 + for device in \ + /dev/hdd /dev/hdc /dev/hdb /dev/hda \ + /dev/hde /dev/hdf /dev/hdg /dev/hdh \ + /dev/hdi /dev/hdj /dev/hdk /dev/hdl \ + /dev/hdm /dev/hdn /dev/hdo /dev/hdp \ + ; do + mount -o ro -t iso9660 $device /var/log/mount 1> $RDIR 2> $RDIR + if [ $? = 0 ]; then + DRIVE_FOUND=$device + umount /var/log/mount + break + fi + done +fi + +# Search for parallel port ATAPI CD/DVD drives: +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "SCANNING" --infobox "Scanning for a parallel port \ +ATAPI CD/DVD drive containing a Slackware disc..." 4 52 + sleep 1 + for device in \ + /dev/pcd0 /dev/pcd1 /dev/pcd2 /dev/pcd3 \ + ; do + mount -o ro -t iso9660 $device /var/log/mount 1> $RDIR 2> $RDIR + if [ $? = 0 ]; then + DRIVE_FOUND=$device + umount /var/log/mount + break + fi + done +fi + +# Still not found? OK, we will search for CD/DVD drives on old, pre-ATAPI +# proprietary interfaces. There aren't too many of these still around, and +# the scan won't actually work unless a bootdisk that supports the drive is +# used, and any necessary parameters have been passed to the kernel. +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "SCANNING" --msgbox "No IDE/SCSI drive, so we will try \ +scanning for CD drives on \ +old proprietary interfaces, such as SoundBlaster pre-IDE CD drives, \ +Sony CDU-31a, Sony 535, old Mitsumi pre-IDE, old Optics, etc. For this \ +scan to work at all, you'll need to be using a bootdisk that supports \ +your CD drive. Please press ENTER to begin this last-chance scan \ +for old, obsolete hardware." 11 60 + for device in \ + /dev/sonycd /dev/gscd /dev/optcd /dev/sjcd /dev/mcdx0 /dev/mcdx1 \ + /dev/cdu535 /dev/sbpcd /dev/aztcd /dev/cm205cd /dev/cm206cd \ + /dev/bpcd /dev/mcd \ + ; do + mount -o ro -t iso9660 $device /var/log/mount 1> $RDIR 2> $RDIR + if [ $? = 0 ]; then + DRIVE_FOUND=$device + umount /var/log/mount + break + fi + done +fi + +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "CD/DVD DRIVE NOT FOUND" --msgbox \ + "A CD/DVD drive could not be found on any of the devices that were \ +scanned. Possible reasons include using a bootdisk or kernel that \ +doesn't support your drive, failing to pass parameters needed by some \ +drives to the kernel, not having the Slackware disc in your CD/DVD \ +drive, or using a drive connected to a Plug and Play soundcard (in this \ +case, connecting the drive directly to the IDE interface often helps). \ +Please make sure you are using the correct bootdisk for your hardware, \ +consult the BOOTING file for possible information on \ +forcing the detection of your drive, and then reattempt installation. \ +If all else fails, see FAQ.TXT for information about copying \ +parts of this CD to your DOS partition and installing it from there.\n\ +\n\ +You will now be returned to the main menu. If you want to try looking \ +for the CD again, you may skip directly to the SOURCE menu selection." \ + 0 0 + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit +fi + +while [ 0 ]; do # time to try to mount the CD/DVD device: + mount -o ro -t iso9660 $DRIVE_FOUND /var/log/mount 1> $RDIR 2> $RDIR + if [ $? = 0 ]; then # mounted successfully + dialog --title "CD/DVD DRIVE FOUND" --sleep 1 --infobox \ + "A Slackware disc was found in device $DRIVE_FOUND." 3 52 + break + else # failed to mount + dialog --title "MOUNT ERROR" --menu "There was an error \ +attempting to mount the CD/DVD on $DRIVE_FOUND. \ +Maybe the device name is incorrect, the disc is not in the \ +drive, or the kernel you are using does not support the \ +device. (possibly an incorrect bootdisk) \ +What would you like to do now?" \ + 13 70 3 \ + "1" "Abort CD installation" \ + "2" "Attempt to mount the CD/DVD device again" \ + "3" "Ignore the error and continue" 2> $TMP/errordo + if [ ! $? = 0 ]; then + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit; + fi + DOWHAT="`cat $TMP/errordo`" + rm -f $TMP/errordo + if [ $DOWHAT = 1 ]; then + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev + exit + elif [ $DOWHAT = 2 ]; then + dialog --title "ATTEMPTING TO MOUNT CD/DVD on $DRIVE_FOUND" \ + --infobox "Attempting to mount your CD/DVD again with the \ +following command: mount -o ro -t iso9660 $DRIVE_FOUND \ +/var/log/mount" 4 69 + umount /var/log/mount 1> $NDIR 2> $NDIR + sleep 1 + elif [ $DOWHAT = 3 ]; then + # Ignore error, really bad plan but whatever + break + fi + fi +done +# since we should have mounted successfully, let's refresh +# the link for /dev/cdrom on the target partition: +if [ ! -d $T_PX/dev ]; then + mkdir $T_PX/dev + chown root.root $T_PX/dev + chmod 755 $T_PX/dev +fi +( cd $T_PX/dev ; ln -sf $DRIVE_FOUND cdrom ) + +# Pass information about the source directory to the next install stage: +echo "/var/log/mount/slackware" > $TMP/SeTDS +echo "-source_mounted" > $TMP/SeTmount +echo "$DRIVE_FOUND" > $TMP/SeTCDdev +echo "/dev/null" > $TMP/SeTsource diff --git a/source/installer/sources/initrd/usr/lib/setup/INSNFS b/source/installer/sources/initrd/usr/lib/setup/INSNFS new file mode 100755 index 00000000..a353daa4 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSNFS @@ -0,0 +1,121 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# Include function to check for Slackware ISO images: +. /usr/lib/setup/INCISO +if [ -f $TMP/Punattended ]; then + eval $(grep "^NFS_SERVER=" $TMP/Punattended) + eval $(grep "^NFS_ROOT=" $TMP/Punattended) +fi + +while [ 0 ]; do + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTsource $TMP/nfsout + UPNRUN=`cat $TMP/SeTupnrun 2> /dev/null` + + if [ "$REMOTE_IPADDR" = "" ]; then REMOTE_IPADDR=${NFS_SERVER}; fi + if [ "$REMOTE_PATH" = "" ]; then REMOTE_PATH=${NFS_ROOT}; fi + + cat << EOF > $TMP/tempmsg + +Good! We're all set on the local end, but now we need to know +where to find the software packages to install. First, we need +the IP address of the machine where the Slackware sources are +stored. + +EOF + if [ "$UPNRUN" = "0" ]; then + cat << EOF >> $TMP/tempmsg +Since you're already running on the network, you should be able +to use the hostname instead of an IP address if you wish. + +EOF + fi + echo "What is the IP address of your NFS server? " >> $TMP/tempmsg + dialog --title "ENTER IP ADDRESS OF NFS SERVER" --inputbox \ + "`cat $TMP/tempmsg`" 14 70 $REMOTE_IPADDR 2> $TMP/remote + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/remote + exit + fi + REMOTE_IPADDR="`cat $TMP/remote`" + rm $TMP/remote + + cat << EOF > $TMP/tempmsg + + There must be a directory on the server with the Slackware + packages and files arranged in a tree like the FTP site. + + The installation script needs to know the name of the + directory on your server that contains the series' + subdirectories. For example, if your A series is found at + /slack/slackware/a, then you would respond: /slack/slackware + + What is the Slackware source directory? +EOF + dialog --title "SELECT SOURCE DIRECTORY" --inputbox "`cat $TMP/tempmsg`" 18 \ + 65 $REMOTE_PATH 2> $TMP/slacksrc + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/slacksrc + exit + fi + REMOTE_PATH="`cat $TMP/slacksrc`" + rm $TMP/slacksrc + cat << EOF > $TMP/tempmsg + +In the next screen you should watch for NFS mount errors. +If you see errors and you don't see your NFS server listed, +then try setting up NFS again. + +EOF + dialog --title "NFS MOUNT INFORMATION" --msgbox "`cat $TMP/tempmsg`" 10 65 + rm -f $TMP/tempmsg + touch $TMP/nfsout + if [ ! "$UPNRUN" = "0" ]; then + if [ -x /etc/rc.d/rc.rpc ]; then + echo "Starting RPC services..." >> $TMP/nfsout + /etc/rc.d/rc.rpc restart >> $TMP/nfsout 2>&1 + fi + fi + echo "Mounting $REMOTE_PATH:" >> $TMP/nfsout + echo "mount -r -t nfs -o vers=3 $REMOTE_IPADDR:$REMOTE_PATH /var/log/mount" >> $TMP/nfsout + mount -r -t nfs -o vers=3 $REMOTE_IPADDR:$REMOTE_PATH /var/log/mount + if [ ! $? = 0 ]; then + echo "Didn't work." >> $TMP/nfsout + echo "Maybe you should check that the directory name is correct?" >> $TMP/nfsout + DEFANSW="yes" + else + DEFANSW="no" + fi + echo "" >> $TMP/nfsout + echo "Current NFS mounts:" >> $TMP/nfsout + mount -t nfs >> $TMP/nfsout 2>&1 + echo "" >> $TMP/nfsout + + echo "Do you need to try setting up NFS again?" >> $TMP/nfsout + echo "" >> $TMP/nfsout + if [ "$DEFANSW" = "no" ]; then + dialog --title "NFS MOUNT RESULT" \ + --defaultno --yesno "`cat $TMP/nfsout`" 21 70 + RET=$? + else + dialog --title "NFS MOUNT RESULT" --yesno "`cat $TMP/nfsout`" 21 70 + RET=$? + fi + rm -f $TMP/nfsout + if [ $RET = 1 ]; then + # OK with the NFS mount. + # First, check if a Slackware ISO image is present in /var/log/mount + if check_iso_image /var/log/mount /var/log/mntiso ; then + echo "/var/log/mntiso/slackware" > $TMP/SeTDS + elif [ -r /var/log/mount/slackware/PACKAGES.TXT ]; then + echo "/var/log/mount/slackware" > $TMP/SeTDS + else + echo "/var/log/mount" > $TMP/SeTDS + fi + echo "-source_mounted" > $TMP/SeTmount + echo "/dev/null" > $TMP/SeTsource + break + fi +done diff --git a/source/installer/sources/initrd/usr/lib/setup/INSSMB b/source/installer/sources/initrd/usr/lib/setup/INSSMB new file mode 100755 index 00000000..ae4aac88 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSSMB @@ -0,0 +1,120 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +if [ -f $TMP/Punattended ]; then + eval $(grep "^SMB_SERVER=" $TMP/Punattended) + eval $(grep "^SMB_ROOT=" $TMP/Punattended) +fi + +if [ "$REMOTE_SHARE" = "" ]; then REMOTE_SHARE=${SMB_SERVER}; fi +if [ "$REMOTE_PATH" = "" ]; then REMOTE_PATH=${SMB_ROOT}; fi + +# Load the cifs module: +modprobe cifs 2>/dev/null + +while [ 0 ]; do + rm -f $TMP/SeTDS $TMP/SeTmount + UPNRUN=`cat $TMP/SeTupnrun` + + cat << EOF > $TMP/tempmsg + +Good! We're all set on the local end, but now we need to know +where to find the software packages to install. First, we need +the share address of the Samba server where the Slackware sources +are stored. +Example share address: //192.168.0.1/public + +EOF + if [ "$UPNRUN" = "0" ]; then + cat << EOF >> $TMP/tempmsg +Since you're already running on the network, you should be able +to use the hostname instead of an IP address if you wish. + +EOF + fi + echo "What is the share address of your Samba server? " >> $TMP/tempmsg + dialog --title "ENTER SHARE ADDRESS OF SAMBA SERVER" --inputbox \ + "`cat $TMP/tempmsg`" 15 70 $REMOTE_SHARE 2> $TMP/remote + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/remote + exit + fi + REMOTE_SHARE="`cat $TMP/remote`" + rm $TMP/remote + + cat << EOF > $TMP/tempmsg + + There must be a directory on the server with the Slackware + packages and files arranged in a tree like the FTP site. + + The installation script needs to know the name of the + directory below your Samba share that contains the series + subdirectories. For example, if your A series is found at + /slack/slackware/a, then you would respond: /slack/slackware + + What is the Slackware source directory? +EOF + dialog --title "SELECT SOURCE DIRECTORY" --inputbox "`cat $TMP/tempmsg`" \ + 17 70 $REMOTE_PATH 2> $TMP/slacksrc + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/slacksrc + exit + fi + REMOTE_PATH="`cat $TMP/slacksrc`" + rm $TMP/slacksrc + + echo "You should see no mount errors:" > $TMP/mntout + echo "Mounting $REMOTE_SHARE ..." >> $TMP/mntout + mount -t cifs -o ro,guest,sec=none $REMOTE_SHARE /var/log/mount \ + >> $TMP/mntout 2>&1 + RET=$? + if [ $RET != 0 ]; then + echo "Mount failed." >> $TMP/mntout + umount -f -t cifs /var/log/mount 1>/dev/null 2>&1 + DEFANSW="yes" + else + echo "Mounted Samba share(s):" >> $TMP/mntout + mount -t cifs >> $TMP/mntout 2>/dev/null + echo "" >> $TMP/mntout + if [ -f /var/log/mount/$REMOTE_PATH/a/tagfile \ + -o -f /var/log/mount/$REMOTE_PATH/slackware/a/tagfile ]; + then + echo "A Slackware package tree was found! Ready to continue." >> $TMP/mntout + DEFANSW="no" + else + echo "No Slackware package tree found at the indicated path!" >> $TMP/mntout + DEFANSW="yes" + fi + fi + echo "" >> $TMP/mntout + echo "Do you want to try setting up Samba again?" >> $TMP/mntout + echo "" >> $TMP/mntout + if [ "$DEFANSW" = "no" ]; then + dialog --title "MOUNT RESULT" \ + --defaultno --yesno "`cat $TMP/mntout`" 17 70 + RET=$? + else + dialog --title "MOUNT RESULT" \ + --yesno "`cat $TMP/mntout`" 12 68 + RET=$? + fi + if [ $RET = 1 ]; then + rm -f $TMP/mntout + break + fi + rm -f $TMP/mntout + #if [ "$UPNRUN" = "1" ]; then + # route del $LOCAL_NETWORK + # ifconfig $ENET_DEVICE down + #fi +done + +if [ -f /var/log/mount/$REMOTE_PATH/a/tagfile ]; then + echo "/var/log/mount/$REMOTE_PATH" > $TMP/SeTDS +else + echo "/var/log/mount/${REMOTE_PATH}/slackware" > $TMP/SeTDS +fi +echo "-source_mounted" > $TMP/SeTmount +echo "/dev/null" > $TMP/SeTsource diff --git a/source/installer/sources/initrd/usr/lib/setup/INSURL b/source/installer/sources/initrd/usr/lib/setup/INSURL new file mode 100755 index 00000000..4423406b --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSURL @@ -0,0 +1,241 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +if [ -f $TMP/Punattended ]; then + eval $(grep "^REMOTE_URL=" $TMP/Punattended) + eval $(grep "^REMOTE_PATH=" $TMP/Punattended) +fi + +# Return a package name that has been stripped of the dirname portion +# and any of the valid extensions (only): +pkgbase() { + PKGEXT=$(echo $1 | rev | cut -f 1 -d . | rev) + case $PKGEXT in + 'tgz' ) + PKGRETURN=$(basename $1 .tgz) + ;; + 'tbz' ) + PKGRETURN=$(basename $1 .tbz) + ;; + 'tlz' ) + PKGRETURN=$(basename $1 .tlz) + ;; + 'txz' ) + PKGRETURN=$(basename $1 .txz) + ;; + *) + PKGRETURN=$(basename $1) + ;; + esac + echo $PKGRETURN +} + +package_name() { + STRING=$(pkgbase $1) + # Check for old style package name with one segment: + if [ "$(echo $STRING | cut -f 1 -d -)" = "$(echo $STRING | cut -f 2 -d -)" ]; then + echo $STRING + else # has more than one dash delimited segment + # Count number of segments: + INDEX=1 + while [ ! "$(echo $STRING | cut -f $INDEX -d -)" = "" ]; do + INDEX=$(expr $INDEX + 1) + done + INDEX=$(expr $INDEX - 1) # don't include the null value + # If we don't have four segments, return the old-style (or out of spec) package name: + if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then + echo $STRING + else # we have four or more segments, so we'll consider this a new-style name: + NAME=$(expr $INDEX - 3) + NAME="$(echo $STRING | cut -f 1-$NAME -d -)" + echo $NAME + fi + fi +} + +while [ 0 ]; do + rm -f $TMP/SeTDS $TMP/SeTmount + UPNRUN=$(cat $TMP/SeTupnrun) + + cat << EOF > $TMP/tempmsg + +Good! We're all set on the local end, but now we need to know +where to find the software packages to install. First, we need +the URL of the ftp or http server where the Slackware sources +are stored. +URL examples are: 'ftp://192.168.0.1' ; 'http://172.16.10.31' + +EOF + if [ "$UPNRUN" = "0" ]; then + cat << EOF >> $TMP/tempmsg +Since you're already running on the network, you should be able +to use the hostname instead of an IP address if you wish. + +EOF + fi + echo "What is the URL of your FTP/HTTP server? " >> $TMP/tempmsg + dialog --title "ENTER URL OF FTP/HTTP SERVER" --inputbox \ + "$(cat $TMP/tempmsg)" 15 70 $REMOTE_URL 2> $TMP/remote + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/remote + exit + fi + REMOTE_URL="$(cat $TMP/remote)" + rm $TMP/remote + + cat << EOF > $TMP/tempmsg + + There must be a directory on the server with the Slackware + packages and files arranged in a tree like the FTP site. + + The installation script needs to know the name of the + directory on your server that contains the series + subdirectories. For example, if your A series is found at + /slack/slackware/a, then you would respond: /slack/slackware + + What is the Slackware source directory? +EOF + dialog --title "SELECT SOURCE DIRECTORY" --inputbox "$(cat $TMP/tempmsg)" \ + 17 65 $REMOTE_PATH 2> $TMP/slacksrc + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/slacksrc + exit + fi + REMOTE_PATH="$(cat $TMP/slacksrc)" + rm $TMP/slacksrc + + cat << EOF > $TMP/tempmsg + +In the next screen you should watch for possible errors. + +First, we'll download the PACKAGES.TXT from the parent of the +directory that you entered before (which should be the root +of the remote Slackware tree). If that succeeds, then we use +PACKAGES.TXT to reconstruct a local cache of the package tree +(should take a minute or less on an average system). +After that, we're all set to go! + +Downloading PACKAGES.TXT at the Slackware root starts +after you press OK. +That file is several hundreds of KB in size so it may +take some time to get here... + +EOF + dialog --title "DOWNLOAD INFORMATION" --msgbox "$(cat $TMP/tempmsg)" 20 70 + rm -f $TMP/tempmsg + + REMOTE_ROOT=$(dirname $REMOTE_PATH) + mkdir -p $TMP/treecache 2>/dev/null + chmod 700 $TMP/treecache + rm -rf $TMP/treecache/* 2>/dev/null + ln -sf $TMP/treecache /var/log/mount/ + cd /var/log/mount/treecache + echo "Downloading PACKAGES.TXT ..." >> $TMP/wgetout + echo "URL: $REMOTE_URL$REMOTE_ROOT" > $TMP/wgetout + wget -q $REMOTE_URL$REMOTE_ROOT/PACKAGES.TXT > /dev/null 2>&1 + RET=$? + if [ $RET != 0 ]; then + echo "> Download failed. Going to try one directory lower." >> $TMP/wgetout + REMOTE_ROOT=$REMOTE_PATH + echo "URL: $REMOTE_URL$REMOTE_ROOT" >> $TMP/wgetout + wget -q $REMOTE_URL$REMOTE_ROOT/PACKAGES.TXT > /dev/null 2>&1 + RET=$? + [ $RET != 0 ] && echo "> Download failed again." >> $TMP/wgetout + fi + echo "" >> $TMP/wgetout + + if [ -r /var/log/mount/treecache/PACKAGES.TXT ]; then + if head /var/log/mount/treecache/PACKAGES.TXT | grep -q "PACKAGES.TXT" ; then + echo "A Slackware 'PACKAGES.TXT' is available. Ready to continue!" >> $TMP/wgetout + DEFANSW="no" + fi + else + echo "No file 'PACKAGES.TXT' was found. Wrong URL?" >> $TMP/wgetout + DEFANSW="yes" + fi + echo "" >> $TMP/wgetout + echo "Do you want to try setting up FTP/HTTP again?" >> $TMP/wgetout + echo "" >> $TMP/wgetout + if [ "$DEFANSW" = "no" ]; then + dialog --title "DOWNLOAD RESULT" \ + --defaultno --yesno "$(cat $TMP/wgetout)" 12 68 + RET=$? + else + dialog --title "DOWNLOAD RESULT" \ + --yesno "$(cat $TMP/wgetout)" 12 68 + RET=$? + fi + if [ $RET = 1 ]; then + rm -f $TMP/wgetout + break + fi + rm -f $TMP/wgetout + #if [ "$UPNRUN" = "1" ]; then + # route del $LOCAL_NETWORK + # ifconfig $ENET_DEVICE down + #fi +done + +if [ -r /var/log/mount/treecache/PACKAGES.TXT ]; then + echo "/var/log/mount/treecache/slackware" > $TMP/SeTDS + echo "-source_mounted" > $TMP/SeTmount + echo "/dev/null" > $TMP/SeTsource + echo "${REMOTE_URL},${REMOTE_ROOT}" > $TMP/SeTremotesvr + + dialog --title "INITIALIZING PACKAGE TREE" --infobox \ + "\nSetting up local cache for the FTP/HTTP server's package tree ..." 5 72 + + mkdir slackware isolinux 2>/dev/null + wget -q -P ./isolinux $REMOTE_URL$REMOTE_ROOT/isolinux/setpkg + + # Create a local package tree with zero-byte package placeholders: + TOTALP=$(grep "PACKAGE NAME:" PACKAGES.TXT | wc -l) + ( + NUMPKG=0 + GAUGE=0 + grep "PACKAGE " PACKAGES.TXT | while read REPLY ; do + case "$REPLY" in + "PACKAGE NAME:"*) + TEMP=$(echo $REPLY | cut -d: -f2) + PKGNAME=$(echo $TEMP) + PKGBASE=$(pkgbase $PKGNAME) + PKGSHRT=$(package_name $PKGNAME) + let NUMPKG=NUMPKG+1 + if [ $(( ((100 * $NUMPKG)/$TOTALP)/5 )) -gt $(( $GAUGE/5 )) ]; then + GAUGE=$(( (100 * $NUMPKG)/$TOTALP )) + echo "$GAUGE" + fi + ;; + "PACKAGE LOCATION:"*) + TEMP=$(echo $REPLY | cut -d: -f2) + PKGDIR=$(echo $TEMP) + mkdir -p $PKGDIR + touch ${PKGDIR}/${PKGNAME} + ;; + "PACKAGE SIZE (compressed):"*) + TEMP=$(echo $REPLY | cut -d: -f2) + PKGSIZE=$(echo $TEMP) + echo "$PKGSIZE" 1> ${PKGDIR}/${PKGBASE}.size + ;; + *) + ;; + esac + done \ + ) | dialog --title "INITIALIZING PACKAGE TREE" --gauge \ + "\nProcessing ${TOTALP} Slackware packages..." 8 65 + + # Make sure we can select stuff from the package series: + dialog --title "INITIALIZING PACKAGE TREE" --infobox \ + "\nRetrieving tagfile information for the package tree ..." 5 65 + + for series in $(ls -1 slackware) ; do + wget -q -P ./slackware/$series $REMOTE_URL$REMOTE_ROOT/slackware/$series/tagfile + wget -q -P ./slackware/$series $REMOTE_URL$REMOTE_ROOT/slackware/$series/maketag.ez + wget -q -P ./slackware/$series $REMOTE_URL$REMOTE_ROOT/slackware/$series/maketag + done +else + dialog --title "REMOTE SERVER CONFIGURATION" --msgbox \ + "\nFailed to configure for installation from remote server." 5 65 +fi diff --git a/source/installer/sources/initrd/usr/lib/setup/INSUSB b/source/installer/sources/initrd/usr/lib/setup/INSUSB new file mode 100755 index 00000000..04723159 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSUSB @@ -0,0 +1,107 @@ +#!/bin/sh +RDIR=/dev/tty4 +NDIR=/dev/null +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +T_PX="`cat $TMP/SeTT_PX`" +rm -f $TMP/SeTmount $TMP/SeTDS $TMP/SeTCDdev $TMP/reply + +dialog --title "SCANNING FOR USB STICK" --msgbox \ +"Make sure the USB stick containing the Slackware package directory \ +is inserted into a USB port, and then press ENTER to begin the scanning process." \ +7 66 \ +2> $TMP/reply +if [ ! -r $TMP/reply ]; then + # cancel or esc + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit +fi + +dialog --infobox "\nScanning for USB stick..." 5 30 + +# Run "rescan-scsi-bus -l" to get an up to date overview of devices: +/sbin/rescan-scsi-bus -l 1>$RDIR 2>$RDIR + +# Generate a list of removable devices: +REMOVABLE_DEVICES="" +for BDEV in $(ls --indicator-style none /sys/block | grep -E -v "loop|ram|^dm-|^sr|^md"); do + if [ -r /sys/block/$BDEV/removable -a "$(cat /sys/block/$BDEV/removable)" == "1" ]; then + REMOVEABLE_DEVICES="$REMOVEABLE_DEVICES $BDEV" + fi +done + +if [ "$REMOVEABLE_DEVICES" = "" ]; then + dialog --title "NO REMOVABLE USB DEVICES FOUND" --msgbox \ +"Sorry, but no removable USB devices could be found. Exiting back to the top menu." \ +6 55 + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit +fi + +# Make a mount location for the USB source: +mkdir -p /usb-stick +# Try to unmount it, just in case something strange is going on: +umount /usb-stick 1> /dev/null 2> /dev/null + +# First, we will look for partitions on the USB stick. Not knowing whether the stick is +# partitioned with MBR or GPT partitions (or indeed at all), we'll test for partitions +# 1 through 4. Probably very few people will try to use a stick with the Slackware +# packages in a directory on partition 5 or higher. If they do, it won't work. Sorry. +unset DRIVE_FOUND INSTALL_PATH +for DEVICE in $REMOVEABLE_DEVICES ; do + for PARTITION in 1 2 3 4 ; do + mount /dev/$DEVICE$PARTITION /usb-stick 1> /dev/null 2> /dev/null + if [ -d /usb-stick/slackware/a ]; then + DRIVE_FOUND="/dev/$DEVICE$PARTITION" + INSTALL_PATH="/usb-stick/slackware" + break + fi + if [ -d /usb-stick/slackware*-*/slackware/a ]; then + DRIVE_FOUND="/dev/$DEVICE$PARTITION" + INSTALL_PATH=$(echo /usb-stick/slackware*-*/slackware) + break + fi + umount /usb-stick 1> /dev/null 2> /dev/null + done +done + +# Next, we will try mounting the devices as unpartitioned if nothing has been found yet: +if [ "$DRIVE_FOUND" = "" ]; then + for DEVICE in $REMOVEABLE_DEVICES ; do + mount /dev/$DEVICE /usb-stick 1> /dev/null 2> /dev/null + if [ -d /usb-stick/slackware/a ]; then + DRIVE_FOUND="/dev/$DEVICE" + INSTALL_PATH="/usb-stick/slackware" + break + fi + if [ -d /usb-stick/slackware*-*/slackware/a ]; then + DRIVE_FOUND="/dev/$DEVICE$PARTITION" + INSTALL_PATH=$(echo /usb-stick/slackware*-*/slackware) + break + fi + done +fi + +if [ "$DRIVE_FOUND" = "" ]; then + dialog --title "NO SLACKWARE DIRECTORY FOUND" --msgbox \ +"Sorry, but a Slackware directory could not be found on any USB devices. \ +Exiting back to the top menu." \ +6 55 + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTCDdev $TMP/errordo + exit +fi + +# Success! Report back to the console: + +dialog --title "USB PACKAGE SOURCE FOUND" --sleep 1 --infobox \ +"A Slackware package directory was found on device $DRIVE_FOUND." 3 66 + +# At this point, the stick has been found and is mounted on /usb-stick. +# All that remains is to tell the installer about it, and we're done here. + +echo $INSTALL_PATH > $TMP/SeTDS +echo "-source_mounted" > $TMP/SeTmount +echo "/dev/null" > $TMP/SeTsource + diff --git a/source/installer/sources/initrd/usr/lib/setup/INSdir b/source/installer/sources/initrd/usr/lib/setup/INSdir new file mode 100755 index 00000000..cc9b1711 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INSdir @@ -0,0 +1,73 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# Include function to check for Slackware ISO images: +. /usr/lib/setup/INCISO +while [ 0 ]; do +rm -f $TMP/SeTDS $TMP/SeTmount +# OK, at this point /var/log/mount should not have anything mounted on it, +# but we will umount just in case. +umount /var/log/mount 2> /dev/null +# 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 +cat << EOF > $TMP/tempmsg + +OK, we will install from a directory within the current +filesystem. If you have mounted this directory yourself, +you should not use ${T_PX} or /var/log/mount as mount points, +since Setup might need to use these directories. You may +install from any part of the current directory structure, +no matter what the media is (including NFS). You will need +to type in the name of the directory containing the +subdirectories for each source disk. + +Which directory would you like to install from? +EOF +dialog --title "INSTALL FROM THE CURRENT FILESYSTEM" \ + --inputbox "`cat $TMP/tempmsg`" 19 67 2> $TMP/sourcedir +if [ ! $? = 0 ]; then + rm -f $TMP/sourcedir $TMP/tempmsg + exit +fi +SOURCEDIR="`cat $TMP/sourcedir`" +rm -f $TMP/sourcedir $TMP/tempmsg +mkdir -p /var/log/mount +# First, check if a Slackware ISO image is present in $SOURCEDIR +if check_iso_image $SOURCEDIR ; then + echo "/var/log/mount/slackware" > $TMP/SeTDS +else + rm -f /var/log/mount 2> /dev/null + rmdir /var/log/mount 2> /dev/null + ln -sf $SOURCEDIR /var/log/mount + echo "/var/log/mount" > $TMP/SeTDS +fi +echo "-source_mounted" > $TMP/SeTmount +echo "/dev/null" > $TMP/SeTsource +if [ ! -d $SOURCEDIR ]; then + cat << EOF > $TMP/tempmsg + +Sorry - the directory you specified is not valid. Please +check the directory and try again. + +(Directory given: $SOURCEDIR) + +EOF + dialog --title "INVALID DIRECTORY ENTERED" --msgbox "`cat $TMP/tempmsg`" 10 65 + rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTsource $TMP/sourcedir $TMP/tempmsg +else + exit +fi +done; diff --git a/source/installer/sources/initrd/usr/lib/setup/INShd b/source/installer/sources/initrd/usr/lib/setup/INShd new file mode 100755 index 00000000..ce30cb2f --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/INShd @@ -0,0 +1,146 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# Include function to check for Slackware ISO images: +. /usr/lib/setup/INCISO +while [ 0 ]; do +rm -f $TMP/SeTDS $TMP/SeTmount $TMP/SeTsource +# OK, at this point /var/log/mount should not have anything mounted on it, +# but we will umount just in case. +umount /var/log/mount 2> /dev/null +# 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 + +while [ 0 ]; do + cat << EOF > $TMP/tempmsg +In order to install directly from the hard disk you must have a +partition (such as /dev/sda1, /dev/sdb5, etc) with the Slackware +distribution's slackware/ directory like you'd find it on the FTP +site. It can be in another directory. For example, if the +distribution is in /stuff/slackware/, then you have to have +directories named /stuff/slackware/a, /stuff/slackware/ap, and so +on each containing the files that would be in that directory on +the FTP site. You may install from FAT or Linux partitions. + +Please enter the partition (such as /dev/sda1) where the Slackware +sources can be found, or [enter] to see a partition list: +EOF + dialog --title "INSTALLING FROM HARD DISK" --inputbox \ +"`cat $TMP/tempmsg`" 18 70 2> $TMP/source.part + if [ ! $? = 0 ]; then + rm -f $TMP/source.part $TMP/tempmsg + exit + fi + rm -f $TMP/tempmsg + SLACK_DEVICE="`cat $TMP/source.part`" + rm -f $TMP/source.part + if [ "$SLACK_DEVICE" = "" ]; then + dialog --title "PARTITION LIST" --no-collapse --msgbox "`probe -l | grep -v cylind | grep dev | sort 2> /dev/null`" 22 75 + continue; + fi + break; +done + +dialog --title "SELECT SOURCE DIRECTORY" --inputbox \ +"Now we need to know the full path on this partition to the\n\ +slackware/ directory where the directories containing\n\ +installation files and packages to be installed are kept.\n\ +For example, if you downloaded Slackware into the /stuff\n\ +directory on your hard drive (so that you have the\n\ +directories /stuff/slackware/a, /stuff/slackware/ap, and so on\n\ +each containing the files that would be in that directory on\n\ +the FTP site), then the full path to enter here would be:\n\ +\n\ + /stuff/slackware\n\ +\n\ +What directory are the Slackware sources in?" \ +19 65 2> $TMP/source.dir +if [ ! $? = 0 ]; then + rm -f $TMP/source.dir + exit +fi +SLACK_SOURCE_LOCATION="`cat $TMP/source.dir`" +rm -f $TMP/source.dir +if mount | grep $SLACK_DEVICE 1> /dev/null 2> /dev/null ; then + # This partition is already mounted, so we will have to + # tweak things funny. + rm -f /var/log/mount 2> /dev/null + rmdir /var/log/mount 2> /dev/null + PREFIX="`mount | grep $SLACK_DEVICE | cut -f 3 -d ' '`" + ln -sf $PREFIX /var/log/mount +else + SUCCESS=false + for type in ext4 ext3 ext2 vfat reiserfs hpfs msdos ; do + mount -r -t $type $SLACK_DEVICE /var/log/mount 1> /dev/null 2> /dev/null + if [ $? = 0 ]; then # mounted successfully + SUCCESS=true + break; + fi + done + if [ ! $SUCCESS = true ]; then # there was a mount error + cat << EOF > $TMP/tempmsg +There was a problem mounting your partition. Would you like to: + +EOF + dialog --title "MOUNT ERROR" --menu "`cat $TMP/tempmsg`" 10 68 2 \ +"Restart" "Start over" \ +"Ignore " "Ignore the error and continue" 2> $TMP/dowhat + if [ ! $? = 0 ]; then + rm -f $TMP/dowhat + exit + fi + DOWHAT="`cat $TMP/dowhat`" + rm -f $TMP/dowhat + if [ "$DOWHAT" = "Restart" ]; then + umount /var/log/mount 2> /dev/null + continue; + fi + echo + fi # mount error +fi + +# First, check if a Slackware ISO image is present in $SLACK_SOURCE_LOCATION +if check_iso_image /var/log/mount/$SLACK_SOURCE_LOCATION /var/log/mntiso ; then + echo "/var/log/mntiso/slackware" > $TMP/SeTDS + echo "-source_mounted" > $TMP/SeTmount + echo "/dev/null" > $TMP/SeTsource + exit +elif [ -f /var/log/mount/$SLACK_SOURCE_LOCATION/slackware/PACKAGES.TXT ]; then + echo "/var/log/mount/$SLACK_SOURCE_LOCATION/slackware" > $TMP/SeTDS + echo "-source_mounted" > $TMP/SeTmount + echo "/dev/null" > $TMP/SeTsource + exit +elif [ -d /var/log/mount/$SLACK_SOURCE_LOCATION ]; then + echo "/var/log/mount/$SLACK_SOURCE_LOCATION" > $TMP/SeTDS + echo "-source_mounted" > $TMP/SeTmount + echo "/dev/null" > $TMP/SeTsource + exit +else + cat << EOF > $TMP/tempmsg + +Sorry, but the directory $SLACK_SOURCE_LOCATION does not exist +on partition $SLACK_DEVICE. + +Would you like to try again? +EOF + dialog --title "SOURCE DIRECTORY NOT FOUND" --yesno "`cat $TMP/tempmsg`" 10 70 + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg + exit + fi + rm -r $TMP/tempmsg +fi + +done diff --git a/source/installer/sources/initrd/usr/lib/setup/PROMPThelp b/source/installer/sources/initrd/usr/lib/setup/PROMPThelp new file mode 100644 index 00000000..1bc7b15f --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/PROMPThelp @@ -0,0 +1,83 @@ +PROMPT MODE HELP + +Software packages are about to be transfered onto your +hard drive. Several options exist for selecting which +packages you wish to install. + +If you select "full", the install program will just go +ahead and install everything from the disk sets +you have selected. If you've got enough disk space, this +should work fine. You'll have some packages you don't +need on your hard drive, though, like fairly large X +servers for display hardware you don't own. Not a problem, +if you run short of space, go into /var/log/packages and +read any or all of the files with 'less' to see what +packages you have installed, and remove any unnecessary +ones using 'removepkg'. + +For people who know what they want to install and would +like to select the packages from menus instead of +individually, there are two menu installation modes: +"menu" and "expert". + +"menu" mode puts up a menu at the start of each series of +packages, from which you can install systems such as +the GNU C/C++ compiler, or the Linux source code. It's +easy to use, and makes installation go much faster than +"newbie" mode. + +"expert" mode is similar, but allows the toggling of every +individual package. This offers the greatest control over +what gets installed on the machine, but can be tricky for +beginners. + +The so-called "newbie" mode will follow a defaults file in +the first directory of each series you install that will +install some required package automatically, while prompting +you about the rest of them, one by one. This mode of +installation _really_ is no longer recommended. There are +so many packages now that the time added to the installation +is quite significant, and the chance of accidentally leaving +out an important package is high. If you haven't installed +Slackware before, the best thing to do is make sure you have +plenty of space and go for a "full" installation. + +About the "tagfile" files: + +The package installation defaults are user definable - you +may set any package to be added or skipped automatically by +editing your choices into a file called TAGFILE that will be +found on the first disk of each series. The tagfile contains +all the instructions needed to completely automate your +installation. + +NOTE: Software may be added to your system after the +initial installation. Just type 'setup' to add software +to your system. Another script, 'pkgtool', may be used to +add software packages from the current directory, or to +cleanly remove packages that you want uninstalled. Also, +command line utilities (installpkg, removepkg, makepkg, +etc) are available, and (once learned) more efficient to +use. These are what I use for package management. + +If you use tagfiles, you might want to use a custom +tagfile that you have created yourself instead of the +default ones that come with Slackware (the ones named +'tagfile'). For instance, I use custom tagfiles called +'tagfile.pat' that you might see on your disks. :^) You +make a custom tagfile by copying the 'tagfile' on the +first disk of a series to a file named 'tagfile.???' +where .??? is a custom extension of your choosing. (I use +'.pat') Once you've done this, you can edit the defaults +any way you like. (but be careful about changing stuff +that was installed by default) + +To use a custom tagfile, just choose "custom" on the +prompt mode menu, and enter your custom extension. Any +tagfiles with this extension will then be used for the +duration of the installation. If at any point a tagfile +with that extension cannot be found, the default tagfile +will be used instead. + +-- End of prompt mode help text + diff --git a/source/installer/sources/initrd/usr/lib/setup/PXEhelp b/source/installer/sources/initrd/usr/lib/setup/PXEhelp new file mode 100644 index 00000000..99c2ad93 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/PXEhelp @@ -0,0 +1,108 @@ + +Slackware PXE Server Help +_________________________ + +First, a little help on help. Whenever you encounter a text +viewer like this during the installation, you can move around +with these commands: + +PGDN/SPACE - Move down one page +PGUP/'b' - Move up one page +ENTER/DOWN/'j' - Move down one line +UP/'k' - Move up one line +LEFT/'h' - Scroll left +RIGHT/'l' - Scroll right +'0' - Move to beginning of line +HOME/'g' - Move to beginning of file +END/'G' - Move to end of file +'/' - Forward search +'?' - Backward search +'n' - Repeat last search (forward) + +Also, you're running a real multitasking operating system now, so +you're not confined to the installation program. You can log into +other consoles and look around at any time without disturbing the +installation process. To do this, you need to learn the commands +that control the Linux console. You'll use these commands all the +time when you're logged into Linux. + +"Virtual" consoles and scrollback: + +Right now, the screen you're looking at is probably VIRTUAL CONSOLE +NUMBER ONE, (or /dev/tty1 in Linux-speak). There are usually +several virtual consoles available. When you log into the install +disk, there are four consoles. To switch among them, use Alt-F1, +Alt-F2, Alt-F3, or Alt-F4 to select which of the four consoles you +wish to use. While you're using a console, you get a small amount +of text scrollback buffer. To scroll the console back, hold down +the right shift key and hit PageUp. To scroll the console forward, +hit PageDown while holding the right shift key down. This can be +especially useful for reading the boot messages, which can go by +too fast to read otherwise. + + +RUNNING THE PXESETUP PROGRAM + + +The pxesetup main menu is kept as easy as possible, because only a +limited configuration is needed. + + +NETWORK (configure the network device and optional DHCP server) +SOURCE (select the source location for the Slackware Linux + packages) +ACTIVATE (start the PXE server) + + +In the NETWORK configuration stage, you configure an IP address for +your network card. If you have already a DHCP server in your local +network, the pxesetup program will offer you the choice of using the +DHCP server to configure your network device fully automatic, but +there is always the option to enter an IP address manually. If no +DHCP server has been detected running inside your local network, +then pxesetup will start its own DHCP server (we need one). You will +get the chance to define the IP address range which that internal +DHCP server uses. You should check the lower and upper IP addresses +carefully and verify that none of your local network's computers, +including your local gateway, use an IP address in that DHCP range. +If you spot a conflict, you can adjust these lower and upper bounds. +Press 'Accept' once you are satisfied. + +In the SOURCE configuration stage, you determine where you have +your local Slackware copy. This should be a complete directory +tree including the packages, the kernels and the isolinux directory. +The package sources are not needed and can be omitted from the medium +if you are using a bootable USB stick for instance. The choices +for SOURCE location are: a DVD medium, a local disk partition or +a pre-mounted directory. These are the standard setup dialogs you +will certainly know from installing Slackware. Be sure to enter the +full directory path to (and including) the directory which contains +the 'a', 'ap', 'd', ..., 'y' subdirectiries. You know the drill. + + +When you are done configuring NETWORK and SOURCE, it is time to +ACTIVATE your PXE server. The screen will show a live view of the +server's connection log for client boot requests. This goes on +until you press 'Exit' which will drop you back into the main menu +after killing the PXE service. Selecting ACTIVATE will restart the +PXE service. Computers who boot from your PXE server will see the +usual Slackware installation routine. When it comes to selecting the +SOURCE, these computers have one choice, and is the entry "Install +from FTP/HTTP server". The PXE server offers Slackware packages to +willing computers using its own internal HTTP server. The default +values that you will see for the URL and the PATH input fields are +being supplied by the PXE server and should not be changed. + + +...WHEN YOU'RE DONE: + + +EXIT: This leaves Slackware PXE Server setup. + + +Have fun running this PXE server! + +--- +Eric Hameleers +alien@slackware.com + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTDOS b/source/installer/sources/initrd/usr/lib/setup/SeTDOS new file mode 100755 index 00000000..4f9d1057 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTDOS @@ -0,0 +1,214 @@ +#!/bin/sh +# SeTpartition user-friendly rewrite Fri Dec 15 13:17:40 CST 1995 pjv +# More updates for Slackware 3.5: Wed Apr 29 22:43:28 CDT 1998 +# Updated for Slackware 7.x (new fdisk tags) Fri Sep 10 13:17:18 CDT 1999 +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +REDIR=/dev/tty4 +NDIR=/dev/null +rm -f $TMP/SeTDOS +touch $TMP/SeTDOS + +crunch () { # remove extra whitespace + read STRING; + echo $STRING +} + +# get_part_size( dev ) - Return the size in K, M, G, T, or P of the named partition. +get_part_size() { + numfmt --to=iec $(blockdev --getsize64 $1) +} + +ntfs_security() { + rm -f $TMP/ntfs_security + dialog --backtitle "Setting permissions on NTFS partition $DOS_PART" \ + --title "SET SECURITY FOR NTFS PARTITION $DOS_PART" \ + --default-item "fmask=177,dmask=077" \ + --menu "Because users could go snooping through (or destroy, depending on \ +the settings) your Windows partition, you should choose how much access would you \ +like your non-root users to have to partition $DOS_PART. The access level can \ +range from no access at all, to read-only for everyone, to read-write access \ +for every user on the machine. A reasonable default (read-write for root only) \ +is chosen, but you may set this any way that you like." \ +16 77 4 \ +"fmask=177,dmask=077" "Root has read/write access, users have no access (ntfs-3g)" \ +"fmask=333,dmask=222" "Everyone has read only access (built-in kernel ntfs driver)" \ +"fmask=133,dmask=022" "Everyone has read access, but only root can write (ntfs-3g)" \ +"fmask=111,dmask=000" "All users can read/write to any file (ntfs-3g)" \ +2> $TMP/ntfs_security + if [ ! $? = 0 ]; then + rm -f $TMP/ntfs_security $TMP/mount-point $TMP/SeTDOS + echo 1 + fi +} + +fat_security() { + rm -f $TMP/fat_security + dialog --backtitle "Setting permissions on FAT partition $DOS_PART" \ + --title "SET SECURITY FOR FAT PARTITION $DOS_PART" \ + --default-item "fmask=177,dmask=077" \ + --menu "Because users could go snooping through (or destroy, depending on \ +the settings) your Windows partition, you should choose how much access would you \ +like your non-root users to have to partition $DOS_PART. The access level can \ +range from no access at all, to read-only for everyone, to read-write access \ +for every user on the machine. A reasonable default (read-write for root only) \ +is chosen, but you may set this any way that you like." \ +18 77 4 \ +"fmask=177,dmask=077" "Root has read/write access, users have no access" \ +"fmask=333,dmask=222" "Everyone has read only access" \ +"fmask=133,dmask=022" "Everyone has read access, but only root can write" \ +"fmask=111,dmask=000" "All users can read/write to any file" \ +2> $TMP/fat_security + if [ ! $? = 0 ]; then + rm -f $TMP/fat_security $TMP/mount-point $TMP/SeTDOS + echo 1 + fi +} + +# Since the USB installers (both usbboot.img and the ones created using +# usbimg2disk.sh) present bogus FAT/NTFS partitions, we need a way to +# filter these from the partition scan. To do this, we'll set a variable +# $BANHAMMER that contains the name of the device the stick was found on. +# First, we'll set that to contain some random nonsense that will never +# be an actual device since reverse grepping for "" won't work. +BANHAMMER="0xFE11C1A" +# Look for the usbboot.img stick: +if [ -L /dev/disk/by-label/USBSLACK ]; then + BANHAMMER="$(readlink -f /dev/disk/by-label/USBSLACK)" +fi +# Look for the usbimg2disk.sh stick: +if [ -L /dev/disk/by-label/USBSLACKINS ]; then + BANHAMMER="$(readlink -f /dev/disk/by-label/USBSLACKINS | cut -b 1-8)" +fi +# Suggested new GPT partition type: Microsoft basic data +# More research needed... could be FAT32, NTFS, or EXFAT +DOSLIST="$(probe -l 2> /dev/null | grep -E "DOS|Win(95 F|98 F)|HPFS|W95 F|FAT(12|16)" | grep -Ev "Ext('d|end)" | grep -v "$BANHAMMER" | sort)" +if [ "$DOSLIST" = "" ]; then # no FAT or NTFS partitions + exit +fi +dialog --backtitle "Setting up non-Linux partitions." \ +--title "FAT or NTFS PARTITIONS DETECTED" \ +--yesno "Partitions of type FAT or NTFS (commonly used by DOS and \ +Windows) have been found on your \ +system. Would you like to add these partitions to your /etc/fstab \ +so that these partitions are visible from Linux?" \ +8 70 +if [ ! $? = 0 ]; then + exit +fi +while [ 0 ]; do # main partition selection loop + rm -f $TMP/SeTSKIP + echo "true" > $TMP/SeTSKIP + cat << EOF > $TMP/tempscript +dialog --backtitle "Selecting non-Linux partitions." \\ +--title "SELECT PARTITION TO ADD TO /etc/fstab" \\ +--ok-label Select --cancel-label Continue \\ +--menu "In order to make these partitions visible from Linux, we \\ +need to add them to your /etc/fstab. Please pick a partition to \\ +add to /etc/fstab, or select '---' to continue with the installation \\ +process." \\ +15 70 5 \\ +EOF + echo "$DOSLIST" | while read PARTITION ; do + NAME=`echo $PARTITION | crunch | cut -f 1 -d ' '` + SIZE=`get_part_size $NAME` + if echo $PARTITION | grep Win9 1> $NDIR 2> $NDIR ; then + TYPE="FAT32" + elif echo $PARTITION | grep "W95 F" 1> $NDIR 2> $NDIR ; then + TYPE="FAT32" + elif echo $PARTITION | grep NTFS 1> $NDIR 2> $NDIR ; then + TYPE="NTFS" + elif echo $PARTITION | grep FAT 1> $NDIR 2> $NDIR ; then + TYPE="FAT16" + fi + if cat $TMP/SeTDOS | grep $NAME 1> $NDIR 2> $NDIR ; then + ON=`cat $TMP/SeTDOS | grep $NAME | crunch | cut -f 2 -d ' '` + echo "\"(IN USE)\" \"$NAME on $ON $TYPE ${SIZE}\" \\" >> $TMP/tempscript + else + echo "\"$NAME\" \"$TYPE ${SIZE}\" \\" >> $TMP/tempscript + echo "false" > $TMP/SeTSKIP + fi + done + echo "\"---\" \"(done, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done, continue with setup)\" \\" >> $TMP/tempscript + echo "2> $TMP/return" >> $TMP/tempscript + if [ "`cat $TMP/SeTSKIP`" = "true" ]; then + break + fi + . $TMP/tempscript + if [ ! $? = 0 ]; then + rm $TMP/tempscript + exit 255 # user abort + fi + DOS_PART="`cat $TMP/return`" + rm -f $TMP/tempscript + if [ "$DOS_PART" = "---" ]; then + break + elif [ "$DOS_PART" = "(IN USE)" ]; then + continue + fi + if echo "$DOSLIST" | grep -w $DOS_PART | grep NTFS 1> $NDIR 2> $NDIR ; then + ntfs_security + FS_UMASK="$(cat $TMP/ntfs_security)" + if [ "$FS_UMASK" = "1" ]; then + exit 1 + else + if [ "$FS_UMASK" = "fmask=333,dmask=222" ]; then + FS_TYPE=ntfs + else + FS_TYPE=ntfs-3g + fi + fi + else + FS_TYPE=vfat + fat_security + FS_UMASK="$(cat $TMP/fat_security)" + fi + dialog --backtitle "Selecting a location to mount $DOS_PART." \ + --title "PICK MOUNT POINT FOR $DOS_PART" \ + --inputbox "Now this partition must be mounted somewhere in your \ + directory tree. Please enter the directory under which \ + you would like to put it. For instance, you might want to \ + enter /fat-c or /fat-d or something similar. \ + NOTE: This \ + partition won't actually be mounted until you reboot. \ + Where would you like to mount $DOS_PART?" \ + 13 65 2> $TMP/mount-point + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/mount-point $TMP/SeTDOS + exit + fi + NEW_DIR="`cat $TMP/mount-point`" + rm -f $TMP/mount-point + # If this was left blank or is '/', drop back to the first menu and start over. + if [ "$NEW_DIR" = "" -o "$NEW_DIR" = "/" ]; then + continue + fi + if [ ! "`echo $NEW_DIR | cut -b1`" = "/" ]; then + NEW_DIR="/$NEW_DIR" + fi + mkdir -p ${T_PX}$NEW_DIR + chmod 755 ${T_PX}$NEW_DIR + if echo "$DOSLIST" | grep $DOS_PART | grep NTFS 1> $NDIR 2> $NDIR ; then + printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$DOS_PART" "$NEW_DIR" "$FS_TYPE" "$FS_UMASK" "1" "0" >> $TMP/SeTDOS + else + printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$DOS_PART" "$NEW_DIR" "$FS_TYPE" "$FS_UMASK" "1" "0" >> $TMP/SeTDOS + fi +done # partition adding loop +rm -f $TMP/SeTSKIP +cat << EOF > $TMP/tempmsg + +Adding this information to your /etc/fstab: + +EOF +cat $TMP/SeTDOS >> $TMP/tempmsg +dialog --backtitle "Finished setting up non-Linux partitions." \ +--title "DONE ADDING FAT or NTFS PARTITIONS" \ +--exit-label OK \ +--textbox $TMP/tempmsg 15 72 diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTEFI b/source/installer/sources/initrd/usr/lib/setup/SeTEFI new file mode 100755 index 00000000..35ac5f9f --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTEFI @@ -0,0 +1,94 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +rm -f $TMP/SeTefipartitions +touch $TMP/SeTefipartitions + +# Scan for EFI partitions: +# We accept at most 10 NVMe controllers, each controlling at most 4 SSDs +for drive in sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl sdm sdn sdo sdp \ + mmcblk0 mmcblk1 mmcblk2 mmcblk3 mmcblk4 mmcblk5 mmcblk6 mmcblk7 mmcblk8 mmcblk9 \ + nvme0n1 nvme1n1 nvme2n1 nvme3n1 nvme4n1 nvme5n1 nvme6n1 nvme7n1 nvme8n1 nvme9n1 \ + nvme0n2 nvme1n2 nvme2n2 nvme3n2 nvme4n2 nvme5n2 nvme6n2 nvme7n2 nvme8n2 nvme9n2 \ + nvme0n3 nvme1n3 nvme2n3 nvme3n3 nvme4n3 nvme5n3 nvme6n3 nvme7n3 nvme8n3 nvme9n3 \ + nvme0n4 nvme1n4 nvme2n4 nvme3n4 nvme4n4 nvme5n4 nvme6n4 nvme7n4 nvme8n4 nvme9n4 ; do + gdisk -l /dev/$drive 2> /dev/null | grep -w EF00 | while read efisp ; do + p="" + echo $drive| grep -q nvme && p="p" + echo /dev/$drive$p$(expr $(echo "$efisp" | cut -b 1-4)) >> $TMP/SeTefipartitions + done +done + +if [ "$(cat $TMP/SeTefipartitions)" = "" ]; then # No EFI partitions + rm -f $TMP/SeTefipartitions + exit +fi + +# Initially, we will just take the first EFI partition found, which +# will probably be on /dev/sda: +PREFERRED_EFI_PARTITION="$(cat $TMP/SeTefipartitions | head -n 1)" + +# But we will also test to see if there is an EFI partition on the same +# device as the root partition, and if so, prefer that: +if [ -r $TMP/SeTrootdev ]; then + if grep -q "$(cat $TMP/SeTrootdev | cut -b 1-8)" $TMP/SeTefipartitions ; then + PREFERRED_EFI_PARTITION="$(grep "$(cat $TMP/SeTrootdev | cut -b 1-8)" $TMP/SeTefipartitions | head -n 1)" + fi +fi + +# This file is no longer needed: +rm -f $TMP/SeTefipartitions + +# See if EFI partition is formatted. If not, offer to format it: +EFITMPMOUNT=$(mktemp -d) +if ! mount $PREFERRED_EFI_PARTITION $EFITMPMOUNT 1> /dev/null 2> /dev/null ; then + # It didn't mount, so it must not be formatted: + dialog --title "FORMAT EFI PARTITION ${PREFERRED_EFI_PARTITION}?" \ + --yesno "An EFI System Partition was found on ${PREFERRED_EFI_PARTITION}, \ +but it has not yet been formatted. Would you like to format this partition?" \ +7 56 + if [ ! $? = 0 ]; then + exit + fi + # Format the partition with FAT32, 2 sectors per cluster (needed for the + # minimum supported EFI partition size of 100MB): + dialog --title "FORMATTING EFI PARTITION ${PREFERRED_EFI_PARTITION}" --infobox \ + "Formatting EFI System Partition ${PREFERRED_EFI_PARTITION} as FAT32." 3 60 + mkfs.vfat -F 32 -s 2 ${PREFERRED_EFI_PARTITION} 1> /dev/null 2> /dev/null + sleep 1 + mount ${PREFERRED_EFI_PARTITION} $EFITMPMOUNT 1> /dev/null 2> /dev/null +fi +if [ ! -d $EFITMPMOUNT/EFI -a ! -d $EFITMPMOUNT/efi ]; then + mkdir $EFITMPMOUNT/EFI 1> /dev/null 2> /dev/null +fi +umount $PREFERRED_EFI_PARTITION 1> /dev/null 2> /dev/null +rmdir $EFITMPMOUNT + +# Mount the partition on ${T_PX}/boot/efi: +if [ ! -d ${T_PX}/boot/efi ]; then + mkdir -p ${T_PX}/boot/efi +fi +mount ${PREFERRED_EFI_PARTITION} ${T_PX}/boot/efi 1> /dev/null 2> /dev/null + +# Add the EFI System Partition to /etc/fstab: +printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$PREFERRED_EFI_PARTITION" "/boot/efi" "vfat" "defaults" "1" "0" > $TMP/SeTEFI +cat << EOF > $TMP/tempmsg + +Adding this information to your /etc/fstab: + +EOF +cat $TMP/SeTEFI >> $TMP/tempmsg +dialog --backtitle "Finished setting up EFI System Partition." \ +--title "EFI SYSTEM PARTITION RECOGNIZED" \ +--exit-label OK \ +--textbox $TMP/tempmsg 10 72 + +# Piggyback this fstab addition on the other native partitions in SeTnative: +cat $TMP/SeTEFI >> $TMP/SeTnative +rm -f $TMP/SeTEFI $TMP/tempmsg + +# Done. + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTPKG b/source/installer/sources/initrd/usr/lib/setup/SeTPKG new file mode 100755 index 00000000..22ad2d9d --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTPKG @@ -0,0 +1,148 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# If the distribution source is already known, we can avoid listing +# stuff that isn't there. +if [ ! -r $TMP/SeTT_PX -o ! -r $TMP/SeTDS ]; then + unset T_PX + unset DS +else + T_PX="`cat $TMP/SeTT_PX`" + DS="`cat $TMP/SeTDS`" +fi +# In /usr/lib/setup/slackinstall, $TMP/series is a directory. +# Depending on how you use the 'setup' script, you can end up going +# round in circles due to this script using 'series' as a text file but +# not being able delete it due to an rm -f. Now we use rm -rf. +# It's a toss up between accidentally wiping the series selection +# (it only takes a few seconds to re-select the stuff) and getting +# confused. +rm -rf $TMP/SeTSERIES $TMP/tmpscript $TMP/series + +cat << EOF > $TMP/tmpscript +dialog --backtitle "Selecting software to install." \\ +--title "PACKAGE SERIES SELECTION" --item-help --output-separator "#" --checklist \\ +"Now it's time to select which general categories of software \\ +to install on your system. \\ +Use the spacebar to select or unselect the software you wish to \\ +install. \\ +You can use the up and down arrows to see all the possible choices. \\ +Recommended choices have been preselected. \\ +Press the ENTER key when you are finished." \\ +20 75 9 \\ +"A" "Base Linux system" on "The A (base) series contains the kernel and main system utilities." \\ +EOF + +if [ -d $DS/ap -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"AP" "Various Applications that do not need X" on "The AP series is a collection of useful applications." \\ +EOF +fi + +if [ -d $DS/d -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"D" "Program Development (C, C++, Lisp, Perl, etc.)" on "The D series contains compilers, debuggers, and other programming tools." \\ +EOF +fi + +if [ -d $DS/e -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"E" "GNU Emacs" on "The E series contains the GNU Emacs advanced real-time display editor." \\ +EOF +fi + +if [ -d $DS/f -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"F" "FAQ lists, HOWTO documentation" on "The F series contains essential documentation for Linux system administrators." \\ +EOF +fi + +if [ -d $DS/gnome -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"GNOME" "The GNOME desktop for X" on "The GNOME series contains the GNOME desktop environment and related libraries." \\ +EOF +fi + +if [ -d $DS/k -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"K" "Linux kernel source" on "The K series contains the source code for the Linux kernel." \\ +EOF +fi + +if [ -d $DS/kde -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"KDE" "Qt and the K Desktop Environment for X" on "The KDE series contains the K Desktop Environment and related libraries." \\ +EOF +fi + +if [ -d $DS/kdei -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"KDEI" "International language support for KDE" off "The KDEI series provides support for languages other than US English in KDE." \\ +EOF +fi + +if [ -d $DS/l -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"L" "System Libraries (some needed by both KDE and GNOME)" "on" "The L series contains libraries needed by GNOME, KDE, and other programs." \\ +EOF +fi + +if [ -d $DS/n -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"N" "Networking (TCP/IP, UUCP, Mail, News)" on "The N series contains network related clients and servers." \\ +EOF +fi + +if [ -d $DS/t -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"T" "TeX typesetting software" on "TeX is a typesetting system often used for mathematics and technical papers." \\ +EOF +fi + +if [ -d $DS/tcl -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"TCL" "Tcl/Tk script languages" on "The TCL series contains the Tcl/Tk/TclX languages and programs that use them." \\ +EOF +fi + +if [ -d $DS/x -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"X" "X Window System" on "This series contains X, the windowing system used by Linux." \\ +EOF +fi + +if [ -d $DS/xap -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"XAP" "X Applications" on "The XAP series is a collection of applications for X." \\ +EOF +fi + +if [ -d $DS/xfce -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"XFCE" "The Xfce Desktop Environment for X" on "Xfce is a fast and lightweight GTK+ based desktop environment for X." \\ +EOF +fi + +if [ -d $DS/y -o "$DS" = "" ]; then +cat << EOF >> $TMP/tmpscript +"Y" "Games" on "The Y series is a collection of classic BSD text-based games." \\ +EOF +fi + +cat << EOF >> $TMP/tmpscript + 2> $TMP/series +EOF +. $TMP/tmpscript +if [ ! $? = 0 ]; then + rm -rf $TMP/series $TMP/tmpscript + exit +fi +INSTSETS="`cat $TMP/series | tr -d " "`" +INSTSETS="`echo $INSTSETS | tr "\042" "#" `" +INSTSETS="`echo $INSTSETS | tr "," "#" `" +INSTSETS="`echo $INSTSETS | tr -s "#" `" +rm -rf $TMP/series $TMP/tmpscript +echo "$INSTSETS" > $TMP/SeTSERIES diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTPXEHELP b/source/installer/sources/initrd/usr/lib/setup/SeTPXEHELP new file mode 100755 index 00000000..a8f25c47 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTPXEHELP @@ -0,0 +1,2 @@ +#!/bin/sh +dialog --title "Slackware PXE Server Help" --exit-label OK --textbox "/usr/lib/setup/PXEhelp" 22 77 diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTconfig b/source/installer/sources/initrd/usr/lib/setup/SeTconfig new file mode 100755 index 00000000..6731019b --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTconfig @@ -0,0 +1,138 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +T_PX="`cat $TMP/SeTT_PX`" +ROOT_DEVICE="`cat $TMP/SeTrootdev`" +if [ ! -d $T_PX/bin -a ! -d $T_PX/etc ]; then # if there no Linux here, exit + exit +fi + +# Check for disk full error: +. /usr/lib/setup/SeTfull + +# These next lines are intended to clean up any permissions +# problems that could be caused by a bad package. We don't +# intend to make any bad packages here, but it never hurts +# to be safe. :^) +( cd $T_PX ; chmod 755 ./ ) +( cd $T_PX ; chmod 755 ./var ) +if [ -d $T_PX/usr/src/linux ]; then + chmod 755 $T_PX/usr/src/linux +fi +if [ ! -d $T_PX/proc ]; then + mkdir $T_PX/proc + chown root.root $T_PX/proc +fi +if [ ! -d $T_PX/sys ]; then + mkdir $T_PX/sys + chown root.root $T_PX/sys +fi +chmod 1777 $T_PX/tmp +if [ ! -d $T_PX/var/spool/mail ]; then + mkdir -p $T_PX/var/spool/mail + chmod 755 $T_PX/var/spool + chown root.mail $T_PX/var/spool/mail + chmod 1777 $T_PX/var/spool/mail +fi + +# Some of the install scripts need /proc and /sys. +# Some disks will need /dev with module loaded devices. +if [ ! "$T_PX" = "/" ]; then + mount --bind /proc $T_PX/proc 1> /dev/null 2> /dev/null + mount --bind /sys $T_PX/sys 1> /dev/null 2> /dev/null + mount --bind /dev $T_PX/dev 1> /dev/null 2> /dev/null +fi +# These will be left connected rather than unmounting them to +# make it easier to set up LVM/LUKS. + +# Load keyboard map (if any) when booting +if [ -r $TMP/SeTkeymap ]; then + MAPNAME="`cat $TMP/SeTkeymap`" + echo "#!/bin/sh" > $T_PX/etc/rc.d/rc.keymap + echo "# Load the keyboard map. More maps are in /usr/share/kbd/keymaps." \ + >> $T_PX/etc/rc.d/rc.keymap + echo "if [ -x /usr/bin/loadkeys ]; then" >> $T_PX/etc/rc.d/rc.keymap + echo " /usr/bin/loadkeys $MAPNAME" >> $T_PX/etc/rc.d/rc.keymap + echo "fi" >> $T_PX/etc/rc.d/rc.keymap + chmod 755 $T_PX/etc/rc.d/rc.keymap +fi + +# Only ask if we want to skip configuring if we suspect the user should +# skip the step: +if [ -r $T_PX/etc/fstab ]; then + dialog --title "CONFIGURE THE SYSTEM" --yesno "Now we can configure your \ +Linux system. If this is a new installation, you MUST configure it now or it \ +will not boot correctly. However, if you are just adding software to an \ +existing system, you can back out to the main menu and skip this step. \ +However (important exception) if you've installed a new kernel image, it's \ +important to reconfigure your system so that you can install LILO (the Linux \ +loader) or create a bootdisk using the new kernel. You want to CONFIGURE \ +your system, right?" 0 0 + if [ ! $? = 0 ]; then + exit + fi +else + dialog --title "DONE INSTALLING PACKAGES" --infobox \ +"Preparing to configure your new Linux system..." 3 54 + sleep 1 +fi + +# Post installation and setup scripts added by packages. +if [ -d $T_PX/var/log/setup ]; then + # Prepare for LVM in a newly installed system + if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then # Available in local root + if [ ! -r $T_PX/etc/lvmtab -a ! -d $T_PX/etc/lvm/backup ]; then + #mount --bind /proc $T_PX/proc + #mount --bind /sys $T_PX/sys + chroot $T_PX /sbin/vgscan --mknodes --ignorelockingfailure 1> /dev/null 2> /dev/null + # First run does not always catch LVM on a LUKS partition: + chroot $T_PX /sbin/vgscan --mknodes --ignorelockingfailure 1> /dev/null 2> /dev/null + fi + fi + for INSTALL_SCRIPTS in $T_PX/var/log/setup/setup.* ; do + SCRIPT=`basename $INSTALL_SCRIPTS` + # Here, we call each script in /var/log/setup. Two arguments are provided: + # 1 -- the target prefix (normally /, but ${T_PX} from the bootdisk) + # 2 -- the name of the root device. + ( cd $T_PX + if [ -x var/log/setup/$SCRIPT ]; then + ./var/log/setup/$SCRIPT $T_PX $ROOT_DEVICE + fi + ) + if echo $SCRIPT | grep onlyonce 1> /dev/null 2> /dev/null; then # only run after first install + if [ ! -d $T_PX/var/log/setup/install ]; then + mkdir $T_PX/var/log/setup/install + fi + mv $INSTALL_SCRIPTS $T_PX/var/log/setup/install + fi + done +fi + +# Figure out how to set the /dev/cdrom and/or /dev/dvd symlinks. Everything seems to +# report itself as a DVD-ROM, so don't blame me. Without asking what's what, all we can +# do here is guess. It's a better guess than before, though, as now it takes ide-scsi +# into account. This won't really matter these days (2018), as everything uses udev to +# create /dev, and it makes links like this... +if dmesg | grep "ATAPI CD" 1> /dev/null 2> /dev/null ; then + dmesg | grep "ATAPI CD" | while read device ; do + shortdev=`echo $device | cut -f 1 -d :` + if grep -w "$shortdev=ide-scsi" $T_PX/etc/lilo.conf 1> /dev/null 2> /dev/null ; then + shortdev=sr0 + fi + ( cd $T_PX/dev + rm -f cdrom dvd + ln -sf /dev/$shortdev cdrom + ln -sf /dev/$shortdev dvd + ) + # Rather than keep overwriting the devices, quit keeping only links to the first + # device found. "Real" users will use the actual devices instead of silly links + # anyway. ;-) + break; + done +fi + +# Set root password: +/usr/lib/setup/SeTpasswd + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTfdHELP b/source/installer/sources/initrd/usr/lib/setup/SeTfdHELP new file mode 100755 index 00000000..d2e68b30 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTfdHELP @@ -0,0 +1,2 @@ +#!/bin/sh +dialog --title "Slackware Setup Help" --exit-label OK --textbox "/usr/lib/setup/FDhelp" 22 77 diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTfull b/source/installer/sources/initrd/usr/lib/setup/SeTfull new file mode 100755 index 00000000..bd32f319 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTfull @@ -0,0 +1,24 @@ +#!/bin/sh +if [ "$TMP" = "" ]; then + TMP=/var/log/setup/tmp +fi +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# Test writing a 256K file and assume if it returns an error +# that it means the drive filled up +dd if=/dev/zero of=$TMP/SeTtestfull bs=1024 count=256 1> /dev/null 2> /dev/null +FULLERR=$? +rm -f $TMP/SeTtestfull +if [ ! "$FULLERR" = "0" ]; then + dialog --title "ERROR: TARGET PARTITION FULL" --msgbox "Setup has \ +detected that one or more of your target partitions has become full. \ +I'm sorry, but you will have to try installing again onto a partition \ +or partitions with more free space. You could also try selecting \ +fewer packages to \ +install. Since there is no longer any space for setup to make its \ +temporary files, this is an unrecoverable error. Press control-alt-delete \ +to reboot and try again. Before doing that, you might want to switch to \ +another console (Alt-F2) and use df (disk free utility) to see if you \ +can get an idea of how to avoid this the next time around." 14 65 +fi diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTkernel b/source/installer/sources/initrd/usr/lib/setup/SeTkernel new file mode 100755 index 00000000..6aa3091b --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTkernel @@ -0,0 +1,102 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" + +# First, determine our slackware kernel name: +for ELEMENT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do + if $(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | grep -q SLACK_KERNEL) ; then + SLACK_KERNEL=$(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | cut -f 2 -d =) + fi +done +unset ELEMENT + +# Next, find the kernel's release version: +VERSION=$(uname -r | tr - _) + +# If someone tries to install kernels from a CD that doesn't contain any, +# we'll give them one chance to find a disc that does. +swapdisks() { + if [ -r ${T_PX}/var/log/setup/tmp/SeTCDdev ]; then + CDDEVICE=$(cat ${T_PX}/var/log/setup/tmp/SeTCDdev) + elif [ -r /tmp/SeTCDdev ]; then + CDDEVICE=$(cat /tmp/SeTCDdev) + else + return 1 + fi + umount $CDDEVICE 1> /dev/null 2> /dev/null + eject -s $CDDEVICE + dialog --title "REINSERT KERNEL DISC" --msgbox \ +"Please reinsert the Slackware disc containing the collection \ +of Linux kernels. Usually this is disc number one (the disc \ +that you boot from). Once you've inserted the disc, hit ENTER \ +to continue." \ +8 61 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + if [ ! $? = 0 ]; then + sleep 1 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + if [ ! $? = 0 ]; then + sleep 11 + mount $CDDEVICE /var/log/mount 1> /dev/null 2> /dev/null + fi + fi +} + +( cd boot + if [ "$SLACK_KERNEL" = "generic.s" ]; then + if [ -r vmlinuz-generic-$VERSION ]; then + ln -sf vmlinuz-generic-$VERSION vmlinuz + ln -sf config-generic-$VERSION config + ln -sf System.map-huge-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "huge.s" ]; then + if [ -r vmlinuz-huge-$VERSION ]; then + ln -sf vmlinuz-huge-$VERSION vmlinuz + ln -sf config-huge-$VERSION config + ln -sf System.map-huge-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "hugesmp.s" ]; then + if [ -r vmlinuz-huge-smp-$VERSION ]; then + ln -sf vmlinuz-huge-smp-$VERSION vmlinuz + ln -sf config-huge-smp-$VERSION config + ln -sf System.map-huge-smp-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "gensmp.s" ]; then + if [ -r vmlinuz-generic-smp-$VERSION ]; then + ln -sf vmlinuz-generic-smp-$VERSION vmlinuz + ln -sf config-generic-smp-$VERSION config + ln -sf System.map-generic-smp-$VERSION System.map + fi + elif [ "$SLACK_KERNEL" = "speakup.s" ]; then + # This assumes symlinks /nfs and /cdrom both pointing to /var/log/mount: + if $(mount | grep -q "type nfs") ; then + PLINK=nfs + else + PLINK=cdrom + fi + if [ $PLINK = cdrom -a ! -d /$PLINK/kernels ]; then + swapdisks + fi + if [ ! -d /$PLINK/kernels ]; then + dialog --title "ERROR ATTEMPTING TO INSTALL KERNEL" --msgbox "Sorry, but the directory /$PLINK/kernels \ +was not found. You may need to install the requested kernel $SLACK_KERNEL manually \ +and then install LILO \ +before your system will be able to boot correctly." \ +0 0 + else + rm -f $T_PX/boot/vmlinuz $T_PX/boot/config $T_PX/boot/System.map + cp -a /$PLINK/kernels/$SLACK_KERNEL/bzImage $T_PX/boot/vmlinuz-$SLACK_KERNEL-$VERSION + cp -a /$PLINK/kernels/$SLACK_KERNEL/config $T_PX/boot/config-$SLACK_KERNEL-$VERSION + cp -a /$PLINK/kernels/$SLACK_KERNEL/System.map.gz $T_PX/boot + ( cd $T_PX/boot + gzip -d System.map.gz + mv System.map System.map-$SLACK_KERNEL-$VERSION + ln -sf vmlinuz-$SLACK_KERNEL-$VERSION vmlinuz + ln -sf config-$SLACK_KERNEL-$VERSION config + ln -sf System.map-$SLACK_KERNEL-$VERSION System.map + ) + fi + fi +) + +# and after all that hard work diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTkeymap b/source/installer/sources/initrd/usr/lib/setup/SeTkeymap new file mode 100755 index 00000000..e8ac9639 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTkeymap @@ -0,0 +1,220 @@ +#!/bin/sh +# Copyright 1993, 1999, 2002 Patrick Volkerding, Moorhead, MN. +# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, USA +# Use and redistribution covered by the same terms as the "setup" script. +TMP=/var/log/setup/tmp +RDIR=/dev/tty4 +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +while [ 0 ]; do +dialog --title "KEYBOARD MAP SELECTION" --menu "You may select one \ +of the following keyboard maps. If you do not select a keyboard \ +map, 'us.map' (the US keyboard map) is the default. Use the UP/DOWN \ +arrow keys and PageUp/PageDown to scroll \ +through the whole list of choices." \ +22 55 11 \ +"qwerty/us.map" "" \ +"qwerty/uk.map" "" \ +"azerty/azerty.map" "" \ +"azerty/be-latin1.map" "" \ +"azerty/fr-latin0.map" "" \ +"azerty/fr-latin1.map" "" \ +"azerty/fr-latin9.map" "" \ +"azerty/fr-old.map" "" \ +"azerty/fr-pc.map" "" \ +"azerty/fr.map" "" \ +"azerty/wangbe.map" "" \ +"azerty/wangbe2.map" "" \ +"colemak/en-latin9.map" "" \ +"dvorak/ANSI-dvorak.map" "" \ +"dvorak/dvorak-fr.map" "" \ +"dvorak/dvorak-l.map" "" \ +"dvorak/dvorak-r.map" "" \ +"dvorak/dvorak.map" "" \ +"dvorak/no-dvorak.map" "" \ +"fgGIod/tr_f-latin5.map" "" \ +"fgGIod/trf-fgGIod.map" "" \ +"olpc/es-olpc.map" "" \ +"olpc/pt-olpc.map" "" \ +"qwerty/bashkir.map" "" \ +"qwerty/bg-cp1251.map" "" \ +"qwerty/bg-cp855.map" "" \ +"qwerty/bg_bds-cp1251.map" "" \ +"qwerty/bg_bds-utf8.map" "" \ +"qwerty/bg_pho-cp1251.map" "" \ +"qwerty/bg_pho-utf8.map" "" \ +"qwerty/br-abnt.map" "" \ +"qwerty/br-abnt2.map" "" \ +"qwerty/br-latin1-abnt2.map" "" \ +"qwerty/br-latin1-us.map" "" \ +"qwerty/by-cp1251.map" "" \ +"qwerty/by.map" "" \ +"qwerty/bywin-cp1251.map" "" \ +"qwerty/cf.map" "" \ +"qwerty/cz-cp1250.map" "" \ +"qwerty/cz-lat2-prog.map" "" \ +"qwerty/cz-lat2.map" "" \ +"qwerty/cz-qwerty.map" "" \ +"qwerty/defkeymap.map" "" \ +"qwerty/defkeymap_V1.0.map" "" \ +"qwerty/dk-latin1.map" "" \ +"qwerty/dk.map" "" \ +"qwerty/emacs.map" "" \ +"qwerty/emacs2.map" "" \ +"qwerty/es-cp850.map" "" \ +"qwerty/es.map" "" \ +"qwerty/et-nodeadkeys.map" "" \ +"qwerty/et.map" "" \ +"qwerty/fi-latin1.map" "" \ +"qwerty/fi-latin9.map" "" \ +"qwerty/fi-old.map" "" \ +"qwerty/fi.map" "" \ +"qwerty/gr-pc.map" "" \ +"qwerty/gr.map" "" \ +"qwerty/hu101.map" "" \ +"qwerty/il-heb.map" "" \ +"qwerty/il-phonetic.map" "" \ +"qwerty/il.map" "" \ +"qwerty/is-latin1-us.map" "" \ +"qwerty/is-latin1.map" "" \ +"qwerty/it-ibm.map" "" \ +"qwerty/it.map" "" \ +"qwerty/it2.map" "" \ +"qwerty/jp106.map" "" \ +"qwerty/kazakh.map" "" \ +"qwerty/ky_alt_sh-UTF-8.map" "" \ +"qwerty/kyrgyz.map" "" \ +"qwerty/la-latin1.map" "" \ +"qwerty/lt.baltic.map" "" \ +"qwerty/lt.l4.map" "" \ +"qwerty/lt.map" "" \ +"qwerty/mk-cp1251.map" "" \ +"qwerty/mk-utf.map" "" \ +"qwerty/mk.map" "" \ +"qwerty/mk0.map" "" \ +"qwerty/nl.map" "" \ +"qwerty/nl2.map" "" \ +"qwerty/no-latin1.map" "" \ +"qwerty/no.map" "" \ +"qwerty/pc110.map" "" \ +"qwerty/pl.map" "" \ +"qwerty/pl1.map" "" \ +"qwerty/pl2.map" "" \ +"qwerty/pl3.map" "" \ +"qwerty/pl4.map" "" \ +"qwerty/pt-latin1.map" "" \ +"qwerty/pt-latin9.map" "" \ +"qwerty/pt.map" "" \ +"qwerty/ro.map" "" \ +"qwerty/ro_std.map" "" \ +"qwerty/ru-cp1251.map" "" \ +"qwerty/ru-ms.map" "" \ +"qwerty/ru-yawerty.map" "" \ +"qwerty/ru.map" "" \ +"qwerty/ru1.map" "" \ +"qwerty/ru2.map" "" \ +"qwerty/ru3.map" "" \ +"qwerty/ru4.map" "" \ +"qwerty/ru_win.map" "" \ +"qwerty/ruwin_alt-CP1251.map" "" \ +"qwerty/ruwin_alt-KOI8-R.map" "" \ +"qwerty/ruwin_alt-UTF-8.map" "" \ +"qwerty/ruwin_cplk-CP1251.map" "" \ +"qwerty/ruwin_cplk-KOI8-R.map" "" \ +"qwerty/ruwin_cplk-UTF-8.map" "" \ +"qwerty/ruwin_ct_sh-CP1251.map" "" \ +"qwerty/ruwin_ct_sh-KOI8-R.map" "" \ +"qwerty/ruwin_ct_sh-UTF-8.map" "" \ +"qwerty/ruwin_ctrl-CP1251.map" "" \ +"qwerty/ruwin_ctrl-KOI8-R.map" "" \ +"qwerty/ruwin_ctrl-UTF-8.map" "" \ +"qwerty/se-fi-ir209.map" "" \ +"qwerty/se-fi-lat6.map" "" \ +"qwerty/se-ir209.map" "" \ +"qwerty/se-lat6.map" "" \ +"qwerty/se-latin1.map" "" \ +"qwerty/sk-prog-qwerty.map" "" \ +"qwerty/sk-qwerty.map" "" \ +"qwerty/speakup-jfw.map" "" \ +"qwerty/speakupmap.map" "" \ +"qwerty/sr-cy.map" "" \ +"qwerty/sv-latin1.map" "" \ +"qwerty/tj_alt-UTF8.map" "" \ +"qwerty/tr_q-latin5.map" "" \ +"qwerty/tralt.map" "" \ +"qwerty/trf.map" "" \ +"qwerty/trq.map" "" \ +"qwerty/ttwin_alt-UTF-8.map" "" \ +"qwerty/ttwin_cplk-UTF-8.map" "" \ +"qwerty/ttwin_ct_sh-UTF-8.map" "" \ +"qwerty/ttwin_ctrl-UTF-8.map" "" \ +"qwerty/ua-cp1251.map" "" \ +"qwerty/ua-utf-ws.map" "" \ +"qwerty/ua-utf.map" "" \ +"qwerty/ua-ws.map" "" \ +"qwerty/ua.map" "" \ +"qwerty/uk.map" "" \ +"qwerty/us-acentos.map" "" \ +"qwerty/us.map" "" \ +"qwertz/croat.map" "" \ +"qwertz/cz-us-qwertz.map" "" \ +"qwertz/cz.map" "" \ +"qwertz/de-latin1-nodeadkeys.map" "" \ +"qwertz/de-latin1.map" "" \ +"qwertz/de-mobii.map" "" \ +"qwertz/de.map" "" \ +"qwertz/de_CH-latin1.map" "" \ +"qwertz/de_alt_UTF-8.map" "" \ +"qwertz/fr_CH-latin1.map" "" \ +"qwertz/fr_CH.map" "" \ +"qwertz/hu.map" "" \ +"qwertz/sg-latin1-lk450.map" "" \ +"qwertz/sg-latin1.map" "" \ +"qwertz/sg.map" "" \ +"qwertz/sk-prog-qwertz.map" "" \ +"qwertz/sk-qwertz.map" "" \ +"qwertz/slovene.map" "" \ + 2> $TMP/SeTkeymap + if [ ! $? = 0 ]; then + rm -f $TMP/SeTkeymap + exit + fi + MAPNAME="`cat $TMP/SeTkeymap`" + MAPNAME="`basename $MAPNAME`" + echo $MAPNAME > $TMP/SeTkeymap + BMAP="`basename $MAPNAME .map`.bmap" + tar xzOf /etc/keymaps.tar.gz $BMAP > /dev/null && tar xzOf /etc/keymaps.tar.gz $BMAP | loadkmap + + while [ 0 ]; do + # Match the dialog colors a little while doing the keyboard test: + setterm -background cyan -foreground black -blank 0 + clear + cat << EOF + + + OK, the new map is now installed. You may now test it by typing + anything you want. To quit testing the keyboard, enter 1 on a + line by itself to accept the map and go on, or 2 on a line by + itself to reject the current keyboard map and select a new one. + +EOF + echo -n " " + read REPLY + if [ "$REPLY" = "1" -o "$REPLY" = "2" ]; then + break; + fi + done + setterm -background black -foreground white -blank 0 + if [ "$REPLY" = "1" ]; then + # Make a persistent (P) copy so starting setup won't erase it: + cp $TMP/SeTkeymap $TMP/Pkeymap + break; + else + rm -f $TMP/$MAPNAME + rm -f $TMP/SeTkeymap $TMP/Pkeymap + # Clear bad selection: + tar xzOf /etc/keymaps.tar.gz us.bmap > /dev/null && tar xzOf /etc/keymaps.tar.gz us.bmap | loadkmap + continue; + fi +done diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTmaketag b/source/installer/sources/initrd/usr/lib/setup/SeTmaketag new file mode 100755 index 00000000..18fba3af --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTmaketag @@ -0,0 +1,154 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +MOUNT=/tag +mkdir -p $MOUNT +dialog --title "CREATE CUSTOM TAGFILES" --yesno "Tagfiles are special files \ +found on the first disk of a series that can determine which packages are \ +installed and which are skipped. Deciding which files to install in advance \ +can speed up the installation process greatly. If you have not installed \ +Slackware Linux before, you should probably try installing using the \ +default tagfiles before you try making custom ones, because you won't see much \ +information about the package contents when creating your tagfiles. This \ +process assumes you already know which packages you want to install. \ +If you're not sure, back out now and just use the default tagfiles when \ +you install. \ +Do you want to create custom tagfiles?" 17 65 +if [ ! $? = 0 ]; then + exit +fi +dialog --title "ENTER CUSTOM TAGFILE EXTENSION" --inputbox "Now you must \ +enter a custom file extension. This will be used as the last part of the \ +filename for your new custom tagfiles. For example, I use '.pat' for my \ +custom extension, and my custom tagfiles on the first disk of each series \ +have the filename 'tagfile.pat'. Use any extension you like except .tgz or \ +.tar. The extension must consist of a period followed by exactly 3 \ +letters." 14 65 2> $TMP/SeTtagmake +if [ ! $? = 0 -o ! "`cat $TMP/SeTtagmake | cut -b1`" = "." -o "`cat $TMP/SeTtagmake`" = "" ]; then + rm -f $TMP/SeTtagmake + exit +fi +TAGEXT="`cat $TMP/SeTtagmake`" +dialog --title "USE EXPERT MENUS?" --menu "If you like, you may select your \ +packages from expert menus. Where the normal menu shows a choice like 'C \ +compiler system', the expert menus show you 'C libs', 'C compiler', 'C \ +include files', etc -- each individual package. Obviously, you should \ +know what you're doing if you use the expert menus since it's possible \ +to skip packages that are crucial to the functioning of a subsystem." \ +15 65 2 \ +"normal" "Use normal menus that select groups of packages" \ +"expert" "Use expert menus with a switch for each package" 2> $TMP/SeTreturn +if [ ! $? = 0 ]; then + rm -f $TMP/SeTreturn + exit +fi +MENU="`cat $TMP/SeTreturn`" +rm -f $TMP/SeTreturn +if [ "$MENU" = "normal" ]; then + MAKETAG="maketag.ez" +else + MAKETAG="maketag" +fi +while [ 0 ]; do + dialog --title "CUSTOMIZE A DISK SERIES" --menu "You may now \ +create a custom tagfile on the first disk of a disk series (make \ +sure it's not write protected!), or in the directory for such a \ +disk if you are installing from your hard drive. Select one of the \ +choices below." 13 65 3 \ +"/dev/fd0" "Create a custom tagfile on floppy drive 1" \ +"/dev/fd1" "Create a custom tagfile on floppy drive 2" \ +"Directory" "Create a tagfile in a disk's directory" 2> $TMP/SeTreturn + if [ ! $? = 0 ]; then + rm -f $TMP/SeTreturn + break + fi + CHOICE="`cat $TMP/SeTreturn`" + rm -f $TMP/SeTreturn + if [ "$CHOICE" = "/dev/fd0" -o "$CHOICE" = "/dev/fd1" ]; then + dialog --title "INSERT DISK IN DRIVE $CHOICE" --msgbox "Please insert the first disk of \ +a disk series you would like to make a custom tagfile for and press \ +ENTER. Be sure this disk is not write protected." 7 60 + if [ ! $? = 0 ]; then + continue + fi + mount $CHOICE $MOUNT -t msdos + if [ ! $? = 0 ]; then + dialog --title "MOUNT FAILURE" --msgbox "Sorry, the disk could not be \ +mounted in drive $CHOICE as type msdos." 6 60 + umount $MOUNT 2> /dev/null + continue + fi + if [ -r $MOUNT/$MAKETAG -o $MOUNT/maketag ]; then + if [ -r $MOUNT/$MAKETAG ]; then + sh $MOUNT/$MAKETAG + else + sh $MOUNT/maketag + fi + else # no tagfile create script! + dialog --title "NO TAGFILE SCRIPT" --msgbox "Sorry, but a custom tagfile \ +cannot be created for this disk because it does not have a 'maketag' script. \ +The maketag script was introduced in Slackware 1.1.2, and provides the menu \ +of packages to select from. Currently there is no way to just look at the \ +disks and 'wing it', but maybe there will be eventually. You'll have to edit \ +the tagfile on this disk manually." 11 65 + umount $MOUNT + continue + fi + if [ ! -r $TMP/SeTnewtag ]; then + umount $MOUNT + continue + fi + cp $TMP/SeTnewtag $MOUNT/tagfile$TAGEXT + if [ $? = 0 ]; then + dialog --title "TAGFILE CREATED" --msgbox "Your custom \ +tagfile has been successfully created with the extension: \ +$TAGEXT" 8 40 + else + dialog --title "COPY ERROR" --msgbox "Your custom tagfile could \ +not be copied to the disk. Please check to see if the disk is write \ +protected, or full, and then try again." 9 40 + fi + umount $MOUNT + fi + if [ "$CHOICE" = "Directory" ]; then + dialog --title "CHOOSE DIRECTORY" --inputbox "Now you must enter the \ +directory for the first disk of the series for which you would like to \ +make a custom tagfile. This directory must be mounted somewhere under \ +the current filesystem." 11 65 2> $TMP/SeTreturn + if [ ! $? = 0 ]; then + rm -f $TMP/SeTreturn + continue + fi + DIR="`cat $TMP/SeTreturn`" + rm -f $TMP/SeTreturn + if [ ! -r $DIR/maketag -a ! -r $DIR/$MAKETAG ]; then + dialog --title "NO TAGFILE SCRIPT" --msgbox "Sorry, but a custom tagfile \ +cannot be created for this disk series because the directory you gave does \ +not have a 'maketag' script. \ +The maketag script was introduced in Slackware 1.1.2, and provides the menu \ +of packages to select from. Currently there is no way to just look at the \ +packages and 'wing it', but maybe there will be eventually. You'll have to \ +edit the tagfile in this directory manually." 11 65 + continue + fi + if [ -r $DIR/$MAKETAG ]; then + sh $DIR/$MAKETAG + else + sh $DIR/maketag + fi + if [ ! -r $TMP/SeTnewtag ]; then + continue + fi + cp $TMP/SeTnewtag $DIR/tagfile$TAGEXT + if [ $? = 0 ]; then + dialog --title "TAGFILE CREATED" --msgbox "Your custom \ +tagfile has been successfully created with the extension: \ +$TAGEXT" 8 40 + else + dialog --msgbox "I don't know what just happened, but something \ +screwed up." 6 40 + fi + fi +done diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTmedia b/source/installer/sources/initrd/usr/lib/setup/SeTmedia new file mode 100755 index 00000000..65e05f4d --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTmedia @@ -0,0 +1,47 @@ +#!/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 a Slackware CD or DVD" \ +"2" "Install from a Slackware USB stick" \ +"3" "Install from a hard drive partition" \ +"4" "Install from NFS (Network File System)" \ +"5" "Install from FTP/HTTP server" \ +"6" "Install from Samba share" \ +"7" "Install from a pre-mounted directory" \ +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 + INSCD +elif [ "$SOURCE_MEDIA" = "2" ]; then + INSUSB +elif [ "$SOURCE_MEDIA" = "3" ]; then + INShd +elif [ "$SOURCE_MEDIA" = "4" ]; then + SeTnet + INSNFS +elif [ "$SOURCE_MEDIA" = "5" ]; then + SeTnet + INSURL +elif [ "$SOURCE_MEDIA" = "6" ]; then + SeTnet + INSSMB +elif [ "$SOURCE_MEDIA" = "7" ]; then + INSdir +fi + +# Sorry, this goes the way of the dinosaur... +#"5" "Install from floppy disks (A and N series only)" + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTnet b/source/installer/sources/initrd/usr/lib/setup/SeTnet new file mode 100755 index 00000000..0caefa64 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTnet @@ -0,0 +1,360 @@ +#!/bin/sh +# This script will be called with the single argument of "boot" during the +# system startup, to allow for unattended network configuration. +# For this to work, all required information must be passed on the commandline. +# Two parameters, 'kbd=' and 'nic=' must be used to supply this information. +# kbd=<keyboard_layout> +# nic=<driver>:<interface>:<dhcp|static>[:ipaddr:netmask[:gateway]] + +TMP=/var/log/setup/tmp +T_PX="$(cat $TMP/SeTT_PX 2> /dev/null)" +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +# Terminate the script now if we have an interface with an IP address: +# Running the script is not needed anymore in that case. +if `ip -f inet -o addr show | grep -v " lo " 1>/dev/null 2>/dev/null` ; then + exit 0 +fi + +# Function to convert the netmask from CIDR format to dot notation. +cidr_cvt() { + inform=$1 + if [ $inform -ge 32 ]; then outform='255.255.255.255' + elif [ $inform -ge 31 ]; then outform='255.255.255.254' + elif [ $inform -ge 30 ]; then outform='255.255.255.252' + elif [ $inform -ge 29 ]; then outform='255.255.255.248' + elif [ $inform -ge 28 ]; then outform='255.255.255.240' + elif [ $inform -ge 27 ]; then outform='255.255.255.224' + elif [ $inform -ge 26 ]; then outform='255.255.255.192' + elif [ $inform -ge 25 ]; then outform='255.255.255.128' + elif [ $inform -ge 24 ]; then outform='255.255.255.0' + elif [ $inform -ge 23 ]; then outform='255.255.254.0' + elif [ $inform -ge 22 ]; then outform='255.255.252.0' + elif [ $inform -ge 21 ]; then outform='255.255.248.0' + elif [ $inform -ge 20 ]; then outform='255.255.240.0' + elif [ $inform -ge 19 ]; then outform='255.255.224.0' + elif [ $inform -ge 18 ]; then outform='255.255.192.0' + elif [ $inform -ge 17 ]; then outform='255.255.128.0' + elif [ $inform -ge 16 ]; then outform='255.255.0.0' + elif [ $inform -ge 15 ]; then outform='255.254.0.0' + elif [ $inform -ge 14 ]; then outform='255.252.0.0' + elif [ $inform -ge 13 ]; then outform='255.248.0.0' + elif [ $inform -ge 12 ]; then outform='255.240.0.0' + elif [ $inform -ge 11 ]; then outform='255.224.0.0' + elif [ $inform -ge 10 ]; then outform='255.192.0.0' + elif [ $inform -ge 9 ]; then outform='255.128.0.0' + elif [ $inform -ge 8 ]; then outform='255.0.0.0' + elif [ $inform -ge 7 ]; then outform='254.0.0.0' + elif [ $inform -ge 6 ]; then outform='252.0.0.0' + elif [ $inform -ge 5 ]; then outform='248.0.0.0' + elif [ $inform -ge 4 ]; then outform='240.0.0.0' + elif [ $inform -ge 3 ]; then outform='224.0.0.0' + elif [ $inform -ge 2 ]; then outform='192.0.0.0' + elif [ $inform -ge 1 ]; then outform='128.0.0.0' + elif [ $inform -ge 0 ]; then outform='0.0.0.0' + fi + echo $outform +} + +# First, sane defaults: +INTERFACE="" +ENET_MODE="ask" +# Does the commandline have NIC information for us? +# Format is 'nic=driver:interface:<dhcp|static>:ip:mask:gw' +for CMDELEM in $(cat /proc/cmdline) ; do + if $(echo $CMDELEM | grep -q "^nic=") ; then + DRIVER=$(echo $CMDELEM | cut -f2 -d=) + INTERFACE=$(echo $DRIVER | cut -f2 -d:) + ENET_MODE=$(echo $DRIVER | cut -f3 -d:) + if [ "$ENET_MODE" = "static" ]; then + IPADDR=$(echo $DRIVER | cut -f4 -d:) + NETMASK=$(echo $DRIVER | cut -f5 -d:) + # We allow for CIDR notation of the netmask (0 < NETMASK < 25): + if [ "$(echo $NETMASK | tr -cd '\.')" != "..." ]; then + NETMASK=$(cidr_cvt $NETMASK) + fi + GATEWAY=$(echo $DRIVER | cut -f6 -d:) + fi + DRIVER=$(echo $DRIVER | cut -f1 -d:) + break + fi +done + +# If the script has an argument of 'boot' then we require all information for +# unattended network setup or else we silently exit. +if [ "$1" = "boot" ]; then + if [ "x$DRIVER" = "x" -o "x$INTERFACE" = "x" -o "$ENET_MODE" = "ask" ]; then + exit 2 + elif [ "$ENET_MODE" = "static" ] && [ "x$IPADDR" = "x" -o "x$NETMASK" = "x" ]; then + exit 2 + fi +fi + +# If the cmdline provided the name of a driver, load it; +# Alternatively check if the user ran "network" before running "setup"; +# We need an interface: +if [ `cat /proc/net/dev | grep ':' | sed -e "s/^ *//" | cut -f1 -d: | grep -v lo | wc -l` = 0 ]; then + if [ "x${DRIVER}" != "x" ]; then + # This takes silent care of 'DRIVER=auto' as well... + modprobe ${DRIVER} 1>/dev/null 2>/dev/null + else + while [ 0 ]; do + cat << EOF > $TMP/tempmsg + +You will now get a chance to probe your network interfaces. + +EOF + dialog --title "PROBING NETWORK DEVICES" --msgbox "`cat $TMP/tempmsg`" 7 68 + clear + rm -f $TMP/tempmsg + /bin/network --installer + read -p "Press any key..." JUNK + sleep 5 # Give dhcpcd a change to probe + unset JUNK + cat << EOF > $TMP/tempmsg + +Are you OK with the network interface which was detected? +If not, select 'No' to get back to the network probe program. +You can try to load another driver explicitly, +by using "P <driver_name>". + +If you are satisfied, select 'Yes' to continue with network configuration. +EOF + dialog --title "PROBING NETWORK DEVICES" --yesno "`cat $TMP/tempmsg`" 12 68 + if [ $? = 0 ]; then + rm -f $TMP/tempmsg + break + fi + clear + done + fi +fi + +# If we obtained information from a DHCP server, use it: +if [ "x$INTERFACE" = "x" -o "$INTERFACE" = "auto" ]; then + # the cmdline did not provide a nic or it's "auto" to let dhcpcd find out: + if [ "$INTERFACE" = "auto" ]; then + # hope that 3 seconds is enough for dhcpcd; + # if not then you had better specify the INTERFACE in the nic= parameter... + dialog --title "INITIALIZING NETWORK" --infobox \ + "\nWaiting a few seconds for DHCP polling to settle ..." 5 56 + sleep 3 + fi + clear + for I_I in \ + $(cat /proc/net/dev | grep ':' | sed -e "s/^ *//" | cut -f1 -d: | grep -v lo) ; + do + if [ -s /etc/dhcpc/dhcpcd-${I_I}.info ]; then + INTERFACE="${I_I}" + break + fi + done + unset I_I + if [ "$INTERFACE" = "auto" ]; then # failed to find a configured interface + INTERFACE="" + fi +fi + +while [ 0 ]; do + T_PX="$(cat $TMP/SeTT_PX 2> /dev/null)" + UPNRUN=1 + if [ "$T_PX" = "/" ]; then + cat << EOF > $TMP/tempmsg + +You're running off the hard drive filesystem. Is this machine +currently running on the network you plan to install from? If +so, we won't try to reconfigure your ethernet card. + +Are you up-and-running on the network? +EOF + dialog --title "NETWORK CONFIGURATION" --yesno "`cat $TMP/tempmsg`" 12 68 + UPNRUN=$? + clear + fi + if [ $UPNRUN = 1 ]; then + ENET_DEVICE=${INTERFACE:-"eth0"} + if [ "x$INTERFACE" != "x" ]; then # interface specified via cmdline or dhcpcd + if [ "$ENET_MODE" = "ask" ]; then + # Offer to install using DHCP: + cat << EOF > $TMP/tempmsg + +I can configure your network interface $ENET_DEVICE +fully automatically using DHCP. +If you want this, please select 'yes'. + +If you select 'no' instead, then you will be able to assign +the IP address, netmask and gateway manually. + +EOF + dialog --title "DHCP CONFIGURATION" --yesno "`cat $TMP/tempmsg`" 12 65 + if [ $? -eq 0 ]; then + rm -f $TMP/tempmsg + echo $ENET_DEVICE > $TMP/SeTdhcp + else + rm -f $TMP/SeTdhcp + fi + elif [ "$ENET_MODE" = "dhcp" ]; then # Don't ask, just use DHCP + echo $ENET_DEVICE > $TMP/SeTdhcp + fi + fi # End non-empty INTERFACE + clear + + if [ ! -r $TMP/SeTdhcp ]; then + # No DHCP configured, so use static IP. + # If we have all the values ready, don't ask any. + # Only if the script runs with the "boot" parameter will we silently accept + # an empty gateway address (if we came this far, we will have IP/netmask): + if [ "$1" = "boot" -a "x$GATEWAY" = "x" ]; then + HAVE_GATEWAY=1 + GATEWAY="unspec" + else + HAVE_GATEWAY=0 + fi + if [ "x$IPADDR" = "x" -o "x$NETMASK" = "x" -o "x$GATEWAY" = "x" ]; then + cat << EOF > $TMP/tempmsg + +You will need to enter the IP address you wish to +assign to this machine. Example: 111.112.113.114 + +What is your IP address? +EOF + if [ "$LOCAL_IPADDR" = "" ]; then # assign default + LOCAL_IPADDR=${IPADDR} + fi + dialog --title "ASSIGN IP ADDRESS" --inputbox "`cat $TMP/tempmsg`" 12 \ + 65 $LOCAL_IPADDR 2> $TMP/local + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/local + exit + fi + LOCAL_IPADDR="`cat $TMP/local`" + rm -f $TMP/local + clear + cat << EOF > $TMP/tempmsg + +Now we need to know your netmask. +Typically this will be 255.255.255.0 +but this can be different depending on +your local setup. + +What is your netmask? +EOF + if [ "$LOCAL_NETMASK" = "" ]; then # assign default + LOCAL_NETMASK=${NETMASK:-255.255.255.0} + fi + dialog --title "ASSIGN NETMASK" --inputbox "`cat $TMP/tempmsg`" 14 \ + 65 $LOCAL_NETMASK 2> $TMP/mask + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/mask + exit + fi + clear + LOCAL_NETMASK="`cat $TMP/mask`" + rm $TMP/mask + dialog --yesno "Do you have a gateway?" 5 30 + HAVE_GATEWAY=$? + clear + if [ "$HAVE_GATEWAY" = "0" ]; then + if [ "$LOCAL_GATEWAY" = "" ]; then + if [ "$GATEWAY" = "" ]; then + LOCAL_GATEWAY="`echo $LOCAL_IPADDR | cut -f1-3 -d '.'`." + else + LOCAL_GATEWAY=${GATEWAY} + fi + fi + dialog --title "ASSIGN GATEWAY ADDRESS" --inputbox \ + "\nWhat is the IP address for your gateway?" 9 65 \ + $LOCAL_GATEWAY 2> $TMP/gw + if [ ! $? = 0 ]; then + rm -f $TMP/tempmsg $TMP/gw + exit + fi + LOCAL_GATEWAY="`cat $TMP/gw`" + rm -f $TMP/gw + fi + clear + else + # Non-interactive run, so we use the values set on the commandline: + LOCAL_IPADDR=${IPADDR} + LOCAL_NETMASK=${NETMASK} + LOCAL_GATEWAY=${GATEWAY} + fi # end questions asked + fi # end static ip + + if [ "$ENET_MODE" = "ask" -a ! -r $TMP/SeTdhcp ]; then + cat << EOF > $TMP/tempmsg + +This is the proposed network configuration for $ENET_DEVICE - +If this is OK, then select 'Yes'. +If this is not OK and you want to configure again, select 'No'. + +* IP Address: $LOCAL_IPADDR +* Netmask: $LOCAL_NETMASK +EOF + if [ "$HAVE_GATEWAY" = 0 ]; then + echo "* Gateway: $LOCAL_GATEWAY" >> $TMP/tempmsg + fi + echo "" >> $TMP/tempmsg + dialog --no-collapse --title "NETWORK CONFIGURATION" --yesno "`cat $TMP/tempmsg`" 14 68 + if [ $? -eq 1 ]; then + continue # New round of questions + fi + fi # end ask approval for ip config + + #echo "Configuring ethernet card..." + dialog --title "INITIALIZING NETWORK" --infobox \ + "\nConfiguring your network interface $ENET_DEVICE ..." 5 56 + if [ -r $TMP/SeTdhcp ]; then + dhcpcd -k $ENET_DEVICE 1>/dev/null 2>&1 # Or else the '-T' will be used next: + sleep 3 + dhcpcd -L $ENET_DEVICE + else + dhcpcd -k $ENET_DEVICE 1>/dev/null 2>&1 # We don't need it now + # Broadcast and network are derived from IP and netmask: + LOCAL_BROADCAST=`ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 1 -d ' '` + LOCAL_NETWORK=`ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 2 -d ' '` + ifconfig $ENET_DEVICE $LOCAL_IPADDR netmask $LOCAL_NETMASK broadcast $LOCAL_BROADCAST + if [ "$HAVE_GATEWAY" = "0" ]; then + #echo "Configuring your gateway..." + route add default gw $LOCAL_GATEWAY metric 1 + fi + echo $LOCAL_IPADDR > $TMP/SeTIP + echo $LOCAL_NETMASK > $TMP/SeTnetmask + echo $LOCAL_GATEWAY > $TMP/SeTgateway + fi + fi # ! UPNRUN + clear + break + +done +echo $UPNRUN > $TMP/SeTupnrun + +# Basic initialisation completed. Let's see what the commandline has for us: +# If we know of a remote configuration file, get it now: +# Provide comma-separated values (protocol,remoteserver[:portnumber],configfile) +# like this example: 'cf=tftp,192.168.0.22,/slackware-12.1/configs/t43.cfg' +for CMDELEM in $(cat /proc/cmdline) ; do + if $(echo $CMDELEM | grep -q "^cf=") ; then + CONFIGFILE=$(echo $CMDELEM | cut -f2 -d=) + PROTO=$(echo $CONFIGFILE | cut -f1 -d,) + DLSERVER=$(echo $CONFIGFILE | cut -f2 -d,) + CONFIGFILE=$(echo $CONFIGFILE | cut -f3 -d,) + dialog --title "FETCHING CONFIGURATION" --infobox \ + "\nAttempting to fetch a remote configuration file using $PROTO ..." 54 56 + fi +done + +if [ -n "$CONFIGFILE" ]; then + if [ "$PROTO" = "tftp" ]; then + tftp -g -r $CONFIGFILE -l $TMP/Punattended $DLSERVER 1>/dev/null 2>&1 + elif [ "$PROTO" = "ftp" -o "$PROTO" = "http" ]; then + wget -q -P $TMP -O Punattended ${PROTO}://${DLSERVER}${CONFIGFILE} + fi +fi + +# Clear the screen, since it looks pretty messy due to some fun with the termcap +# over a serial console. +clear + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTnopart b/source/installer/sources/initrd/usr/lib/setup/SeTnopart new file mode 100755 index 00000000..1ac2cb0f --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTnopart @@ -0,0 +1 @@ +dialog --title "ERROR: No Linux Native Partitions" --exit-label OK --textbox "/usr/lib/setup/nopartHELP" 22 74 diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTpartitions b/source/installer/sources/initrd/usr/lib/setup/SeTpartitions new file mode 100755 index 00000000..34819701 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTpartitions @@ -0,0 +1,524 @@ +#!/bin/sh +# SeTpartition user-friendly rewrite Fri Dec 15 13:17:40 CST 1995 pjv +# Rewrite to support filesystem plugins <david@slackware.com>, 07-May-2001 +# Don't use plugins, make it work, pjv, 18-May-2001. +# Generalize tempscript creation and support JFS and XFS. pjv, 30-Mar-2002 + +TMP=/var/log/setup/tmp +NDIR=/dev/null +REDIR=/dev/tty4 +T_PX="`cat $TMP/SeTT_PX`" + +# FUNCTIONS + +# crunch() - remove extra whitespace +crunch () { + read STRING; + echo $STRING +} + +# make_btrfs( dev ) - Create a new btrfs filesystem on the named dev. +# Parameters: dev Device node to format. +make_btrfs() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem btrfs." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: btrfs " 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + mkfs.btrfs -f -d single -m single $1 1> $REDIR 2> $REDIR +} + +# make_ext2( dev, check ) - Create a new ext2 filesystem on the named +# device. +# Parameters: dev Device node to format. +# check Perform fs check (y or n) +make_ext2() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem ext2." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: ext2" 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + if [ "$2" = "y" ]; then + mkfs.ext2 -F -F -c $1 1> $REDIR 2> $REDIR + else + mkfs.ext2 -F -F $1 1> $REDIR 2> $REDIR + fi +} + +# make_ext3( dev, check ) - Create a new ext3 filesystem on the named +# device. +# Parameters: dev Device node to format. +# check Perform fs check (y or n) +make_ext3() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem ext3." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: ext3" 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + if [ "$2" = "y" ]; then + mkfs.ext3 -F -F -c $1 1> $REDIR 2> $REDIR + else + mkfs.ext3 -F -F $1 1> $REDIR 2> $REDIR + fi +} + +# make_ext4( dev, check ) - Create a new ext4 filesystem on the named +# device. +# Parameters: dev Device node to format. +# check Perform fs check (y or n) +make_ext4() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem ext4." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: ext4" 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + if [ "$2" = "y" ]; then + mkfs.ext4 -F -F -c $1 1> $REDIR 2> $REDIR + else + mkfs.ext4 -F -F $1 1> $REDIR 2> $REDIR + fi +} + +# make_jfs( dev, check ) - Create a new jfs filesystem on the named +# device. +# Parameters: dev Device node to format. +# check Perform fs check (y or n) +make_jfs() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem jfs." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: jfs" 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + if [ "$2" = "y" ]; then + mkfs.jfs -c -q $1 1> $REDIR 2> $REDIR + else + mkfs.jfs -q $1 1> $REDIR 2> $REDIR + fi +} + +# make_reiserfs( dev ) - Create a new reiserfs filesystem on the named dev. +# Parameters: dev Device node to format. +make_reiserfs() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem reiserfs." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: reiserfs " 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + echo "y" | mkreiserfs $1 1> $REDIR 2> $REDIR +} + +# make_xfs( dev ) - Create a new xfs filesystem on the named dev +# Parameters: dev Device node to format. +make_xfs() { + # get the size of the named partition + SIZE=`get_part_size $1` + # output a nice status message + dialog --title "FORMATTING" \ + --backtitle "Formatting $1 with filesystem xfs." \ + --infobox "Formatting $1 \n\ +Size: $SIZE \n\ +Filesystem type: xfs " 0 0 + # do the format + if mount | grep "$1 " 1> $NDIR 2> $NDIR ; then + umount $1 2> $NDIR + fi + mkfs.xfs -f $1 1> $REDIR 2> $REDIR +} + +# gen_part_list() - Prints out a partition listing for the system into the +gen_part_list() { + export COUNT=0 + cat $TMP/SeTplist | while [ 0 ]; do + read PARTITION; + if [ "$PARTITION" = "" ]; then + break; + fi + # Variables, variables, variables + NAME=`echo $PARTITION | crunch | cut -f 1 -d ' '` + ALTNAME="" + DEVICE=`echo "$PARTITION" | tr -d "*" | crunch | cut -f 1 -d ' '` + SIZE=`get_part_size $DEVICE` + # See if this partition is in use already + if grep "$DEVICE " $TMP/SeTnative 1> $NDIR; then # it's been used + ON=`grep "$DEVICE " $TMP/SeTnative | crunch | cut -f 2 -d ' '` + ALTNAME="$DEVICE on $ON Linux ${SIZE}" + fi + # Add a menu item + if [ "$ALTNAME" = "" ]; then + echo "\"$NAME\" \"Linux ${SIZE}\" \\" >> $TMP/tempscript + echo "false" > $TMP/SeTSKIP # this flag is used for non-root parts + else + echo "\"(IN USE)\" \"$ALTNAME\" \\" >> $TMP/tempscript + fi + done + echo "\"---\" \"(done adding partitions, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done adding partitions, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done adding partitions, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done adding partitions, continue with setup)\" \\" >> $TMP/tempscript + echo "\"---\" \"(done adding partitions, continue with setup)\" \\" >> $TMP/tempscript + echo "2> $TMP/return" >> $TMP/tempscript +} + +# ask_format( dev ) - Asks the user if he/she wants to format the named device +ask_format() { + dialog --backtitle "Do you want to format Linux partition ${1}?" \ + --title "FORMAT PARTITION $1" --menu "If this partition has \ +not been formatted, you should format it. NOTE: This will erase all data on \ +it. Would you like \ +to format this partition?" 12 70 3 \ + "Format" "Quick format with no bad block checking" \ + "Check" "Slow format that checks for bad blocks" \ + "No" "No, do not format this partition" 2> $TMP/return + if [ ! $? = 0 ]; then + rm -f $TMP/return + exit + fi +} + +# ask_fs( dev ) - Asks the user the type of filesystem to use for the named +# device. Answer in $TMP/return +ask_fs() { + unset BTRFS EXT2 EXT3 JFS REISERFS XFS + if grep -wq ext2 /proc/filesystems 1> $NDIR 2> $NDIR ; then + EXT2="Ext2 is the traditional Linux file system and is fast and stable. " + fi + if grep -wq ext3 /proc/filesystems 1> $NDIR 2> $NDIR ; then + EXT3="Ext3 is the journaling version of the Ext2 filesystem. " + DEFAULT=ext3 + fi + if grep -wq ext4 /proc/filesystems 1> $NDIR 2> $NDIR ; then + EXT4="Ext4 is the successor to the ext3 filesystem. " + DEFAULT=ext4 + fi + if grep -wq reiserfs /proc/filesystems 1> $NDIR 2> $NDIR ; then + REISERFS="ReiserFS is a journaling filesystem that stores all files and filenames in a balanced tree structure. " + fi + if grep -wq btrfs /proc/filesystems 1> $NDIR 2> $NDIR ; then + BTRFS="Btrfs is a B-tree copy-on-write filesystem. " + fi + # These last two will only be present if the user asked for a special kernel. + # They should probably be the default in that case. + if grep -wq jfs /proc/filesystems 1> $NDIR 2> $NDIR ; then + JFS="JFS is IBM's Journaled Filesystem, currently used in IBM enterprise servers. " + fi + if grep -wq xfs /proc/filesystems 1> $NDIR 2> $NDIR ; then + XFS="XFS is SGI's journaling filesystem that originated on IRIX. " + fi + cat << EOF > $TMP/tempscript +dialog --title "SELECT FILESYSTEM FOR $1" \\ +--backtitle "Partition $1 will be formatted." \\ +--default-item $DEFAULT --menu \\ +"Please select the type of filesystem to use for the specified \\ +device. Here are descriptions of the available filesystems: $EXT2 $EXT3 $EXT4 $JFS $REISERFS $XFS" \\ +0 0 0 \\ +EOF + if [ ! "$EXT2" = "" ]; then + echo "\"ext2\" \"Standard Linux Ext2 Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$EXT3" = "" ]; then + echo "\"ext3\" \"Ext3 Journaling Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$EXT4" = "" ]; then + echo "\"ext4\" \"Ext4 Journaling Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$JFS" = "" ]; then + echo "\"jfs\" \"IBM's Journaled Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$REISERFS" = "" ]; then + echo "\"reiserfs\" \"ReiserFS Journaling Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$BTRFS" = "" ]; then + echo "\"btrfs\" \"Btrfs Copy-on-Write B-tree Filesystem\" \\" >> $TMP/tempscript + fi + if [ ! "$XFS" = "" ]; then + echo "\"xfs\" \"SGI's Journaling Filesystem\" \\" >> $TMP/tempscript + fi + echo "2> $TMP/return" >> $TMP/tempscript + . $TMP/tempscript + if [ ! $? = 0 ]; then + rm -f $TMP/return + exit + fi +} + +# get_part_size( dev ) - Return the size in K, M, G, T, or P of the named partition. +get_part_size() { + numfmt --to=iec $(blockdev --getsize64 $1) +} + +# MAIN + +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +if [ ! -r $TMP/SeTplist ]; then + # Give warning? + exit +fi + +cat /dev/null >> $TMP/SeTnative + +cat << EOF > $TMP/tempscript +dialog --backtitle "Setting up root Linux partition." \\ +--title "Select Linux installation partition:" --ok-label Select --cancel-label Continue --menu \\ +"Please select a partition from the following list to use for your \\ +root (/) Linux partition." 13 70 5 \\ +EOF +gen_part_list + +. $TMP/tempscript +if [ ! $? = 0 ]; then + rm $TMP/tempscript + exit 255 # user abort +fi + +ROOT_DEVICE="`cat $TMP/return`" +rm $TMP/tempscript +if [ "$ROOT_DEVICE" = "---" ]; then + exit 255 +fi + +# format root partition? +ask_format $ROOT_DEVICE +DOFORMAT="`cat $TMP/return`" +rm -f $TMP/return +if [ ! "$DOFORMAT" = "No" ]; then + ask_fs $ROOT_DEVICE + ROOT_SYS_TYPE="`cat $TMP/return`" + rm -f $TMP/return + # create the filesystem + if [ "$ROOT_SYS_TYPE" = "ext2" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext2 $ROOT_DEVICE "y" + else + make_ext2 $ROOT_DEVICE "n" + fi + elif [ "$ROOT_SYS_TYPE" = "ext3" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext3 $ROOT_DEVICE "y" + else + make_ext3 $ROOT_DEVICE "n" + fi + elif [ "$ROOT_SYS_TYPE" = "ext4" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext4 $ROOT_DEVICE "y" + else + make_ext4 $ROOT_DEVICE "n" + fi + elif [ "$ROOT_SYS_TYPE" = "reiserfs" ]; then + make_reiserfs $ROOT_DEVICE + elif [ "$ROOT_SYS_TYPE" = "btrfs" ]; then + make_btrfs $ROOT_DEVICE + elif [ "$ROOT_SYS_TYPE" = "jfs" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_jfs $ROOT_DEVICE "y" + else + make_jfs $ROOT_DEVICE "n" + fi + elif [ "$ROOT_SYS_TYPE" = "xfs" ]; then + make_xfs $ROOT_DEVICE + fi +fi # DOFORMAT? + +# Sync before identifying and mounting the root device: +sync + +# Determine the filesystem type using blkid: +ROOT_SYS_TYPE=$(blkid -s TYPE $ROOT_DEVICE | cut -f 2 -d = | tr -d \") + +# Mount the root filesystem: +mount $ROOT_DEVICE $T_PX -t $ROOT_SYS_TYPE 1> $REDIR 2> $REDIR + +#echo "$ROOT_DEVICE / $ROOT_SYS_TYPE defaults 1 1" > $TMP/SeTnative +printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$ROOT_DEVICE" "/" "$ROOT_SYS_TYPE" "defaults" "1" "1" > $TMP/SeTnative +echo $ROOT_DEVICE > $TMP/SeTrootdev + +# done mounting the target root partition + +# More than one Linux partition +if [ ! "`cat $TMP/SeTplist | sed -n '2 p'`" = "" ]; then + while [ 0 ]; do # next partition loop + # OK, we will set this flag, and if we find an unused partition, we + # change it. If it doesn't get switched, we skip the next menu. + rm -f $TMP/SeTSKIP + echo "true" > $TMP/SeTSKIP + + cat << EOF > $TMP/tempscript + dialog --backtitle "Setting up other Linux partitions." \\ +--title "Select other Linux partitions for /etc/fstab" \\ +--ok-label Select --cancel-label Continue \\ +--menu "You seem to have more than one partition tagged as type Linux. \\ +You may use these to distribute your Linux system across more than \\ +one partition. Currently, you have $ROOT_DEVICE mounted as your / partition. \\ +You might want to mount directories such as /home or /usr/local \\ +on separate partitions. You should not try to mount /etc, /sbin, or /bin on \\ +their own partitions since they contain utilities needed to bring the system \\ +up and mount partitions. Also, do not reuse a partition that you've already \\ +entered before. Please select one of the Linux partitions listed below, or \\ +if you're done, hit <Continue>." 20 70 4 \\ +EOF + gen_part_list + + if [ "`cat $TMP/SeTSKIP`" = "true" ]; then + break; + fi + rm -rf $TMP/return + + . $TMP/tempscript + if [ ! $? = 0 ]; then + break; + fi + + NEXT_PARTITION=`cat $TMP/return` + if [ "$NEXT_PARTITION" = "---" ]; then + break; + elif [ "$NEXT_PARTITION" = "(IN USE)" ]; then + continue; + fi + + # We now have the next partition, ask the user what to do with it: + ask_format $NEXT_PARTITION + + DOFORMAT="`cat $TMP/return`" + rm -f $TMP/return + + BACKT="Partition $NEXT_PARTITION will not be reformatted." + if [ ! "$DOFORMAT" = "No" ]; then + ask_fs $NEXT_PARTITION + NEXT_SYS_TYPE="`cat $TMP/return`" + rm -f $TMP/return + BACKT="Partition $NEXT_PARTITION will be formatted with $NEXT_SYS_TYPE." + # create the filesystem + if [ "$NEXT_SYS_TYPE" = "ext2" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext2 $NEXT_PARTITION "y" + else + make_ext2 $NEXT_PARTITION "n" + fi + elif [ "$NEXT_SYS_TYPE" = "ext3" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext3 $NEXT_PARTITION "y" + else + make_ext3 $NEXT_PARTITION "n" + fi + elif [ "$NEXT_SYS_TYPE" = "ext4" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_ext4 $NEXT_PARTITION "y" + else + make_ext4 $NEXT_PARTITION "n" + fi + elif [ "$NEXT_SYS_TYPE" = "reiserfs" ]; then + make_reiserfs $NEXT_PARTITION + elif [ "$NEXT_SYS_TYPE" = "btrfs" ]; then + make_btrfs $NEXT_PARTITION + elif [ "$NEXT_SYS_TYPE" = "jfs" ]; then + if [ "$DOFORMAT" = "Check" ]; then + make_jfs $NEXT_PARTITION "y" + else + make_jfs $NEXT_PARTITION "n" + fi + elif [ "$NEXT_SYS_TYPE" = "xfs" ]; then + make_xfs $NEXT_PARTITION + fi + fi # DOFORMAT? + + # Now ask the user where to mount this new filesystem: + dialog --backtitle "$BACKT" --title \ +"SELECT MOUNT POINT FOR $NEXT_PARTITION" --inputbox \ +"OK, now you need to specify where you want the new partition mounted. \ +For example, if you want to put it under /usr/local, then respond: /usr/local\n\ +Where would you like to mount $NEXT_PARTITION?" 11 59 2> $TMP/return + if [ ! $? = 0 ]; then + continue + fi + + MTPT=`cat $TMP/return` + if [ "$MTPT" = "" ]; then # abort if blank + continue + fi + if [ "`echo "$MTPT" | cut -b1`" = " " ]; then # bail if 1st char is space + continue + fi + if [ ! "`echo "$MTPT" | cut -b1`" = "/" ]; then # add / to start of path + MTPT="/$MTPT" + fi + rm $TMP/return + + # Sync before identifying and mounting the partition: + sync + + # Create the mount point if it does not exist: + if [ ! -d ${T_PX}/$MTPT ]; then + mkdir -p ${T_PX}/$MTPT + fi + + # Determine the filesystem type using blkid: + NEXT_SYS_TYPE=$(blkid -s TYPE $NEXT_PARTITION | cut -f 2 -d = | tr -d \") + + # Mount the partition: + mount $NEXT_PARTITION ${T_PX}/$MTPT -t $NEXT_SYS_TYPE 1> $REDIR 2> $REDIR + + #echo "$NEXT_PARTITION $MTPT $NEXT_SYS_TYPE defaults 1 1" >> $TMP/SeTnative + printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$NEXT_PARTITION" "$MTPT" "$NEXT_SYS_TYPE" "defaults" "1" "2" >> $TMP/SeTnative + done # next partition loop +fi # more than one Linux partition + +# Done, report to the user: +cat << EOF > $TMP/tempmsg + +Adding this information to your /etc/fstab: + +EOF +cat $TMP/SeTnative >> $TMP/tempmsg +dialog --backtitle "Finished setting up Linux partitions." \ +--title "DONE ADDING LINUX PARTITIONS TO /etc/fstab" \ +--exit-label OK \ +--textbox $TMP/tempmsg 15 72 + +## More obsolete code from the floppy disk era: +## Now, move our /tmp storage onto the target partition if possible: +#/usr/lib/setup/migrate.sh + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTpasswd b/source/installer/sources/initrd/usr/lib/setup/SeTpasswd new file mode 100755 index 00000000..967ffd2e --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTpasswd @@ -0,0 +1,30 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +T_PX="`cat $TMP/SeTT_PX`" +while [ "`cat $T_PX/etc/shadow | grep 'root:' | cut -f 2 -d :`" = "" ]; do + # There is no root password + dialog --title "WARNING: NO ROOT PASSWORD DETECTED" --yesno "There is \ +currently no password set on the system administrator account (root). \ +It is recommended that you set one now so that it is active the first \ +time the machine is rebooted. This is especially important if you're \ +using a network enabled kernel and the machine is on an Internet \ +connected LAN. Would you like to set a root password?" 10 68 + if [ $? = 0 ] ; then + echo + echo + echo + chroot $T_PX /usr/bin/passwd root + echo + echo -n "Press [enter] to continue:" + read junk; + echo + # Here we drop through, and if there's still no password the menu + # runs again. + else + # Don't set a password: + break; + fi +done diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTpxe b/source/installer/sources/initrd/usr/lib/setup/SeTpxe new file mode 100755 index 00000000..55c8a83b --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTpxe @@ -0,0 +1,315 @@ +#!/bin/sh +# +# Copyright 2011 Eric Hameleers, Eindhoven, NL +# Copyright 2011 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. +# +# Bug reports, suggestions, etc for pxesetup: alien@slackware.com +# +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi + +# Function to convert the netmask from CIDR format to dot notation. +cidr_cvt() { + inform=$1 + if [ $inform -ge 32 ]; then outform='255.255.255.255' + elif [ $inform -ge 31 ]; then outform='255.255.255.254' + elif [ $inform -ge 30 ]; then outform='255.255.255.252' + elif [ $inform -ge 29 ]; then outform='255.255.255.248' + elif [ $inform -ge 28 ]; then outform='255.255.255.240' + elif [ $inform -ge 27 ]; then outform='255.255.255.224' + elif [ $inform -ge 26 ]; then outform='255.255.255.192' + elif [ $inform -ge 25 ]; then outform='255.255.255.128' + elif [ $inform -ge 24 ]; then outform='255.255.255.0' + elif [ $inform -ge 23 ]; then outform='255.255.254.0' + elif [ $inform -ge 22 ]; then outform='255.255.252.0' + elif [ $inform -ge 21 ]; then outform='255.255.248.0' + elif [ $inform -ge 20 ]; then outform='255.255.240.0' + elif [ $inform -ge 19 ]; then outform='255.255.224.0' + elif [ $inform -ge 18 ]; then outform='255.255.192.0' + elif [ $inform -ge 17 ]; then outform='255.255.128.0' + elif [ $inform -ge 16 ]; then outform='255.255.0.0' + elif [ $inform -ge 15 ]; then outform='255.254.0.0' + elif [ $inform -ge 14 ]; then outform='255.252.0.0' + elif [ $inform -ge 13 ]; then outform='255.248.0.0' + elif [ $inform -ge 12 ]; then outform='255.240.0.0' + elif [ $inform -ge 11 ]; then outform='255.224.0.0' + elif [ $inform -ge 10 ]; then outform='255.192.0.0' + elif [ $inform -ge 9 ]; then outform='255.128.0.0' + elif [ $inform -ge 8 ]; then outform='255.0.0.0' + elif [ $inform -ge 7 ]; then outform='254.0.0.0' + elif [ $inform -ge 6 ]; then outform='252.0.0.0' + elif [ $inform -ge 5 ]; then outform='248.0.0.0' + elif [ $inform -ge 4 ]; then outform='240.0.0.0' + elif [ $inform -ge 3 ]; then outform='224.0.0.0' + elif [ $inform -ge 2 ]; then outform='192.0.0.0' + elif [ $inform -ge 1 ]; then outform='128.0.0.0' + elif [ $inform -ge 0 ]; then outform='0.0.0.0' + fi + echo $outform +} + +# IP Address to integer conversion and back: +ip_to_int() { + IFS=. + set -f + set -- $1 + echo $(($1 << 24 | $2 << 16 | $3 << 8 | $4)) +} +int_to_ip() { + echo $(($1>>24)).$(($1>>16&0xff)).$(($1>>8&0xff)).$(($1&0xff)) +} + +# PXE configuration file: +echo "" > $TMP/SeTpxe + +# Find out what interface we are using. +# Does the commandline have NIC information for us? +# Format is 'nic=driver:interface:<dhcp|static>:ip:mask:gw' +unset INTERFACE +for CMDELEM in $(cat /proc/cmdline) ; do + if $(echo $CMDELEM | grep -q "^nic=") ; then + INTERFACE=$(echo $DRIVER | cut -f2 -d:) + fi +done +if [ "x$INTERFACE" = "x" ]; then # the cmdline did not provide a nic + INTERFACE=$(ip -f inet -o addr show |tr -s ' ' |grep -v " lo " |cut -f2 -d' ' |head -1) +fi +if [ "x$INTERFACE" = "x" ]; then # no network was configured at all?!? + cat <<EOF > $TMP/tempmsg + +Apparently you forgot to configure a network interface? \n\ +A PXE Server needs a configured network interface to work.\n\ +Please try again! + +EOF + dialog --title "UNCONFIGURED NETWORK DEVICE" --msgbox "$(cat $TMP/tempmsg)" 9 68 + rm -f $TMP/tempmsg + exit 1 +fi + +# If there is a DHCP server on the network, we should not activate one now: +if [ -r $TMP/Pdhcp ]; then + DHCP="no" +elif [ -s /etc/dhcpc/dhcpcd-${INTERFACE}.info ]; then + DHCP="no" +else + # Assume nothing... we will ask the user for confirmation later! + DHCP="yes" +fi + +# Start the interactive part: +dialog --backtitle "Slackware PXE Server." \ + --title "WELCOME TO PXE CONFIGURATION" --msgbox "\ +We will be asking you a few questions now.\n\ +The answers will be used to start a PXE service on this computer \ +which does not interfere with other services in your network.\ +\n\ +The only assumption is, that there is NO PXE service running \ +on your local network at this moment. +\n\ +If in doubt, leave the defaults." 0 0 + +if [ "$DHCP" = "yes" ]; then + # Be extra safe. Do not start a DHCP server if the user denies it: + dialog --title "ENABLE DHCP SERVER" --yesno " \ +No active DHCP server was found on your local network. \ +The Slackware PXE server needs a working DHCP server.\n\ +Do you want this computer to start its own DHCP server \ +(you can control what IP addresses are used by the DHCP server)?\n\ +Say 'YES' if you are certain your network has no DHCP server." 9 68 + if [ $? = 0 ]; then + DHCP="yes" + else + DHCP="no" + fi +fi + +# Assemble the network parameters: +LOCAL_IPADDR=$(ip -f inet -o addr show |tr -s ' ' |grep -v " lo " |head -1 |cut -f4 -d' ' |cut -f1 -d/) +LOCAL_NETMASK=$(ip -f inet -o addr show |tr -s ' ' |grep -v " lo " |head -1 |cut -f4 -d' ' |cut -f2 -d/) +LOCAL_GATEWAY=$(ip -f inet -o route show default |tr -s ' ' |cut -f3 -d' ') +LOCAL_NETMASK=$(cidr_cvt $LOCAL_NETMASK) +LOCAL_BROADCAST=$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR |cut -f 1 -d ' ') +LOCAL_NETWORK=$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR |cut -f 2 -d ' ') + +if [ "$DHCP" = "yes" ]; then + # Find out a suitable IP address range for the DHCP server. Involves magic: + I_LOCAL_IPADDR=$(ip_to_int "$LOCAL_IPADDR") + I_LOCAL_NETMASK=$(ip_to_int "$LOCAL_NETMASK") + I_MINLEASE_IP=$(( ($I_LOCAL_IPADDR & $I_LOCAL_NETMASK) + 1 )) + I_MAXLEASE_IP=$(( ($I_LOCAL_IPADDR | ${I_LOCAL_NETMASK}^0xffffffff) - 1 )) + if [ $(($I_MAXLEASE_IP - $I_LOCAL_IPADDR)) -ge 10 ]; then + # Use ten IP addresses in the top of the address range: + I_MINLEASE_IP=$(($I_MAXLEASE_IP - 9)) + elif [ $(($I_LOCAL_IPADDR - $I_MINLEASE_IP)) -ge 10 ]; then + # Use ten IP addresses in the bottom of the address range: + I_MAXLEASE_IP=$(($I_MINLEASE_IP + 9)) + else + # Small range, use what we can get: + I_MINLEASE_IP=$(($I_LOCAL_IPADDR + 1)) + fi + + MINLEASE_IP=$(int_to_ip "$I_MINLEASE_IP") + MAXLEASE_IP=$(int_to_ip "$I_MAXLEASE_IP") + + while [ 0 ]; do + ( dialog --stdout --backtitle "Slackware PXE Server." \ + --title "DHCP SERVER CONFIGURATION" \ + --cancel-label Restart \ + --form "\ +The PXE Service is going to run on $INTERFACE with these values \ +(the defaults should be OK). \n\ +You can change the range of IP addresses used by the DHCP server, if \ +IP addresses in the proposed range are used by computers in your LAN. \ +For instance, your default gateway if you have one. \n\ +\n\ +Also note that we will not validate any changes you make:" \ + 18 68 0 \ + "IP Address:" 1 1 "$LOCAL_IPADDR" 1 30 0 0 \ + "Netmask:" 2 1 "$LOCAL_NETMASK" 2 30 0 0 \ + "Gateway:" 3 1 "$LOCAL_GATEWAY" 3 30 0 0 \ + "Lowest DHCP Client Address:" 4 1 "$MINLEASE_IP" 4 30 15 0 \ + "Highest DHCP Client Address:" 5 1 "$MAXLEASE_IP" 5 30 15 0 \ + ) > $TMP/tempopts + + if [ $? = 0 ]; then + # Remember... busybox ash is no good with arrays :/ + local i=0 + rm $TMP/tempkeys + cat $TMP/tempopts | while read VALUE ; do + if [ $i = 0 ]; then echo "MINLEASE_IP=\"$VALUE\"" >> $TMP/tempkeys + elif [ $i = 1 ]; then echo "MAXLEASE_IP=\"$VALUE\"" >> $TMP/tempkeys + fi + i=$(expr $i + 1) + done + eval $(cat $TMP/tempkeys) + rm $TMP/tempopts + break + fi + done +fi # [ "$DHCP" = "yes" ] + +echo "DHCP=${DHCP}" >> $TMP/SeTpxe +echo "LOCAL_IPADDR=${LOCAL_IPADDR}" >> $TMP/SeTpxe +echo "LOCAL_NETMASK=${LOCAL_NETMASK}" >> $TMP/SeTpxe +echo "LOCAL_GATEWAY=${LOCAL_GATEWAY}" >> $TMP/SeTpxe +echo "LOCAL_BROADCAST=${LOCAL_BROADCAST}" >> $TMP/SeTpxe +echo "LOCAL_NETWORK=${LOCAL_NETWORK}" >> $TMP/SeTpxe +echo "MINLEASE_IP=${MINLEASE_IP}" >> $TMP/SeTpxe +echo "MAXLEASE_IP=${MAXLEASE_IP}" >> $TMP/SeTpxe + +# Write out a suitable dnsmasq configuration: +cat <<EOF > /etc/dnsmasq.conf +# We do not need dnsmasq to function as a DNS server: +port=0 + +# Write the pid file: +pid-file=/var/run/dnsmasq.pid + +# Start a TFTP server: +enable-tftp + +# Set the root directory for files available via FTP: +tftp-root=/var/lib/tftpboot + +# The boot filename: +dhcp-boot=/pxelinux.0 + +# Disable re-use of the DHCP servername and filename fields as extra +# option space. That's to avoid confusing some old or broken DHCP clients. +dhcp-no-override + +# Log connections so that we can display them on the console: +log-facility=/var/log/dnsmasq.log +log-dhcp + +# Custom path for the leases file: +dhcp-leasefile=$TMP/dnsmasq.leases + +# Craft a nice PXE menu: +pxe-prompt="Press F8 for boot menu", 3 + +# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86, +# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI +pxe-service=X86PC, "Boot from network", /var/lib/tftpboot/pxelinux + +# A boot service type of 0 is special, and will abort the +# net boot procedure and continue booting from local media. +pxe-service=X86PC, "Boot from local hard disk", 0 + +EOF + +if [ -n "$LOCAL_GATEWAY" ]; then + cat <<EOF >> /etc/dnsmasq.conf +# Override the default route supplied by dnsmasq, which assumes the +# router is the same machine as the one running dnsmasq. +#dhcp-option=option:router,${LOCAL_GATEWAY} +dhcp-option=3,${LOCAL_GATEWAY} + +EOF +else + cat <<EOF >> /etc/dnsmasq.conf +# Override the default route supplied by dnsmasq and send no default +# route at all. +dhcp-option=3 + +EOF +fi + +if [ "$DHCP" = "yes" ]; then + cat <<EOF >> /etc/dnsmasq.conf +# dnsmasq functions as a normal DHCP server, providing IP leases. +dhcp-range=${MINLEASE_IP},${MAXLEASE_IP},${LOCAL_NETMASK},1h + +EOF +else + cat <<EOF >> /etc/dnsmasq.conf +# There is an existing DHCP server on this LAN, so dnsmasq functions +# as a proxy DHCP server providing boot information but no IP leases. +# Any ip in the subnet will do, so you may just put your server NIC ip here. +dhcp-range=${LOCAL_IPADDR},proxy + +EOF +fi + +# Create the pxelinux configuration file: +cat <<EOF > /var/lib/tftpboot/pxelinux.cfg/default +default huge.s +prompt 1 +timeout 1200 +display message.txt +F1 message.txt +F2 f2.txt +label huge.s + kernel kernels/huge.s/bzImage + append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s cf=tftp,${LOCAL_IPADDR},/slackpxe.cfg +label speakup.s + kernel kernels/huge.s/bzImage + append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s cf=tftp,${LOCAL_IPADDR},/slackpxe.cfg +label memtest + kernel kernels/memtest/memtest +EOF + +# Update the slackpxe.cfg file: +sed -i -e "s,^REMOTE_URL=.*,REMOTE_URL=http://$LOCAL_IPADDR," /var/lib/tftpboot/slackpxe.cfg + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTpxemedia b/source/installer/sources/initrd/usr/lib/setup/SeTpxemedia new file mode 100755 index 00000000..3e46fb59 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTpxemedia @@ -0,0 +1,95 @@ +#!/bin/sh +# +# Copyright 2011 Eric Hameleers, Eindhoven, NL +# Copyright 2011 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. +# +# Bug reports, suggestions, etc for pxesetup: alien@slackware.com +# +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 which contains Slackware Linux:" \ +13 70 6 \ +"1" "Use a Slackware DVD" \ +"2" "Use a hard drive partition" \ +"3" "Use a pre-mounted directory" \ +2> $TMP/pxemedia +if [ ! $? = 0 ]; then + rm $TMP/pxemedia + exit +fi + +SOURCE_MEDIA="`cat $TMP/pxemedia`" +rm -f $TMP/pxemedia +if [ "$SOURCE_MEDIA" = "1" ]; then + INSCD +elif [ "$SOURCE_MEDIA" = "2" ]; then + INShd +elif [ "$SOURCE_MEDIA" = "3" ]; then + INSdir +fi + +# Find out where the PXE boot files are on the medium. +# Note: 'isolinux' will be used on the DVD and 'syslinux' on the USB stick. +if [ -f $(readlink -f $(cat $TMP/SeTDS))/isolinux/initrd.img ]; then + SYSLINUXPATH="$(readlink -f $(cat $TMP/SeTDS))/isolinux" +elif [ -f $(readlink -f $(cat $TMP/SeTDS))/../isolinux/initrd.img ]; then + SYSLINUXPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../isolinux ; pwd)" +elif [ -f $(readlink -f $(cat $TMP/SeTDS))/../syslinux/initrd.img ]; then + SYSLINUXPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../syslinux ; pwd)" +elif [ -f $(readlink -f $(cat $TMP/SeTDS))/../../syslinux/initrd.img ]; then + SYSLINUXPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../../syslinux ; pwd)" +else + SYSLINUXPATH="" +fi + +if [ -d $(readlink -f $(cat $TMP/SeTDS))/../kernels ]; then + KERNELPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../kernels ; pwd)" +elif [ -d $(readlink -f $(cat $TMP/SeTDS))/../../kernels ]; then + KERNELPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../../kernels ; pwd)" +elif [ -d $(readlink -f $(cat $TMP/SeTDS))/../../syslinux/kernels ]; then + KERNELPATH="$(cd $(readlink -f $(cat $TMP/SeTDS))/../../syslinux/kernels ; pwd)" +else + KERNELPATH="" +fi + +# Found them... hopefully. +if [ -n "$SYSLINUXPATH" -a -n "$KERNELPATH" ]; then + # Setup symlinks to initrd files and kernels for the PXE boot: + ( cd /var/lib/tftpboot + for FILE in $(find $SYSLINUXPATH -type f -maxdepth 1) ; do + ln -sf $FILE $(basename $FILE) + done + ln -sf $KERNELPATH kernels + ) 2>/dev/null + # Update the slackpxe.cfg file (need to strip off '/var/log/mount'): + sed -i -e "s,^REMOTE_PATH=.*,REMOTE_PATH=/$(cat $TMP/SeTDS | cut -d/ -f5-)," /var/lib/tftpboot/slackpxe.cfg +else + dialog --title "FTP/HTTP DOWNLOAD FAILURE" --msgbox "\ +Could not find the kernel and/or initial ramdisk files. \n\ +These are required for booting the client computer.\n\ +Please try to setup the SOURCE location correctly." 7 68 +fi + diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTswap b/source/installer/sources/initrd/usr/lib/setup/SeTswap new file mode 100755 index 00000000..f9eb52fc --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/SeTswap @@ -0,0 +1,122 @@ +#!/bin/sh + +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +REDIR=/dev/tty4 +NDIR=/dev/null + +crunch() { + read STRING; + echo $STRING; +} + +# get_part_size( dev ) - Return the size in K, M, G, T, or P of the named partition. +get_part_size() { + numfmt --to=iec $(blockdev --getsize64 $1) +} + +rm -f $TMP/SeTswap $TMP/SeTswapskip $TMP/SeTuseswap $TMP/tmpscript + +SWAPLIST="`probe -l 2> /dev/null | grep "Linux swap" | cut -f 1 -d ' ' | sort 2> $NDIR`" + +if [ "$SWAPLIST" = "" ]; then + dialog --title "NO SWAP SPACE DETECTED" --yesno "You have not created \ +a swap partition with Linux fdisk. \ +Do you want to continue installing without one? " 6 60 + if [ "$?" = "1" ]; then + dialog --title "ABORTING INSTALLATION" --msgbox "Create a swap partition with Linux fdisk, and then try this again." \ +6 40 + else + touch $TMP/SeTswapskip + fi + exit +else # there is at least one swap partition: + # Build the swap partition selection menu: + cat << EOF > $TMP/tmpscript +dialog --backtitle "Setting up swap partitions." \\ +--title "SWAP SPACE DETECTED" --checklist \\ +"Slackware Setup has detected one or more swap partitions \\ +on your system. These partitions have been \\ +preselected to be set up as swap space. If there are any \\ +swap partitions that you \\ +do not wish to use with this installation, please unselect \\ +them with the up and down arrows and spacebar. If you wish \\ +to use all of them (this is recommended), simply hit \\ +the ENTER key." \\ +0 0 0 \\ +EOF + for swappartition in $SWAPLIST ; do + PARTSIZE=$(get_part_size $swappartition) + cat << EOF >> $TMP/tmpscript +"$swappartition" "Linux swap partition, ${PARTSIZE}" on \\ +EOF + done + cat << EOF >> $TMP/tmpscript + 2> $TMP/SeTuseswap +EOF + . $TMP/tmpscript + if [ ! $? = 0 ]; then + rm -f $TMP/tmpscript $TMP/SeTswap $TMP/SeTuseswap + touch $TMP/SeTswapskip + fi + + if [ -r $TMP/SeTuseswap ]; then + # Remove extra quotes from SeTuseswap, if any: + cat $TMP/SeTuseswap | tr -d \" > $TMP/SeTfoo + mv $TMP/SeTfoo $TMP/SeTuseswap + + # Were any swap partitions asked for? + if [ "$(cat $TMP/SeTuseswap)" = "" -a ! -r $TMP/SeTswapskip ]; then + rm -f $TMP/tmpscript $TMP/SeTswap $TMP/SeTuseswap + touch $TMP/SeTswapskip + fi + fi + + if [ ! -r $TMP/SeTswapskip ]; then + dialog --backtitle "Setting up swap partitions." \ + --title "CHECK SWAP PARTITIONS FOR BAD BLOCKS?" --defaultno --yesno \ +"Slackware Setup will now prepare your system's swap space. \ +When formatting swap partitions with mkswap you may also check \ +them for bad blocks. This is not the default since nearly all \ +modern hard drives check themselves for bad blocks anyway. \ +Would you like to check for bad blocks while running mkswap?" \ +10 60 + if [ $? = 0 ]; then + CHECKBAD=yes + else + CHECKBAD=no + fi + + # Run mkswap on swap partitions, unless they are already in use: + for swappartition in $(cat $TMP/SeTuseswap) ; do + if ! grep -w $swappartition /proc/swaps 1> $REDIR 2> $REDIR ; then + if [ "$CHECKBAD" = "no" ]; then + mkswap -v1 $swappartition 1> $REDIR 2> $REDIR + else + mkswap -c -v1 $swappartition 1> $REDIR 2> $REDIR + fi + echo "Activating swap partition ${swappartition}:" + echo "swapon ${swappartition}" + swapon $swappartition 1> $REDIR 2> $REDIR + fi + done + + # This is so people don't ask what that output was that flashed + # by on the screen. ;-) + sleep 1 + + # Add the swap partitions to the file that will go into /etc/fstab: + for swappartition in $(cat $TMP/SeTuseswap) ; do + printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$swappartition" "swap" "swap" "defaults" "0" "0" >> $TMP/SeTswap + done + + echo "Your swapspace has been configured. This information will" > $TMP/swapmsg + echo "be added to your /etc/fstab:" >> $TMP/swapmsg + echo >> $TMP/swapmsg + cat $TMP/SeTswap >> $TMP/swapmsg + dialog --title "SWAP SPACE CONFIGURED" --exit-label OK --textbox $TMP/swapmsg 10 72 + rm $TMP/swapmsg + fi +fi diff --git a/source/installer/sources/initrd/usr/lib/setup/migrate.sh b/source/installer/sources/initrd/usr/lib/setup/migrate.sh new file mode 100755 index 00000000..8c1de44a --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/migrate.sh @@ -0,0 +1,31 @@ +#!/bin/sh +TMP=/var/log/setup/tmp +T_PX="`cat $TMP/SeTT_PX`" +# +# Like, the space is *really* getting tight on these install disks! +# Can you believe it? Anyway, we can avoid many problems by migrating +# the $TMP directory onto the install partition ASAP. So, this script +# is run right after the TARGET partition is configured and mounted +# under ${T_PX}. +# + +TMPLINK="`LC_ALL=C /bin/ls -l /var/log/setup/tmp | tr -s ' ' | cut -f 11 -d ' '`" +if [ -L /var/log/setup/tmp -a "$TMPLINK" = "/tmp" ]; then + if mount | grep " on ${T_PX} " 1> /dev/null 2> /dev/null ; then # ${T_PX} mounted + TYPE="`mount | grep " on ${T_PX} " | cut -f 5 -d ' '`" + if [ "$TYPE" = "umsdos" ]; then + LINKDIR=${T_PX}/linux/var/log/setup/tmp + else + LINKDIR=${T_PX}/var/log/setup/tmp + fi + if [ ! -d $LINKDIR ]; then + mkdir -p $LINKDIR + chmod 700 $LINKDIR + fi + ( cd /var/log/setup + rm tmp + ln -sf $LINKDIR tmp ) + rm -f $LINKDIR/SeT* + mv /tmp/SeT* $LINKDIR + fi +fi diff --git a/source/installer/sources/initrd/usr/lib/setup/nopartHELP b/source/installer/sources/initrd/usr/lib/setup/nopartHELP new file mode 100644 index 00000000..5214a0e7 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/nopartHELP @@ -0,0 +1,34 @@ + +You have not yet designated any disk partitions as type Linux. + +If you are planning to use OS/2 Boot Manager, make your Linux +partitions with OS/2 fdisk (or Partition Magic, which also +includes Boot Manager), format them, reboot this disk, and then +use Linux fdisk to tag the partitions as type 83 (Linux). + +Linux fdisk will select a default device when called without +arguments, and from there it is menu driven. If you don't want +to partition the default device, then call fdisk with the device +you want as the argument, like this: + +fdisk /dev/hdb + +or this: + +fdisk /dev/sda + +If you are not using the OS/2 Boot Manager, then you may use Linux +fdisk to create partitions for Linux. Other than the exception for +the OS/2 Boot Manager, you are usually better off creating +partitions for a given OS using a partitioning tool native to that +OS. In other words, you probably shouldn't try to make your DOS or +other non-Linux partitions with the Linux fdisk. + +"cfdisk" is an equally good version of Linux fdisk that is more +graphical and menu driven. Many people prefer to use "cfdisk". + +Please make one or more partitions for Linux, and try setup again. +If you haven't already, you might want to also make a swap partition +while you're in fdisk. 64 megabytes would be a minimum starting size +for a single user system. Linux swap is tagged as type 82. + diff --git a/source/installer/sources/initrd/usr/lib/setup/pxesetup b/source/installer/sources/initrd/usr/lib/setup/pxesetup new file mode 100755 index 00000000..fb7831a3 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/pxesetup @@ -0,0 +1,120 @@ +#!/bin/sh +# +# Copyright 2011 Eric Hameleers, Eindhoven, NL +# Copyright 2011 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. +# +# Bug reports, suggestions, etc for pxesetup: alien@slackware.com +# +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/lib/setup" +export PATH; +export COLOR=on +# Before probing, activate any LVM partitions that may exist from +# before the boot - perhaps the Slackware tree is on a local partition: +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 +fi + +while [ 0 ]; do + + dialog --title "Slackware PXE Setup (version 13.37)" \ +--menu \ +"Welcome to Slackware PXE Setup.\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 PXE Setup HELP file" \ +"NETWORK" "Configure your network parameters" \ +"SOURCE" "Select source media" \ +"ACTIVATE" "Activate the Slackware PXE Server" \ +"EXIT" "Exit Slackware PXE 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 + SeTPXEHELP + fi + + if [ "$MAINSELECT" = "NETWORK" ]; then + SeTnet + SeTpxe + if [ -r $TMP/SeTpxe ]; then + MAINSELECT="SOURCE" + fi + fi + + if [ "$MAINSELECT" = "SOURCE" ]; then + SeTpxemedia + if [ -r $TMP/SeTsource ]; then + MAINSELECT="ACTIVATE" + fi + fi + + if [ "$MAINSELECT" = "ACTIVATE" ]; then + if [ ! -r $TMP/SeTpxe -o ! -r $TMP/SeTsource ]; then + dialog --title "CANNOT START PXE SERVER YET" --msgbox "\ +\n\ +Before you can start the PXE Server, complete the following tasks:\n\ +\n\ +1. Set up your computer's network parameters.\n\ +2. Select your source media.\n\ +\n\ +Press ENTER to return to the main menu." 14 68 + continue + fi + # Time to start the BOOTP/TFTP/HTTP servers: + dnsmasq -C /etc/dnsmasq.conf + httpd -h /var/log/mount + + dialog --backtitle "Slackware PXE Server." \ + --title "PXE Client activity log" \ + --ok-label "EXIT" \ + --tailbox /var/log/dnsmasq.log 18 68 + + # Time to kill the BOOTP/TFTP/HTTP servers: + kill -TERM $(cat /var/run/dnsmasq.pid) + killall -TERM httpd + fi + + if [ "$MAINSELECT" = "EXIT" ]; then + break + fi + +done # end of main loop + +# end slackware PXE setup script + diff --git a/source/installer/sources/initrd/usr/lib/setup/setup b/source/installer/sources/initrd/usr/lib/setup/setup new file mode 100755 index 00000000..f30064a0 --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/setup @@ -0,0 +1,443 @@ +#!/bin/sh +# +# Copyright 1993, 1994, 1999 Patrick Volkerding, Moorhead, Minnesota USA +# Copyright 2001, 2003, 2004 Slackware Linux, Inc., Concord, CA +# Copyright 2006, 2007, 2018 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 +# +TMP=/var/log/setup/tmp +if [ ! -d $TMP ]; then + mkdir -p $TMP +fi +# Wipe the probe md5sum to force rescanning partitions if setup is restarted: +rm -f $TMP/SeTpartition.md5 +## FLOPPY? Comment out this obsolete code. We ain't gonna need it. +## Use /tmp on floppy for now: +#/usr/lib/setup/unmigrate.sh +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/lib/setup" +export PATH; +export COLOR=on +dialog --backtitle "Slackware Linux Setup" --infobox "\n +Scanning your system for partition information...\n +\n" 5 55 +# In case the machine is full of fast SSDs: +sleep 1 +# 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="/mnt" +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 12.2)" \ +--menu \ +"Welcome to Slackware Linux Setup.\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" \ +"SOURCE" "Select source media" \ +"SELECT" "Select categories of software to install" \ +"INSTALL" "Install selected software" \ +"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="SOURCE" + fi + fi + + if [ "$MAINSELECT" = "SOURCE" ]; then + SeTmedia + if [ -r $TMP/SeTsource ]; then + MAINSELECT="SELECT" + fi + fi + + if [ "$MAINSELECT" = "SELECT" ]; then + if [ -r /var/log/mount/isolinux/setpkg ]; then + sh /var/log/mount/isolinux/setpkg + else + SeTPKG + fi + if [ -r $TMP/SeTSERIES ]; then + MAINSELECT="INSTALL" + fi + fi + + 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 + 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 + + 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" "nosuid,nodev,noexec" "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: +/sbin/fixdate + +# final cleanup +rm -f $TMP/tagfile $TMP/SeT* $TMP/tar-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 diff --git a/source/installer/sources/initrd/usr/lib/setup/slackinstall b/source/installer/sources/initrd/usr/lib/setup/slackinstall new file mode 100755 index 00000000..1d16abde --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/slackinstall @@ -0,0 +1,254 @@ +#!/bin/sh +# Copyright 2003 Slackware Linux, Inc., Concord, CA USA +# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, 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. +# + +# globals + +TMP=/var/log/setup/tmp + +# functions + +get_pkg () { + # Download a package from a remote server. + # $1 == package series + # $2 == package base name + # $3 == additional options to the downloader (like, '-v') + # REMOTESVR points to the root of the slackware tree, and is composed of + # comma-separated values (protocol://remote_ipaddr[:portnumber],remote_root) + # like this example: 'ftp://192.168.0.22,/pub/slackware-12.1' + local REMOTE_URL=$(echo $REMOTESVR | cut -d, -f1) + local REMOTE_ROOT=$(echo $REMOTESVR | cut -d, -f2) + PKGBASE=$(basename $(basename $(basename $(basename $2 .tgz) .tbz) .tlz) .txz) + local PKGSIZE=`cat \`cat $TMP/SeTDS\`/${1}/${PKGBASE}.size` + # So Pat does not get a seizure ;-) + #dialog --title "FTP/HTTP DOWNLOAD ==> series '$1' <==" --infobox \ + # "Downloading ${2} ($PKGSIZE) ..." 3 72 + mkdir -p `cat $TMP/SeTDS`/${1} + cat /dev/null > `cat $TMP/SeTDS`/${1}/${2} + cat /dev/null > `cat $TMP/SeTDS`/${1}/${PKGBASE}.txt + wget $3 -c -P `cat $TMP/SeTDS`/${1} \ + $REMOTE_URL$REMOTE_ROOT/slackware/${1}/${PKGBASE}.txt + wget $3 -c -P `cat $TMP/SeTDS`/${1} \ + $REMOTE_URL$REMOTE_ROOT/slackware/${1}/${2} + if [ $? -ne 0 ]; then # One retry for aborted transfers + wget $3 -c -P `cat $TMP/SeTDS`/${1} \ + $REMOTE_URL$REMOTE_ROOT/slackware/${1}/${2} + fi + if [ $? -ne 0 ]; then + dialog --title "FTP/HTTP DOWNLOAD FAILURE" --msgbox \ + "Downloading ${2} FAILED." 5 72 + fi +} + +zap_pkg () { + # Cleanup a download from a remote server. + # $1 == package series + # $2 == package name + PKGBASE=$(basename $(basename $(basename $(basename $2 .tgz) .tbz) .tlz) .txz) + cat /dev/null > `cat $TMP/SeTDS`/${1}/${2} # zero the local file + rm -f `cat $TMP/SeTDS`/${1}/${PKGBASE}.txt # remove the description file +} + +updatetagfiles() { + if [ $MODE = newbie -o $MODE = full -o $MODE = terse ]; then + cat $TMP/series/series.in | while read series ; do + if [ -r $SRCPATH/$series/tagfile ]; then + mkdir -p $TMP/tagfiles/$series + cp -a $SRCPATH/$1/tagfile $TMP/tagfiles/$series + fi + done + elif [ $MODE = tagpath ]; then + cp -a `cat $TMP/SeTtagpath`/* $TMP/tagfiles + elif [ $MODE = custom ]; then + mkdir -p $TMP/tagfiles/$series + cp -a $SRCPATH/$series/tagfile`cat $TMP/SeTtagext` $TMP/tagfiles/$series/tagfile + elif [ $MODE = menu -o $MODE = expert ]; then + cat $TMP/series/series.in | while read series ; do + if [ $MODE = menu ]; then + if [ -r $SRCPATH/$series/maketag.ez ]; then + sh $SRCPATH/$series/maketag.ez + fi + else + if [ -r $SRCPATH/$series/maketag ]; then + sh $SRCPATH/$series/maketag + fi + fi + if [ -r $TMP/SeTnewtag ]; then + mkdir -p $TMP/tagfiles/$series + mv $TMP/SeTnewtag $TMP/tagfiles/$series/tagfile + fi + done + fi +} + +errorcode() { + if [ $1 = 99 ]; then + # User aborted installation + exit 1 + else + dialog --timeout 600 --title "installpkg error #$1" --msgbox \ +"There was a fatal error attempting to install $2. The package may \ +be corrupt, the installation media may be bad, one of the target \ +drives may be full, or something else \ +has caused the package to be unable to be read without error. You \ +may hit enter to continue if you wish, but if this is an important \ +required package then your installation may not work as-is." 11 70 + fi +} + +installseries() { + if [ -d $SRCPATH/$1 ]; then + # First, make sure our tagfiles are in order: + if [ ! -r $TMP/tagfiles/$1/tagfile -a ! $MODE = full -a ! $MODE = terse ]; then + updatetagfiles $1 + fi + # First, make sure there's at least one package: + if ! ls $SRCPATH/$series/*.t?z 1> /dev/null 2> /dev/null ; then + return 1 + fi + if [ "$MODE" = "terse" ]; then + echo " >> Installing package series $(echo $1 | tr [a-z] [A-Z])" + else + dialog --infobox " +Installing package series ==>$1<== +" 5 45 + fi + sleep 1 + # Install the package series: + for package in $SRCPATH/$series/*.t?z ; do + if [ "$MODE" = "full" ]; then # install the package + [ "x$REMOTESVR" != "x" ] && get_pkg $series $(basename $package) '-q' + installpkg -root $ROOTDIR -infobox -priority ADD $package + ERROR=$? + elif [ "$MODE" = "terse" ]; then # install the package with terse description + [ "x$REMOTESVR" != "x" ] && get_pkg $series $(basename $package) '-q' + installpkg -root $ROOTDIR -terse -priority ADD $package + ERROR=$? + else + if [ "x$REMOTESVR" != "x" ]; then + grep "^$(echo $(basename $package) | rev | cut -f4- -d '-' | rev):" \ + $TMP/tagfiles/$1/tagfile | grep -qw SKP \ + || get_pkg $series $(basename $package) '-q' + fi + installpkg -root $ROOTDIR -menu -tagfile $TMP/tagfiles/$1/tagfile $package + ERROR=$? + fi + if [ ! $ERROR = 0 ]; then + errorcode $ERROR $package + fi + [ "x$REMOTESVR" != "x" ] && zap_pkg $series $(basename $package) + done + # A "README_SPLIT.TXT" file means the series continues on another CD: + if [ -r $SRCPATH/$series/README_SPLIT.TXT -o -r $SRCPATH/$series/readme_split.txt ] ; then + # Defer until later. + echo $1 >> $TMP/series/series.out + fi + else # requested, but not on media. defer until later. + echo $1 >> $TMP/series/series.out + fi +} + +remount_disc() { + umount $DEVICE 2> /dev/null + eject -s $DEVICE 2> /dev/null + dialog --title "INSERT NEXT DISC" --menu "Please insert the next Slackware disc and \ +press ENTER to continue installing packages." \ +10 62 2 \ + "Continue" "Install packages from the next disc" \ + "Quit" "Quit installing packages and finish up" 2> $TMP/reply + if [ ! $? = 0 ]; then + REPLY="Quit" + else + REPLY="`cat $TMP/reply`" + fi + rm -f $TMP/reply + if [ "$REPLY" = "Quit" ]; then + errorcode 99 + fi; + # Recently, mounting has become unreliable at this point. + # Not sure if it's udev, or what, but we have seen + # mount: /dev/sr0: unknown device + # We will attempt to mount several times to attempt to make + # this less likely to fail. + for attempt in 1 2 3 4 5 6 7 8 9 10 11 ; do + mount $DEVICE $MOUNTPOINT 2> /dev/null + if [ $? = 0 ]; then + break + fi + sleep 7 + done + if [ "$MODE" = "terse" ]; then + setterm -background cyan -foreground black -blank 0 + fi +} + +# /* main */ + +# Process command line: +if [ $# -gt 0 ]; then # there are arguments to the command + while [ $# -gt 0 ]; do + case "$1" in + "--promptmode") + MODE=`echo $2` ; shift 2 ;; + "--srcpath") + SRCPATH=`echo $2` ; shift 2 ;; + "--mountpoint") + MOUNTPOINT=`echo $2` ; shift 2 ;; + "--target") + ROOTDIR=`echo $2` ; shift 2 ;; + "--device") + DEVICE=`echo $2` ; shift 2 ;; + "--series") + SERIES=`echo $2` ; shift 2 ;; + "--net") + REMOTESVR=`echo $2` ; shift 2 ;; + *) + echo "Unrecognized option $1" ; shift 1 ;; + esac + done +else + exit 1; +fi +# Empty out temporary directories: +rm -rf $TMP/series $TMP/tagfiles +mkdir -p $TMP/series $TMP/tagfiles +# Create initial list of series to install: +for series in `echo $SERIES | tr "#" " "` ; do + echo $series | tr A-Z a-z >> $TMP/series/series.in +done +# Main loop: +while [ -r $TMP/series/series.in ]; do + cat $TMP/series/series.in | while read series ; do + installseries $series; + done + rm -f $TMP/series/series.in + if [ -r $TMP/series/series.out ]; then + mv $TMP/series/series.out $TMP/series/series.in + if [ "$DEVICE" = "noremount" ]; then + # we've done all we can here + break + else # see if there's anything we need on the next disc + remount_disc + fi + fi +done + diff --git a/source/installer/sources/initrd/usr/lib/setup/unmigrate.sh b/source/installer/sources/initrd/usr/lib/setup/unmigrate.sh new file mode 100755 index 00000000..fa374bcd --- /dev/null +++ b/source/installer/sources/initrd/usr/lib/setup/unmigrate.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# This resets the temporary directory to /tmp on the floppy in the +# case where it's been changed during a previous 'setup' run. This +# should be done before $TMP is cleared. +# + +TMPLINK="`LC_ALL=C /bin/ls -l /var/log/setup/tmp | tr -s ' ' | cut -f 11 -d ' '`" +if [ -L /var/log/setup/tmp -a ! "$TMPLINK" = "/tmp" ]; then + ( cd /var/log/setup + rm tmp + ln -sf /tmp tmp ) +fi |