summaryrefslogtreecommitdiffstats
path: root/slackware64-current/usb-and-pxe-installers
diff options
context:
space:
mode:
authorAdrien Nader <adrien@notk.org>2011-03-22 09:54:28 +0100
committerAdrien Nader <adrien@notk.org>2011-03-22 09:54:28 +0100
commit719044583bb5ce13a7396b0cf90f51b0540378c7 (patch)
treed54d877a0e5fbedd478c1ef770b8b8b74707e776 /slackware64-current/usb-and-pxe-installers
parent0dea479ee4fac26275d7e347773d86b2a8fec939 (diff)
Tue Mar 22 06:59:13 UTC 2011
We'll call this Slackware 13.37 release candidate 3. It seems like most of the important pieces are in place now. :-) a/mkinitrd-1.4.6-x86_64-7.txz: Rebuilt. Use "mdadm -S -s" in the init script to fix device numbers. Thanks to Eric Hameleers. Poke the kernel with fdisk after assembling RAID. Thanks to Csaba Biegl. a/sysvinit-scripts-1.2-noarch-39.txz: Rebuilt. In rc.6 and rc.6, use -f when unmounting remote filesystems to avoid getting stuck in the case of a dead server. In rc.M, start /etc/rc.d/rc.autofs if it is executable. Thanks to Csaba Biegl. ap/linuxdoc-tools-0.9.66-x86_64-8.txz: Rebuilt. Upgraded to gnome-doc-utils-0.20.4. kde/polkit-qt-1-r1145513-x86_64-2.txz: Rebuilt. Patched to fix a crash at logout. l/gdk-pixbuf2-2.23.1-x86_64-1.txz: Upgraded. l/system-config-printer-1.2.7-x86_64-1.txz: Upgraded. l/pycups-1.9.55-x86_64-1.txz: Upgraded. n/nfs-utils-1.2.3-x86_64-3.txz: Rebuilt. Added /etc/nfsmount.conf set to protocol version 3 by default. Thanks to Niels Horn. x/libhangul-0.0.12-x86_64-1.txz: Upgraded. xap/gnuchess-5.08-x86_64-2.txz: Rebuilt. Upgraded to xboard-4.5.1. Fixed xboard.desktop. Thanks to Eric Hameleers. xap/mozilla-firefox-4.0-x86_64-1.txz: Upgraded. Thanks to the Mozilla Foundation for all the hard work on Firefox 4.0! extra/bash-completion/bash-completion-1.3-noarch-3.txz: Rebuilt. Complete on 'sh' the same as stock bash. Thanks to Robby Workman. extra/google-chrome/*: Added. Added a google-chrome.SlackBuild to convert the Google Chrome .deb packages for Slackware. Thanks to Erik Hanson. Also added GConf and ORBit2 packages for Google Chrome in this directory.
Diffstat (limited to 'slackware64-current/usb-and-pxe-installers')
-rw-r--r--slackware64-current/usb-and-pxe-installers/usbimg2disk.sh85
1 files changed, 69 insertions, 16 deletions
diff --git a/slackware64-current/usb-and-pxe-installers/usbimg2disk.sh b/slackware64-current/usb-and-pxe-installers/usbimg2disk.sh
index 7c0ec0d30..34a6c0a7f 100644
--- a/slackware64-current/usb-and-pxe-installers/usbimg2disk.sh
+++ b/slackware64-current/usb-and-pxe-installers/usbimg2disk.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
-# $Id: usbimg2disk.sh,v 1.12 2010/12/28 16:32:12 eha Exp eha $
+#!/bin/bash
+# $Id: usbimg2disk.sh,v 1.13 2011/03/20 00:19:41 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
@@ -94,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
@@ -106,7 +109,22 @@ 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
@@ -125,7 +143,7 @@ makebootable() {
# Sanity checks:
if [ ! -b $USBDRV ]; then
- echo "Not a block device: '$USBDRV' !"
+ echo "*** Not a block device: '$USBDRV' !"
exit 1
fi
@@ -162,7 +180,7 @@ while [ ! -z "$1" ]; do
shift 2
;;
-s|--slackdir)
- REPOSROOT="$(cd $(dirname $2); pwd)/$(basename $2)"
+ REPODIR="$2"
FULLINSTALLER="yes"
shift 2
;;
@@ -171,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
@@ -184,18 +202,30 @@ 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 [ ! -d "$REPODIR" ]; then
+ echo "*** This is not a directory: '$REPODIR' !"
exit 1
fi
+# 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)"
+
# 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"
@@ -291,12 +321,36 @@ 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 with label '${FATLABEL}'..."
+ 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 $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 $TARGETPART
+ FATLABEL=LABEL
+ 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:
@@ -408,11 +462,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: