summaryrefslogtreecommitdiff
path: root/usb-and-pxe-installers
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2011-04-25 13:37:00 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 22:45:18 +0200
commit75a4a592e5ccda30715f93563d741b83e0dcf39e (patch)
tree502f745607e77a2c4386ad38d818ddcafe81489c /usb-and-pxe-installers
parentb76270bf9e6dd375e495fec92140a79a79415d27 (diff)
downloadcurrent-75a4a592e5ccda30715f93563d741b83e0dcf39e.tar.gz
Slackware 13.37slackware-13.37
Mon Apr 25 13:37:00 UTC 2011 Slackware 13.37 x86_64 stable is released! Thanks to everyone who pitched in on this release: the Slackware team, the folks producing upstream code, and linuxquestions.org for providing a great forum for collaboration and testing. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. As always, thanks to the Slackware community for testing, suggestions, and feedback. :-) Have fun!
Diffstat (limited to 'usb-and-pxe-installers')
-rw-r--r--usb-and-pxe-installers/README_PXE.TXT84
-rw-r--r--usb-and-pxe-installers/README_USB.TXT27
-rw-r--r--usb-and-pxe-installers/pxelinux.cfg_default8
-rw-r--r--usb-and-pxe-installers/usbimg2disk.sh140
4 files changed, 177 insertions, 82 deletions
diff --git a/usb-and-pxe-installers/README_PXE.TXT b/usb-and-pxe-installers/README_PXE.TXT
index 1912f3e9..078e4a55 100644
--- a/usb-and-pxe-installers/README_PXE.TXT
+++ b/usb-and-pxe-installers/README_PXE.TXT
@@ -106,12 +106,13 @@ The stages of a Slackware PXE install
PXE firmware has done its job and is no longer in the picture. So:
(5) We need to load a kernel driver for our network card and locate a network
- server that holds the Slackware package tree. Currently, you can choose
- between installing from a NFS server, a Samba server or a HTTP/FTP
- server. Before starting cfdisk and setup, we need to run the ('pcmcia'
- and/or) 'network' command to probe the network card and load a suitable
- driver. If your network card is not supported by any of the available
- drivers, you are out of luck and will have to rethink your options.
+ server that holds the Slackware package tree (called the "SOURCE").
+ Currently, you can choose between installing from a NFS server, a Samba
+ server or a HTTP/FTP server. By starting setup and selecting one of
+ these network package SOURCEs, you will get the opportunity to configure
+ the network card. If your network card is not supported by any of the
+ available drivers, you are out of luck and will have to rethink your
+ options.
(6) From here on, installation proceeds as usual, under the condition that
you select 'Install from NFS (Network File System)', 'Install from
@@ -146,11 +147,12 @@ components. We need:
broadcast on the network its desire to find a suitable server to download
the bootstrap code from. The DHCP Server packages that are part of
Slackware fulfill this requirement, since they talk BOOTP as well as DHCP.
- The packages are dhcpd and dnsmasq; pick the one you like most.
+ These packages are 'dhcpd' and 'dnsmasq'; pick the one you like most.
(2) A download service for the bootstrap code. A TFTP (trivial file
- transfer protocol) server is needed for this. Slackware ships with an
- implementation of a TFTP server called tftpd-hpa which does what we need.
+ transfer protocol) server is needed for this. Slackware ships with
+ an implementation of a TFTP server called 'tftpd-hpa' which does what
+ we need.
(3) And for the Slackware installer, a NFS, HTTP, FTP or Samba server is
required because we must perform a network install. We can use
@@ -166,8 +168,8 @@ an excercise for the user to find out how to configure Apache (HTTP) or
proftpd (FTP) in case installation over HTTP or FTP is preferred. In later
examples, I will assume that the following URL's are valid for your HTTP/FTP
server:
- http://192.168.0.1/mirror/slackware/slackware-13.0
- ftp://192.168.0.1/pub/mirror/slackware/slackware-13.0
+ http://192.168.0.1/mirror/slackware/slackware-13.37
+ ftp://192.168.0.1/pub/mirror/slackware/slackware-13.37
The server will run all required services, i.e. acts as the LANs
DNS, DHCP, TFTP and NFS (or HTTP/FTP/Samba) server. If you decide to
@@ -198,12 +200,12 @@ that apply to your own network.
(*) The DNS domain will be "my.lan".
(*) Directories are used as follows:
- Top level of the complete Slackware 13.0 directory tree (excluding the
- source code if you're short on disk space) is
- "/mirror/slackware/slackware-13.0"
+ Top level of the complete Slackware 13.37 directory tree (excluding
+ the source code if you're short on disk space) is
+ "/mirror/slackware/slackware-13.37"
(*) The directory where we store the boot files for the TFTP server is
- "/tftpboot/slackware-13.0"
+ "/tftpboot/slackware-13.37"
DHCP
@@ -255,7 +257,7 @@ group {
next-server 192.168.0.1;
use-host-decl-names on;
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
- filename "/slackware-13.0/pxelinux.0";
+ filename "/slackware-13.37/pxelinux.0";
}
host ABC {
@@ -269,7 +271,7 @@ group {
This enables the DHCP server to detect network boot clients that use PXE
and serves them the PXElinux boot loader we make available at
-"/slackware-13.0/pxelinux.0". What this boot loader does will be explained
+"/slackware-13.37/pxelinux.0". What this boot loader does will be explained
further down the article.
The 'next-server' parameter contains the IP address of the TFTP server.
@@ -297,11 +299,11 @@ will stall at the point of looking for a TFTP server.
above instructions for the ISC DHCP server are not applicable to your
setup. Instead, you have to configure dnsmasq with this equivalent parameter:
- dnsmasq --dhcp-boot=/slackware-13.0/pxelinux.0,"192.168.0.1",192.168.0.1
+ dnsmasq --dhcp-boot=/slackware-13.37/pxelinux.0,"192.168.0.1",192.168.0.1
or add this line to your /etc/dnsmasq.conf:
- dhcp-boot=/slackware-13.0/pxelinux.0,"192.168.0.1",192.168.0.1
+ dhcp-boot=/slackware-13.37/pxelinux.0,"192.168.0.1",192.168.0.1
The IP address "192.168.0.1" occurs twice; they should always be identical,
and be the address of your TFTP server.
@@ -371,7 +373,7 @@ that are used here apply to our example network - adjust as needed):
(*) The directory mentioned in /etc/exports is the target where
you copy (or move) your Slackware files to: The directory
- "/mirror/slackware/slackware-13.0" should be the root of the Slackware
+ "/mirror/slackware/slackware-13.37" should be the root of the Slackware
tree, containing such files as ChangeLog.txt and subdirectories like
"slackware" (or "slackware64" if you are working with the 64bit port)
and "kernels".
@@ -402,36 +404,36 @@ The tftp directory structure:
As you can see in the DHCP section, the DHCP server has been configured
to offer any interested PXE client (i.e. your computers network card) the
-file "/slackware-13.0/pxelinux.0" - this file contains the bootable code
+file "/slackware-13.37/pxelinux.0" - this file contains the bootable code
that first downloads and starts a Linux kernel, and then downloads and
extracts the root filesystem containing the setup program and everything
-else that we need. This filename "/slackware-13.0/pxelinux.0" indicates
+else that we need. This filename "/slackware-13.37/pxelinux.0" indicates
a pathname relative to the root of the TFTP server. The PXE client will
use the tftp protocol to fetch this bootloader. So this is what we do:
-create this directory "slackware-13.0" and copy the required files into it.
+create this directory "slackware-13.37" and copy the required files into it.
First, the pxelinux bootloader itself:
- mkdir /tftpboot/slackware-13.0
- mkdir /tftpboot/slackware-13.0/pxelinux.cfg
- cp /usr/lib/syslinux/pxelinux.0 /tftpboot/slackware-13.0/
+ mkdir /tftpboot/slackware-13.37
+ mkdir /tftpboot/slackware-13.37/pxelinux.cfg
+ cp /usr/share/syslinux/pxelinux.0 /tftpboot/slackware-13.37/
Also, we need the files from the Slackware CDROM that show the
informative messages in the beginning. Assuming your local copy of the
-Slackware release can be found in "/mirror/slackware/slackware-13.0"
+Slackware release can be found in "/mirror/slackware/slackware-13.37"
(change paths in the below commands if your location is different) :
- cp /mirror/slackware/slackware-13.0/isolinux/message.txt /tftpboot/slackware-13.0/
- cp /mirror/slackware/slackware-13.0/isolinux/f2.txt /tftpboot/slackware-13.0/
+ cp /mirror/slackware/slackware-13.37/isolinux/message.txt /tftpboot/slackware-13.37/
+ cp /mirror/slackware/slackware-13.37/isolinux/f2.txt /tftpboot/slackware-13.37/
Very important: we need the initial ramdisk image (initrd.img) and the pxelinux configuration file that contains the instructions for the PXE clients:
- cp /mirror/slackware/slackware-13.0/isolinux/initrd.img /tftpboot/slackware-13.0/
- cp /mirror/slackware/slackware-13.0/usb-and-pxe-installers/pxelinux.cfg_default /tftpboot/slackware-13.0/pxelinux.cfg/default
+ cp /mirror/slackware/slackware-13.37/isolinux/initrd.img /tftpboot/slackware-13.37/
+ cp /mirror/slackware/slackware-13.37/usb-and-pxe-installers/pxelinux.cfg_default /tftpboot/slackware-13.37/pxelinux.cfg/default
And lastly, we need all the kernels that the Slackware installer lets you
choose from:
- cp -a /mirror/slackware/slackware-13.0/kernels /tftpboot/slackware-13.0/
+ cp -a /mirror/slackware/slackware-13.37/kernels /tftpboot/slackware-13.37/
Trying it out
@@ -482,7 +484,7 @@ Your IP Address (pick any unused): 192.168.0.111
Your netmask: 255.255.255.0
The gateway: 192.168.0.10
NFS server address: 192.168.0.1
-Slackware directory on NFS server: /mirror/slackware/slackware-13.0/slackware
+Slackware directory on NFS server: /mirror/slackware/slackware-13.37/slackware
Next, some values to use with a FTP server (for our example network):
@@ -490,7 +492,7 @@ Your IP Address (pick any unused): 192.168.0.111
Your netmask: 255.255.255.0
The gateway: 192.168.0.10
FTP server address: ftp://192.168.0.1
-Slackware directory on ftpserver: /pub/mirror/slackware/slackware-13.0
+Slackware directory on ftpserver: /pub/mirror/slackware/slackware-13.37
Next, example values to use with a HTTP server (for our example network):
@@ -498,7 +500,7 @@ Your IP Address (pick any unused): 192.168.0.111
Your netmask: 255.255.255.0
The gateway: 192.168.0.10
HTTP server address: http://192.168.0.1
-Slackware directory on webserver: /mirror/slackware/slackware-13.0
+Slackware directory on webserver: /mirror/slackware/slackware-13.37
Finally, example values to use with a Samba share (for our example network):
@@ -506,7 +508,7 @@ Your IP Address (pick any unused): 192.168.0.111
Your netmask: 255.255.255.0
The gateway: 192.168.0.10
Samba share: //192.168.0.1/mirror
-Slackware directory on webserver: /slackware/slackware-13.0
+Slackware directory on webserver: /slackware/slackware-13.37
Note #1 - if you chose automatic network configuration using DHCP in an
earlier step, you can probably use actual hostnames instead of IP addresses.
@@ -517,7 +519,7 @@ IP address.
Note #2 - in the case of the NFS server, you will have to supply the
path to the Slackware package tree _including_ the '/slackware' subdirectory.
For HTTP and FTP servers, it is sufficient to supply the root of the
-slackware-13.0 tree and leave the 'slackware' subdirectory out. The installer
+slackware-13.37 tree and leave the 'slackware' subdirectory out. The installer
will figure out where the packages are.
From this point onwards, the installation proceeds just as when the
@@ -566,7 +568,7 @@ subnet 192.168.0.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.0.50 192.168.0.100;
use-host-decl-names on;
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
- filename "/slackware-13.0/pxelinux.0";
+ filename "/slackware-13.37/pxelinux.0";
}
}
@@ -673,10 +675,10 @@ group {
use-host-decl-names on;
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
- filename "/slackware-13.0/pxelinux.0";
+ filename "/slackware-13.37/pxelinux.0";
}
else if substring (option vendor-class-identifier, 0, 9) = "Etherboot" {
- filename "/slackware-13.0/kernels/hugesmp.s/bzImage";
+ filename "/slackware-13.37/kernels/hugesmp.s/bzImage";
}
host t43 {
@@ -771,6 +773,6 @@ exit 0
========================================================
Author:
- Eric Hameleers <alien@slackware.com> 22-jul-2009
+ Eric Hameleers <alien@slackware.com> 21-mar-2011
Wiki URLs:
http://www.slackware.com/~alien/dokuwiki/doku.php?id=slackware:pxe
diff --git a/usb-and-pxe-installers/README_USB.TXT b/usb-and-pxe-installers/README_USB.TXT
index a1f436dd..a8079fee 100644
--- a/usb-and-pxe-installers/README_USB.TXT
+++ b/usb-and-pxe-installers/README_USB.TXT
@@ -127,8 +127,28 @@ raw device, it did not create partitions at all. Fdisk reads the information
in the first sector and incorrectly interprets that as a messed-up device.
-Restoring a USB stick to its original state
--------------------------------------------
+Create a bootable USB stick non-destructively
+---------------------------------------------
+
+ If you do not want to sacrifice a USB thumb drive for this (note that
+dumping the image file on the USB stick will destroy all data already
+present on the stick), there is a solution: Slackware also ships with a
+script usbimg2disk.sh since the 13.0 release (actually, it is the file
+/usb-and-pxe-installers/usbimg2disk.sh ). This script extracts the content
+from the 'usbboot.img' image file and uses this to transform a regular USB
+thumb drive into a bootable Slackware installer non-destructively (i.e. any
+existing files on the stick will not be touched). The only requirement is,
+that there is at least 30 MB of available free space on the stick.
+
+ The usbimg2disk.sh script is also convenient if your computer refuses to
+boot from a USB stick loaded with the usbboot.img file. The BIOS of some
+computers will not understand the format of the default Slackware USB
+image. Using the usbimg2disk.sh script, you create an alternative bootable
+USB stick that will be recognized by your computers BIOS.
+
+
+Restoring a USB stick to its original state (empty VFAT partition)
+------------------------------------------------------------------
When you have used the small 25 MB image to create a USB installer,
your USB stick is no longer useful for anything else. Any remaining
@@ -171,6 +191,7 @@ mkdosfs -F32 /dev/sdx1
and create a partition interactively :-)
==========================================================
-Author: Eric Hameleers <alien@slackware.com> 22-jul-2009
+Author: Eric Hameleers <alien@slackware.com> 17-feb-2011
+Blog post: http://alien.slackbook.org/blog/installing-slackware-using-usb-thumb-drive/
Wiki URL: http://www.slackware.com/~alien/dokuwiki/doku.php?id=slackware:usbboot
diff --git a/usb-and-pxe-installers/pxelinux.cfg_default b/usb-and-pxe-installers/pxelinux.cfg_default
index de1e34cc..4842df82 100644
--- a/usb-and-pxe-installers/pxelinux.cfg_default
+++ b/usb-and-pxe-installers/pxelinux.cfg_default
@@ -6,7 +6,9 @@ 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 SLACK_KERNEL=huge.s
+ append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s
label speakup.s
- kernel kernels/speakup.s/bzImage
- append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 rw SLACK_KERNEL=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
+label memtest
+ kernel kernels/memtest/memtest
diff --git a/usb-and-pxe-installers/usbimg2disk.sh b/usb-and-pxe-installers/usbimg2disk.sh
index aed32c51..f806c5ed 100644
--- a/usb-and-pxe-installers/usbimg2disk.sh
+++ b/usb-and-pxe-installers/usbimg2disk.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
-# $Id: usbimg2disk.sh,v 1.9 2010/04/24 18:21:53 eha Exp eha $
+#!/bin/bash
+# $Id: usbimg2disk.sh,v 1.20 2011/04/16 19:11:27 eha Exp eha $
#
-# Copyright 2009, 2010 Eric Hameleers, Eindhoven, NL
+# Copyright 2009, 2010, 2011 Eric Hameleers, Eindhoven, NL
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,15 +24,19 @@
# Paranoid as usual:
set -e
+# Define some variables ahead of time, so that cleanup knows about them:
+MNTDIR1=""
+MNTDIR2=""
+MNTDIR3=""
+
# Clean up in case of failure:
cleanup() {
# Clean up by unmounting our loopmounts, deleting tempfiles:
echo "--- Cleaning up the staging area..."
sync
- umount -f ${MNTDIR1} 2>/dev/null || true
- umount -f ${MNTDIR2} 2>/dev/null || true
- rm -rf ${MNTDIR3}
- rmdir $MNTDIR1 $MNTDIR2
+ [ ! -z "${MNTDIR1}" ] && ( umount -f ${MNTDIR1} ; rmdir $MNTDIR1 )
+ [ ! -z "${MNTDIR2}" ] && ( umount -f ${MNTDIR2} ; rmdir $MNTDIR2 )
+ [ ! -z "${MNTDIR3}" ] && rm -rf ${MNTDIR3} || true
}
trap "echo \"*** $0 FAILED at line $LINENO ***\"; cleanup; exit 1" ERR INT TERM
@@ -60,7 +64,7 @@ showhelp() {
echo "# -o|--outdev <filename> The device name of your USB drive"
echo "# -s|--slackdir <dir> Use 'dir' as the root of Slackware tree"
echo "# -u|--unattended Do not ask any questions"
- echo "# -L|--label FAT label when formatting the USB drive"
+ echo "# -L|--label <labelname> FAT label when formatting the USB drive"
echo "# "
echo "# Examples:"
@@ -90,6 +94,9 @@ reformat() {
# Wipe the MBR:
dd if=/dev/zero of=$TOWIPE bs=512 count=1
+ # Temporarily accept errors (so that we can examine them):
+ set +e
+
# create a FAT32 partition (type 'b')
/sbin/fdisk $TOWIPE <<EOF
n
@@ -102,6 +109,27 @@ b
w
EOF
+ # Check if fdisk gave an error (like "error closing file").
+ # Some desktop environments auto-mount the partition on sight...:
+ if [ $? -ne 0 ]; then
+ echo "*** The fdisk command had an error."
+ echo "*** Some desktop environments (KDE, GNOME) may automatically mount"
+ echo "*** the new FAT partition on your USB drive, causing the fdisk error."
+ if [ $UNATTENDED -eq 0 ]; then
+ # if we are running interactively, allow to chicken out now:
+ echo "*** Perhaps you want to format the device '$TOWIPE' yourself first?"
+ read -p "*** Press ENTER to continue anyway or Ctrl-C to quit now: " JUNK
+ fi
+ fi
+
+ # Fail on errors again:
+ set -e
+
+ if mount | grep -q ${TOWIPE}1 ; then
+ echo "--- Un-mounting ${TOWIPE}1 because your desktop auto-mounted it..."
+ umount -f ${TOWIPE}1
+ fi
+
# We set the fat label to '$THELABEL' when formatting.
# It will enable the installer to mount the fat partition automatically
# and pre-fill the correct pathname for the "SOURCE" dialog.
@@ -115,14 +143,12 @@ makebootable() {
# Sanity checks:
if [ ! -b $USBDRV ]; then
- echo "Not a block device: '$USBDRV' !"
+ echo "*** Not a block device: '$USBDRV' !"
exit 1
fi
- # Set the bootable flag for the first (and only...) partition:
- /sbin/sfdisk $USBDRV -N1 <<EOF
-,,,*
-EOF
+ # Set the bootable flag for the first partition:
+ /sbin/sfdisk -A $USBDRV 1
}
# Parse the commandline parameters:
@@ -154,7 +180,7 @@ while [ ! -z "$1" ]; do
shift 2
;;
-s|--slackdir)
- REPOSROOT="$(cd $(dirname $2); pwd)/$(basename $2)"
+ REPODIR="$2"
FULLINSTALLER="yes"
shift 2
;;
@@ -163,11 +189,11 @@ while [ ! -z "$1" ]; do
shift
;;
-L|--label)
- FATLABEL="$2"
+ CUSTOMLABEL="$2"
shift 2
;;
*)
- echo "Unknown parameter '$1'!"
+ echo "*** Unknown parameter '$1'!"
exit 1
;;
esac
@@ -176,18 +202,32 @@ done
# Before we start:
[ -x /bin/id ] && CMD_ID="/bin/id" || CMD_ID="/usr/bin/id"
if [ "$($CMD_ID -u)" != "0" ]; then
- echo "You need to be root to run $(basename $0)."
+ echo "*** You need to be root to run $(basename $0)."
exit 1
fi
+# Check existence of the package repository if that was passed as a parameter:
+if [ -n "$REPODIR" ]; then
+ if [ ! -d "$REPODIR" ]; then
+ echo "*** This is not a directory: '$REPODIR' !"
+ exit 1
+ else
+ # This also takes care of stripping a trailing '/', which is required
+ # for the rsync command to work as intended:
+ REPOSROOT="$(cd $(dirname $REPODIR); pwd)/$(basename $REPODIR)"
+ fi
+fi
+
# Check FAT label:
-if [ -n "${FATLABEL}" ]; then
- if [ "x$(echo '${FATLABEL}'| tr -d '[:alnum:]_-.')" != "x" ]; then
- echo "FAT label '${FATLABEL}' is not an acceptible name!"
+if [ -n "${CUSTOMLABEL}" ]; then
+ if [ "x$(echo "${CUSTOMLABEL}"| tr -d '[:alnum:]._-')" != "x" ]; then
+ echo "*** FAT label '${CUSTOMLABEL}' is not an acceptible name!"
exit 1
- elif [ ${#FATLABEL} gt 11 ]; then
- echo "FAT label '${FATLABEL}' must be less than 12 characters!"
+ elif [ ${#CUSTOMLABEL} -gt 11 ]; then
+ echo "*** FAT label '${CUSTOMLABEL}' must be less than 12 characters!"
exit 1
+ else
+ FATLABEL="${CUSTOMLABEL}"
fi
else
FATLABEL="USBSLACKINS"
@@ -230,17 +270,15 @@ if [ ! -f $USBIMG ]; then
exit 1
fi
-if [ $REFORMAT -eq 0 ]; then
+if [ ! -b $TARGET ]; then
+ echo "*** Not a block device: '$TARGET' !"
+ exit 1
+elif [ $REFORMAT -eq 0 ]; then
if ! /sbin/blkid -t TYPE=vfat $TARGETPART 1>/dev/null 2>/dev/null ; then
echo "*** I fail to find a 'vfat' partition: '$TARGETPART' !"
echo "*** If you want to format the USB thumb drive, add the '-f' parameter"
exit 1
fi
-else
- if [ ! -b $TARGET ]; then
- echo "*** Not a block device: '$TARGET' !"
- exit 1
- fi
fi
if mount | grep -q $TARGETPART ; then
@@ -267,6 +305,11 @@ if [ $UNATTENDED -eq 0 ]; then
echo ""
echo "# We are going to ${DOFRMT}use this device - '$TARGET':"
+ echo "# Vendor : $(cat /sys/block/$(basename $TARGET)/device/vendor)"
+ echo "# Model : $(cat /sys/block/$(basename $TARGET)/device/model)"
+ echo "# Size : $(( $(cat /sys/block/$(basename $TARGET)/size) / 2048)) MB"
+ echo "# "
+ echo "# FDISK OUTPUT:"
/sbin/fdisk -l $TARGET | while read LINE ; do echo "# $LINE" ; done
echo ""
@@ -283,12 +326,37 @@ cat /dev/null > $LOGFILE
# If we need to format the USB drive, do it now:
if [ $REFORMAT -eq 1 ]; then
- echo "--- Formatting $TARGET and creating VFAT partition..."
+ echo "--- Formatting $TARGET with VFAT partition label '${FATLABEL}'..."
if [ $UNATTENDED -eq 0 ]; then
echo "--- Last chance! Press CTRL-C to abort!"
read -p "Or press ENTER to continue: " JUNK
fi
( reformat $TARGET ${FATLABEL} ) 1>>$LOGFILE 2>&1
+else
+ # We do not format the drive, but apply a FAT label if required.
+
+ # Prepare for using mlabel to change the FAT label:
+ MTOOLSRCFILE=$(mktemp -p /tmp -t mtoolsrc.XXXXXX)
+ echo "drive s: file=\"$TARGETPART\"" > $MTOOLSRCFILE
+
+ if [ -n "$CUSTOMLABEL" ]; then
+ # User gave us a FAT label to use, so we will force that upon the drive:
+ echo "--- Setting FAT partition label to '$FATLABEL'"
+ MTOOLSRC=$MTOOLSRCFILE mlabel s:${FATLABEL}
+ elif [ -n "$(/sbin/blkid -t TYPE=vfat -s LABEL -o export $TARGETPART)" ] ; then
+ # User did not care, but the USB stick has a FAT label that we will use:
+ eval $(/sbin/blkid -t TYPE=vfat -s LABEL -o export $TARGETPART)
+ FATLABEL=$LABEL
+ echo "--- Using current FAT partition label '$FATLABEL'"
+ unset LABEL
+ else
+ # No user-supplied label, nor a drive label present. We apply our default:
+ echo "--- Setting FAT partition label to '$FATLABEL'"
+ MTOOLSRC=$MTOOLSRCFILE mlabel s:${FATLABEL}
+ fi
+
+ # Cleanup:
+ rm -f $MTOOLSRCFILE
fi
# Create a temporary mount point for the image file:
@@ -298,7 +366,7 @@ if [ ! -d $MNTDIR1 ]; then
echo "*** Failed to create a temporary mount point for the image!"
exit 1
else
- chmod 700 $MNTDIR1
+ chmod 711 $MNTDIR1
fi
# Create a temporary mount point for the USB thumb drive partition:
@@ -307,7 +375,7 @@ if [ ! -d $MNTDIR2 ]; then
echo "*** Failed to create a temporary mount point for the usb thumb drive!"
exit 1
else
- chmod 700 $MNTDIR2
+ chmod 711 $MNTDIR2
fi
# Create a temporary directory to extract the initrd if needed:
@@ -316,7 +384,7 @@ if [ ! -d $MNTDIR3 ]; then
echo "*** Failed to create a temporary directory to extract the initrd!"
exit 1
else
- chmod 700 $MNTDIR3
+ chmod 711 $MNTDIR3
fi
# Mount the image file:
@@ -369,7 +437,7 @@ fi
# Copy boot image files to the USB disk in its own subdirectory '/syslinux':
echo "--- Copying boot files to the USB drive..."
mkdir -p $MNTDIR2/syslinux
-cp -a $MNTDIR1/* $MNTDIR2/syslinux/
+cp -R $MNTDIR1/* $MNTDIR2/syslinux/
rm -f $MNTDIR2/syslinux/ldlinux.sys
# If we are creating a full Slackware installer, there is a lot more to do:
@@ -389,10 +457,13 @@ if [ "$FULLINSTALLER" = "yes" ]; then
# Adapt the dialogs so that pressing [OK] will be all there is to it:
sed -i -e 's# --menu# --default-item 6 --menu#' usr/lib/setup/SeTmedia
sed -i -e "s# 2> \$TMP/sourcedir# /usbinstall/$(basename $REPOSROOT)/$PKGDIR 2> \$TMP/sourcedir#" usr/lib/setup/INSdir
+ FIXF=$(find usr/lib/setup -name SeTp*media)
+ sed -i -e 's# --menu# --default-item 3 --menu#' $FIXF
) 2>>$LOGFILE
# Recreate the initrd:
echo "--- Gzipping the initrd image again:"
+ chmod 0755 ${MNTDIR3}
( cd ${MNTDIR3}/
find . |cpio -o -H newc |gzip > ${MNTDIR2}/syslinux/initrd.img
) 2>>$LOGFILE
@@ -400,11 +471,10 @@ if [ "$FULLINSTALLER" = "yes" ]; then
# Copy Slackware package tree (no sources) to the USB disk -
# we already made sure that ${REPOSROOT} does not end with a '/'
echo "--- Copying Slackware package tree to the USB drive..."
- rsync -rptHDL $EXCLUDES $REPOSROOT $MNTDIR2/
+ rsync -rpthDL --delete $EXCLUDES $REPOSROOT $MNTDIR2/
fi
# Unmount/remove stuff:
-sync
cleanup
# Run syslinux and write a good MBR: