summaryrefslogtreecommitdiffstats
path: root/iso2usb.sh
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2020-06-25 19:14:50 +0200
committer Eric Hameleers <alien@slackware.com>2020-06-25 19:14:50 +0200
commit864930baf17782129b43dad6f28648cbb73853c6 (patch)
treee13cc48e5f8597084fde776f6c470a2910d4c917 /iso2usb.sh
parent82b052cd169533953c7983e1999168a26d777d09 (diff)
downloadliveslak-864930baf17782129b43dad6f28648cbb73853c6.tar.gz
liveslak-864930baf17782129b43dad6f28648cbb73853c6.tar.xz
iso2usb.sh: really wipe the drive first
When a Live ISO is first copied to a USB drive using 'cp' or 'dd' and next you use iso2usb.sh to remake the USB drive into a persistent Live OS, traces of the old ISO9660 filesystem will remain and this confuses grub when you boot on a UEFI computer. So we will additionally use 'wipefs' to erase traces of filesystems. In the help text, make it clear that '-c' and '-C' accept only integer numbers for sizes and percentages. This is caused by a bash limitation in arithmetics.
Diffstat (limited to '')
-rw-r--r--iso2usb.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/iso2usb.sh b/iso2usb.sh
index 23ecd32..cd485ee 100644
--- a/iso2usb.sh
+++ b/iso2usb.sh
@@ -80,7 +80,7 @@ DOLUKS=0
REFRESH=0
# These tools are required by the script, we will check for their existence:
-REQTOOLS="blkid cpio extlinux fdisk gdisk isoinfo lsblk mkdosfs sgdisk syslinux"
+REQTOOLS="blkid cpio extlinux fdisk gdisk isoinfo lsblk mkdosfs sgdisk syslinux wipefs"
# Path to syslinux files:
if [ -d /usr/share/syslinux ]; then
@@ -156,8 +156,9 @@ cat <<EOT
# $(basename $0) accepts the following parameters:
# -c|--crypt size|perc Add LUKS encrypted /home ; parameter is the
# requested size of the container in kB, MB, GB,
-# or as a percentage of free space.
-# Examples: '-c 125M', '-c 1.3G', '-c 20%'.
+# or as a percentage of free space
+# (integer numbers only).
+# Examples: '-c 125M', '-c 2G', '-c 20%'.
# -d|--devices List removable devices on this computer.
# -f|--force Ignore most warnings (except the back-out).
# -h|--help This help.
@@ -182,7 +183,9 @@ cat <<EOT
# free space for a custom 4th partition'.
# -C|--cryptpersistfile size|perc
# Use a LUKS-encrypted 'persistence' file instead
-# of a directory (for use on FAT filesystem).
+# of a directory (for use on FAT filesystem)
+# Format for size/percentage is the same
+# as for the '-c' parameter.
# -P|--persistfile Use a 'persistence' container file instead of
# a directory (for use on FAT filesystem).
#
@@ -638,7 +641,10 @@ if [ $REFRESH -eq 0 ]; then
# Make sure that there is no MBR nor a partition table anymore:
dd if=/dev/zero of=$TARGET bs=512 count=1 conv=notrunc
+ # We have to use wipefs before sgdisk or else traces of an old 'cp' or 'dd'
+ # of a Live ISO image to the device will not be erased.
# The sgdisk wipe command is allowed to have non-zero exit code:
+ wipefs -af $TARGET
sgdisk -og $TARGET || true
# After the wipe, get the value of the last usable sector: