2 # Transfer a Live image so that it's bootable off of a USB/SD device.
3 # Copyright 2007-2012 Red Hat, Inc.
5 # Jeremy Katz <katzj@redhat.com>
6 # Brian C. Lane <bcl@redhat.com>
8 # overlay/persistence enhancements by Douglas McClendon <dmc@viros.org>
9 # GPT+MBR hybrid enhancements by Stewart Adam <s.adam@diffingo.com>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; version 2 of the License.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Library General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 export PATH
=/sbin
:/usr
/sbin
:$PATH
31 livecd-iso-to-disk [--help] [--noverify] [--format] [--msdos] [--reset-mbr]
32 [--efi] [--skipcopy] [--force] [--xo] [--xo-no-home]
33 [--timeout <time>] [--totaltimeout <time>]
34 [--extra-kernel-args <args>] [--multi] [--livedir <dir>]
35 [--compress] [--skipcompress] [--swap-size-mb <size>]
36 [--overlay-size-mb <size>] [--home-size-mb <size>]
37 [--delete-home] [--crypted-home] [--unencrypted-home]
38 <source> <target device>
40 (Enter livecd-iso-to-disk --help on the command line for more information.)"
48 livecd-iso-to-disk - Transfer a LiveOS image so that it's bootable off of
51 The script may be run in simplest form with just the two arguments:
54 This may be the filesystem path to a LiveOS .iso image file,
55 such as from a CD-ROM, DVD, or download. It could also be the
56 device node reference for the mount point of another LiveOS
57 filesystem, including the currently-running one (such as a
58 booted Live CD/DVD/USB, where /dev/live references the running
62 This should be the device partition name for the attached,
63 target device, such as /dev/sdb1 or /dev/sdc1. (Issue the
64 df -Th command to get a listing of the mounted partitions,
65 where you can confirm the filesystem types, available space,
66 and device names.) Be careful to specify the correct device,
67 or you may overwrite important data on another disk!
69 To execute the script to completion, you will need to run it with root user
71 SYSLINUX must be installed on the computer running the installation script.
75 livecd-iso-to-disk installs a Live CD/DVD/USB image (LiveOS) onto a USB/SD
76 storage device (or any storage partition that will boot with a SYSLINUX
77 bootloader). The target storage device can then boot the installed
78 operating system on systems that support booting via the USB or the SD
79 interface. The script requires a LiveOS source image and a target storage
80 device. The source image may be either a LiveOS .iso file, the currently-
81 running LiveOS image, the device node reference for an attached device with
82 an installed LiveOS image, or a file backed by a block device with an
83 installed LiveOS image. If the operating system supports persistent
84 overlays for saving system changes, a pre-sized overlay may be included with
87 Unless you request the --format option, the installation does not destroy
88 data outside of the LiveOS, syslinux, & EFI folders on your target device.
89 This allows one to maintain other files on the target disk outside of the
92 LiveOS images provide embedded filesystems through the Device-mapper
93 component of the Linux kernel. The embedded filesystems exist within files
94 such as /LiveOS/squashfs.img (the default compressed storage) or
95 /LiveOS/ext3fs.img (an uncompressed version) on the primary volume partition
96 of the storage device. In use, these are read-only filesystems. Optionally,
97 one may specify a persistent LiveOS overlay to hold image-change snapshots
98 (that use write-once, difference-tracking storage) in the
99 /LiveOS/overlay-<device_id> file, which, *one should note*, always grows in
100 size due to the storage mechanism. (The fraction of allocated space that
101 has been consumed by system activity and changes may be displayed by issuing
102 the 'dmsetup status' command in a terminal session of a running LiveOS
103 image.) One way to conserve the unrecoverable, overlay file space, is to
104 specify a persistent home folder for user files, which will be saved in a
105 /LiveOS/home.img filesystem image file. This file space is encrypted by
106 default, but is not compressed. (One may bypass encryption with the
107 --unencrypted-home installation option.) Files in this home folder may be
108 erased to recover and reuse their storage space. The home.img file is also
109 convenient for backing up or swapping user account files.
114 Displays usage information and exits.
117 Disables the image validation process that occurs before the image is
118 installed from the original Live CD .iso image. When this option is
119 specified, the image is not verified before loading onto the target
123 Formats the target device and creates an MS-DOS partition table (or GPT
124 partition table, if the --efi option is passed).
127 Forces format to use msdos instead of ext4.
130 Sets the Master Boot Record (MBR) of the target storage device to the
131 mbr.bin file from the installation system's syslinux directory. This
132 may be helpful in recovering a damaged or corrupted device.
135 Creates a GUID partition table when --format is passed, and installs a
136 hybrid Extensible Firmware Interface (EFI)/MBR bootloader on the disk.
137 This is necessary for most Intel Macs.
140 Skips the copying of the live image to the target device, bypassing the
141 actions of the --format, --overlay-size-mb, --home-size-mb, &
142 --swap-size-mb options, if present on the command line. (The --skipcopy
143 option may be used while testing the script, in order to avoid repeated
144 and lengthy copy commands, or to repair boot configuration files on a
145 previously installed device.)
148 This option allows the installation script to bypass a delete
149 confirmation dialog in the event that a pre-existing LiveOS directory
150 is found on the target device.
153 Used to prepare an image for the OLPC XO-1 laptop with its compressed,
154 JFFS2 filesystem. Do not use the following options with --xo:
155 --overlay-size-mb <size>, home-size-mb <size>, --delete-home,
159 Used together with the --xo option to prepare an image for an OLPC XO
160 laptop with the home folder on an SD card instead of the internal flash
164 Modifies the bootloader's timeout value, which indicates how long to
165 pause at the boot: prompt before booting automatically. This overrides
166 the value set during iso creation. Units are 1/10 s. The timeout is
167 canceled when any key is pressed, the assumption being that the user
168 will complete the command line. A timeout of zero will disable the
172 Adds a bootloader totaltimeout, which indicates how long to wait before
173 booting automatically. This is used to force an automatic boot. This
174 timeout cannot be canceled by the user. Units are 1/10 s.
176 --extra-kernel-args <args>
177 Specifies additional kernel arguments, <args>, that will be inserted
178 into the syslinux and EFI boot configurations. Multiple arguments
179 should be specified in one string, i.e.,
180 --extra-kernel-args \"arg1 arg2 ...\"
183 Used when installing multiple image copies to signal configuration of
184 the boot files for the image in the --livedir <dir> parameter.
188 Used with multiple image installations to designate the directory <dir>
189 for the particular image.
191 --compress (default state for the operating system files)
192 The default, compressed SquashFS filesystem image is copied on
193 installation. This option has no effect when the source filesystem is
196 --skipcompress (default option when --xo is specified)
197 Expands the source SquashFS image on installation into the read-only
198 /LiveOS/ext3fs.img filesystem image file.
200 --swap-size-mb <size>
201 Sets up a swap file of <size> mebibytes (integer values only) on the
204 --overlay-size-mb <size>
205 This option sets the overlay size in mebibytes (integer values only).
206 The overlay makes persistent storage available to the live operating
207 system, if the operating system supports it. The persistent LiveOS
208 overlay holds image-change snapshots (using write-once, difference-
209 tracking storage) in the /LiveOS/overlay-<device_id> file, which, *one
210 should note*, always grows in size due to the storage mechanism. (The
211 fraction of allocated space that has been consumed may be displayed by
212 issuing the 'dmsetup status' command in a terminal session of a running
213 LiveOS installation.) One way to conserve the unrecoverable, overlay
214 file space, is to specify a persistent home folder for user files, see
215 --home-size-mb below. The target storage device must have enough free
216 space for the image and the overlay. A maximum <size> of 2047 MiB is
217 permitted for vfat-formatted devices. If there is insufficient room on
218 your device, you will be given information to help in adjusting your
221 --home-size-mb <size>
222 Sets the home directory size in mebibytes (integer values only). A
223 persistent home directory will be made in the /LiveOS/home.img
224 filesystem image file. This file space is encrypted by default, but not
225 compressed (one may bypass encryption with the --unencrypted-home
226 installation option). Files in this home folder may be erased to
227 recover and reuse their storage space. The target storage device must
228 have enough free space for the image, any overlay, and the home
229 directory. Note that the --delete-home option must also be selected to
230 replace an existing persistent home with a new, empty one. A maximum
231 <size> of 2047 MiB is permitted for vfat-formatted devices. If there is
232 insufficient room on your device, you will be given information to help
233 in adjusting your settings.
236 To prevent unwitting deletion of user files, this option must be
237 explicitly selected when the option --home-size-mb <size> is selected
238 and there is an existing persistent home directory on the target device.
240 --crypted-home (default that only applies to new home-size-mb requests)
241 Specifies the default option to encrypt a new persistent home directory
242 if --home-size-mb <size> is specified.
245 Prevents the default option to encrypt a new persistent home directory.
249 livecd-iso-to-disk: David Zeuthen, Jeremy Katz, Douglas McClendon,
250 Chris Curran and other contributors.
251 (See the AUTHORS file in the source distribution for
252 the complete list of credits.)
256 Report bugs to the mailing list
257 http://admin.fedoraproject.org/mailman/listinfo/livecd or directly to
258 Bugzilla http://bugzilla.redhat.com/bugzilla/ against the Fedora product,
259 and the livecd-tools component.
263 Copyright (C) Fedora Project 2008, 2009, 2010 and various contributors.
264 This is free software. You may redistribute copies of it under the terms of
265 the GNU General Public License http://www.gnu.org/licenses/gpl.html.
266 There is NO WARRANTY, to the extent permitted by law.
270 livecd-creator, project website http://fedoraproject.org/wiki/FedoraLiveCD
277 [ -d "$SRCMNT" ] && umount
$SRCMNT && rmdir $SRCMNT
278 [ -d "$TGTMNT" ] && umount
$TGTMNT && rmdir $TGTMNT
283 if [ -d "$SRCMNT" ] ||
[ -d "$TGTMNT" ];
285 [ "$RETVAL" = 0 ] ||
echo "Cleaning up to exit..."
292 [ x
"${1#/dev/loop}" != x
"$1" ]
298 if isdevloop
"$DEV"; then
303 p
=$
(udevadm info
-q path
-n $DEV)
304 if [ $?
-gt 0 ]; then
305 echo "Error getting udev path to $DEV"
308 if [ -e /sys
/$p/device
]; then
309 device
=$
(basename /sys
/$p)
311 device
=$
(basename $
(readlink
-f /sys
/$p/..
/))
313 if [ ! -e /sys
/block
/$device -o ! -e /dev
/$device ]; then
314 echo "Error finding block device of $DEV. Aborting!"
318 device
="/dev/$device"
319 # FIXME: weird dev names could mess this up I guess
320 p
=/dev
/$
(basename $p)
321 partnum
=${p##$device}
325 if isdevloop
"$DEV"; then
329 # if efi, we need to use the hybrid MBR
330 if [ -n "$efi" ]; then
331 if [ -f /usr
/lib
/syslinux
/gptmbr.bin
]; then
332 cat /usr
/lib
/syslinux
/gptmbr.bin
> $device
333 elif [ -f /usr
/share
/syslinux
/gptmbr.bin
]; then
334 cat /usr
/share
/syslinux
/gptmbr.bin
> $device
336 echo "Could not find gptmbr.bin (syslinux)"
339 # Make it bootable on EFI and BIOS
340 parted
-s $device set $partnum legacy_boot on
342 if [ -f /usr
/lib
/syslinux
/mbr.bin
]; then
343 cat /usr
/lib
/syslinux
/mbr.bin
> $device
344 elif [ -f /usr
/share
/syslinux
/mbr.bin
]; then
345 cat /usr
/share
/syslinux
/mbr.bin
> $device
347 echo "Could not find mbr.bin (syslinux)"
354 if isdevloop
"$DEV"; then
359 bs
=$
(mktemp
/tmp
/bs.XXXXXX
)
360 dd if=$device of
=$bs bs
=512 count
=1 2>/dev
/null ||
exit 2
362 mbrword
=$
(hexdump -n 2 $bs |
head -n 1|
awk {'print $2;'})
364 if [ "$mbrword" = "0000" ]; then
365 if [ -z "$format" ]; then
366 echo "MBR appears to be blank."
367 echo "Press Enter to replace the MBR and continue or ctrl-c to abort"
380 # if we're installing to whole-disk and not a partition, then we
381 # don't need to worry about being active
382 if [ "$dev" = "$device" ]; then
385 if isdevloop
"$DEV"; then
389 if [ "$(/sbin/fdisk -l $device 2>/dev/null |grep -m1 $dev |awk {'print $2;'})" != "*" ]; then
390 echo "Partition isn't marked bootable!"
391 echo "You can mark the partition as bootable with "
392 echo " # /sbin/parted $device"
393 echo " (parted) toggle N boot"
394 echo " (parted) quit"
402 if [ -x /sbin
/pvs
-a \
403 "$(/sbin/pvs -o vg_name --noheadings $dev* 2>/dev/null || :)" ]; then
404 echo "Device, $dev, contains a volume group and cannot be formated!"
405 echo "You can remove the volume group using vgremove."
415 echo "WARNING: THIS WILL DESTROY ANY DATA ON $device!!!"
416 echo "Press Enter to continue or ctrl-c to abort"
418 umount
${device}* &> /dev
/null ||
:
420 /sbin
/parted
--script $device mklabel gpt
421 partinfo
=$
(LC_ALL
=C
/sbin
/parted
--script -m $device "unit MB print" |
grep ^
$device:)
422 dev_size
=$
(echo $partinfo |cut
-d : -f 2 |
sed -e 's/MB$//')
423 p1_size
=$
(($dev_size - 3))
425 if [ $p1_size -le 0 ]; then
426 echo "Your device isn't big enough to hold $SRC"
427 echo "It is $(($p1_size * -1)) MB too small"
431 p1_end
=$
(($p1_size + 1))
432 /sbin
/parted
-s $device u MB mkpart
'"EFI System Partition"' fat32
$p1_start $p1_end set 1 boot on
433 # Sometimes automount can be _really_ annoying.
434 echo "Waiting for devices to settle..."
438 umount
$TGTDEV &> /dev
/null ||
:
439 /sbin
/mkdosfs
-n LIVE
$TGTDEV
440 TGTLABEL
="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
443 createMSDOSLayout
() {
447 echo "WARNING: THIS WILL DESTROY ANY DATA ON $device!!!"
448 echo "Press Enter to continue or ctrl-c to abort"
450 umount
${device}* &> /dev
/null ||
:
452 /sbin
/parted
--script $device mklabel msdos
453 partinfo
=$
(LC_ALL
=C
/sbin
/parted
--script -m $device "unit MB print" |
grep ^
$device:)
454 dev_size
=$
(echo $partinfo |cut
-d : -f 2 |
sed -e 's/MB$//')
455 p1_size
=$
(($dev_size - 3))
457 if [ $p1_size -le 0 ]; then
458 echo "Your device isn't big enough to hold $SRC"
459 echo "It is $(($p1_size * -1)) MB too small"
463 p1_end
=$
(($p1_size + 1))
464 /sbin
/parted
-s $device u MB mkpart primary fat32
$p1_start $p1_end set 1 boot on
465 # Sometimes automount can be _really_ annoying.
466 echo "Waiting for devices to settle..."
469 if ! isdevloop
"$DEV"; then
474 umount
$TGTDEV &> /dev
/null ||
:
475 /sbin
/mkdosfs
-n LIVE
$TGTDEV
476 TGTLABEL
="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
479 createEXTFSLayout
() {
483 echo "WARNING: THIS WILL DESTROY ANY DATA ON $device!!!"
484 echo "Press Enter to continue or ctrl-c to abort"
486 umount
${device}* &> /dev
/null ||
:
488 /sbin
/parted
-s $device mklabel msdos
489 partinfo
=$
(LC_ALL
=C
/sbin
/parted
-s -m $device "u MB print" |
grep ^
$device:)
490 dev_size
=$
(echo $partinfo |cut
-d : -f 2 |
sed -e 's/MB$//')
491 p1_size
=$
(($dev_size - 3))
493 if [ $p1_size -le 0 ]; then
494 echo "Your device isn't big enough to hold $SRC"
495 echo "It is $(($p1_size * -1)) MB too small"
499 p1_end
=$
(($p1_size + 1))
500 /sbin
/parted
-s $device u MB mkpart primary ext2
$p1_start $p1_end set 1 boot on
501 # Sometimes automount can be _really_ annoying.
502 echo "Waiting for devices to settle..."
506 umount
$TGTDEV &> /dev
/null ||
:
508 # Check extlinux version
509 if extlinux
-v 2>&1 |
grep -q 'extlinux 3'; then
514 $mkfs -L LIVE
$TGTDEV
515 TGTLABEL
="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
522 if [ "$(/sbin/fdisk -l $device 2>/dev/null |grep -c GPT)" -eq "0" ]; then
523 echo "EFI boot requires a GPT partition table."
524 echo "This can be done manually or you can run with --format"
528 partinfo
=$
(LC_ALL
=C
/sbin
/parted
--script -m $device "print" |
grep ^
$partnum:)
529 volname
=$
(echo $partinfo |cut
-d : -f 6)
530 flags
=$
(echo $partinfo |cut
-d : -f 7)
531 if [ "$volname" != "EFI System Partition" ]; then
532 echo "Partition name must be 'EFI System Partition'"
533 echo "This can be set in parted or you can run with --reset-mbr"
536 if [ "$(echo $flags |grep -c boot)" = "0" ]; then
537 echo "Partition isn't marked bootable!"
538 echo "You can mark the partition as bootable with "
539 echo " # /sbin/parted $device"
540 echo " (parted) toggle N boot"
541 echo " (parted) quit"
549 TGTFS
=$
(/sbin
/blkid
-s TYPE
-o value
$dev ||
:)
550 if [ "$TGTFS" != "vfat" ] && [ "$TGTFS" != "msdos" ]; then
551 if [ "$TGTFS" != "ext2" ] && [ "$TGTFS" != "ext3" ] && [ "$TGTFS" != "ext4" ] && [ "$TGTFS" != "btrfs" ]; then
552 echo "Target filesystem ($dev:$TGTFS) must be vfat, ext[234] or btrfs"
557 TGTLABEL
=$
(/sbin
/blkid
-s LABEL
-o value
$dev)
558 if [ "$TGTLABEL" != "LIVE" ]; then
559 if [ "$TGTFS" = "vfat" -o "$TGTFS" = "msdos" ]; then
560 /sbin
/dosfslabel
$dev LIVE
561 if [ $?
-gt 0 ]; then
562 echo "dosfslabel failed on $dev, device not setup"
565 elif [ "$TGTFS" = "ext2" -o "$TGTFS" = "ext3" -o "$TGTFS" = "ext4" ]; then
566 /sbin
/e2label
$dev LIVE
567 if [ $?
-gt 0 ]; then
568 echo "e2label failed on $dev, device not setup"
572 echo "Unknown filesystem type. Try setting its label to LIVE and re-running"
577 # Use UUID if available
578 TGTUUID
=$
(/sbin
/blkid
-s UUID
-o value
$dev)
579 if [ -n "$TGTUUID" ]; then
580 TGTLABEL
="UUID=$TGTUUID"
582 TGTLABEL
="LABEL=LIVE"
585 if [ "$TGTFS" = "vfat" -o "$TGTFS" = "msdos" ]; then
586 mountopts
="-o shortname=winnt,umask=0077"
590 checkSyslinuxVersion
() {
591 if [ ! -x /usr
/bin
/syslinux
]; then
592 echo "You need to have syslinux installed to run this script"
595 check
=($
(syslinux
--version 2>&1)) ||
:
596 if [[ 'syslinux' != $check ]]; then
598 elif [ -n "$multi" ]; then
599 SYSLINUXPATH
="$LIVEOS/syslinux"
601 SYSLINUXPATH
="syslinux"
607 if grep -q "^$dev " /proc
/mounts
; then
608 echo "$dev is mounted, please unmount for safety"
611 if grep -q "^$dev " /proc
/swaps
; then
612 echo "$dev is in use as a swap device, please disable swap"
618 if ! test $1 -gt 0 2>/dev
/null
; then
624 if [ $
(id
-u) != 0 ]; then
625 echo "You need to be root to run this script"
630 if [[ -e "$SRCMNT/Packages" ]]; then
631 echo "/Packages found, will copy source packages to target"
634 if [[ -e "$SRCMNT/LiveOS/squashfs.img" ]]; then
635 # LiveOS style boot image
639 if [ -e $SRCMNT/images
/install.img
-o -e $SRCMNT/isolinux
/initrd.img
]; then
640 if [ -n "$packages" ]; then
646 if [ ! -e $SRCMNT/images
/install.img
]; then
647 echo "$SRC uses initrd.img w/o install.img"
652 echo "ERROR: $SRC does not appear to be a Live image or DVD installer."
657 strace
-q -ewrite cp -- "${1}" "${2}" 2>&1 \
660 if (count % 10 == 0) {
661 percent = count / total_size * 100
662 printf "%3d%% [", percent
663 for (i=0;i<=percent;i++)
666 for (i=percent;i<100;i++)
671 END { print "" }' total_size
=$
(stat
-c '%s' "${1}") count
=0
675 if [ -x /usr
/bin
/rsync
]; then
676 rsync
--inplace -P "$1" "$2"
679 if [ -x /usr
/bin
/gvfs-copy
]; then
680 gvfs-copy
-p "$1" "$2"
683 if [ -x /usr
/bin
/strace
-a -x /bin
/awk ]; then
706 if [[ "$*" =~
"--help" ]]; then
709 while [ $# -gt 2 ]; do
723 --reset-mbr|
--resetmbr)
794 echo "invalid arg -- $1"
802 SRC
=$
(readlink
-f "$1")
803 TGTDEV
=$
(readlink
-f "$2")
805 if [ -z "$SRC" ]; then
806 echo "Missing source"
811 if [ ! -b "$SRC" -a ! -f "$SRC" ]; then
812 echo "$SRC is not a file or block device"
817 if [ -z "$TGTDEV" ]; then
818 echo "Missing target device"
823 if [ ! -b "$TGTDEV" ]; then
824 echo "$TGTDEV is not a block device"
829 if [ -z "$noverify" ]; then
831 echo "Verifying image..."
832 if ! checkisomd5
--verbose "$SRC"; then
833 echo "Are you SURE you want to continue?"
834 echo "Press Enter to continue or ctrl-c to abort"
839 # do some basic sanity checks.
842 # FIXME: would be better if we had better mountpoints
843 SRCMNT
=$
(mktemp
-d /media
/srctmp.XXXXXX
)
844 if [ -b "$SRC" ]; then
845 mount
-o ro
"$SRC" $SRCMNT || exitclean
846 elif [ -f "$SRC" ]; then
847 mount
-o loop
,ro
"$SRC" $SRCMNT || exitclean
849 echo "$SRC is not a file or block device."
852 # Figure out what needs to be done based on the source image
856 if [ -n "$format" -a -z "$skipcopy" ]; then
859 if [ -n "$efi" ]; then
860 createGPTLayout
$TGTDEV
861 elif [ -n "$usemsdos" -o ! -x /sbin
/extlinux
]; then
862 createMSDOSLayout
$TGTDEV
864 createEXTFSLayout
$TGTDEV
868 checkFilesystem
$TGTDEV
869 if [ -n "$efi" ]; then
874 # Because we can't set boot flag for EFI Protective on msdos partition tables
875 [ -z "$efi" ] && checkPartActive
$TGTDEV
876 [ -n "$resetmbr" ] && resetMBR
$TGTDEV
880 if [ "$overlaysizemb" -gt 0 ]; then
881 if [ "$TGTFS" = "vfat" -a "$overlaysizemb" -gt 2047 ]; then
882 echo "Can't have an overlay of 2048MB or greater on VFAT"
885 LABEL
=$
(/sbin
/blkid
-s LABEL
-o value
$TGTDEV)
886 if [[ "$LABEL" =~
( ) ]]; then
887 echo "The LABEL($LABEL) on $TGTDEV has spaces in it, which do not work with the overlay"
888 echo "You can re-format or use dosfslabel/e2fslabel to change it"
893 if [ "$homesizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
894 if [ "$homesizemb" -gt 2047 ]; then
895 echo "Can't have a home overlay greater than 2048MB on VFAT"
900 if [ "$swapsizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
901 if [ "$swapsizemb" -gt 2047 ]; then
902 echo "Can't have a swap file greater than 2048MB on VFAT"
907 TGTMNT
=$
(mktemp
-d /media
/tgttmp.XXXXXX
)
908 mount
$mountopts $TGTDEV $TGTMNT || exitclean
910 trap exitclean SIGINT SIGTERM
912 if [ -f "$TGTMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ]; then
913 echo "ERROR: Requested keeping existing /home and specified a size for /home"
914 echo "Please either don't specify a size or specify --delete-home"
918 if [ -n "$efi" ]; then
919 if [ -d $SRCMNT/EFI
/BOOT
]; then
921 elif [ -d $SRCMNT/EFI
/boot
]; then
924 echo "ERROR: This live image does not support EFI booting"
929 # let's try to make sure there's enough room on the target device
930 if [[ -d $TGTMNT/$LIVEOS ]]; then
931 tbd
=($
(du
-B 1M
$TGTMNT/$LIVEOS))
932 if [[ -s $TGTMNT/$LIVEOS/$HOMEFILE ]] && [[ -n $keephome ]]; then
933 homesize
=($
(du
-B 1M
$TGTMNT/$LIVEOS/$HOMEFILE))
934 tbd
=$
((tbd
- homesize
))
940 if [[ live
== $srctype ]]; then
941 targets
="$TGTMNT/$SYSLINUXPATH"
942 [[ -n $efi ]] && targets
+=" $TGTMNT$EFI_BOOT"
943 [[ -n $xo ]] && targets
+=" $TGTMNT/boot/olpc.fth"
944 duTable
=($
(du
-c -B 1M
$targets 2> /dev
/null ||
:))
945 tbd
=$
((tbd
+ ${duTable[*]: -2:1}))
948 if [[ -n $skipcompress ]] && [[ -s $SRCMNT/LiveOS
/squashfs.img
]]; then
949 if mount
-o loop
$SRCMNT/LiveOS
/squashfs.img
$SRCMNT; then
950 livesize
=($
(du
-B 1M
--apparent-size $SRCMNT/LiveOS
/ext3fs.img
))
952 if ((livesize
> 2048)) && [[ vfat
== $TGTFS ]]; then
954 An uncompressed image size greater than 2048 MB is not suitable
955 for a VFAT-formatted device. The compressed SquashFS will be
956 copied to the target device.
962 echo "WARNING: --skipcompress or --xo was specified but the
963 currently-running kernel can not mount the SquashFS from the source
964 file to extract it. Instead, the compressed SquashFS will be copied
965 to the target device."
969 if [[ live
== $srctype ]]; then
970 thisScriptpath
=$
(readlink
-f "$0")
971 sources
="$SRCMNT/LiveOS/ext3fs.img $SRCMNT/LiveOS/osmin.img"
972 [[ -z $skipcompress ]] && sources
+=" $SRCMNT/LiveOS/squashfs.img"
973 sources
+=" $SRCMNT/isolinux $SRCMNT/syslinux"
974 [[ -n $efi ]] && sources
+=" $SRCMNT$EFI_BOOT"
975 [[ -n $xo ]] && sources
+=" $SRCMNT/boot/olpc.fth"
976 duTable
=($
(du
-c -B 1M
"$thisScriptpath" $sources 2> /dev
/null ||
:))
977 livesize
=$
((livesize
+ ${duTable[*]: -2:1}))
980 freespace
=($
(df
-B 1M
--total $TGTDEV))
981 freespace
=${freespace[*]: -2:1}
983 if [[ live
== $srctype ]]; then
984 tba
=$
((overlaysizemb
+ homesizemb
+ livesize
+ swapsizemb
))
985 if ((tba
> freespace
+ tbd
)); then
986 needed
=$
((tba
- freespace
- tbd
))
987 printf "\n The live image + overlay, home, & swap space, if requested,
988 \r will NOT fit in the space available on the target device.\n
989 \r + Size of live image: %10s MiB\n" $livesize
990 (($overlaysizemb > 0)) && \
991 printf " + Overlay size: %16s\n" $overlaysizemb
992 (($homesizemb > 0)) && \
993 printf " + Home directory size: %9s\n" $homesizemb
994 (($swapsizemb > 0)) && \
995 printf " + Swap overlay size: %11s\n" $swapsizemb
996 printf " = Total requested space: %6s MiB\n" $tba
997 printf " - Space available: %12s\n" $
((freespace
+ tbd
))
998 printf " ==============================\n"
999 printf " Space needed: %15s MiB\n\n" $needed
1000 printf " To fit the installation on this device,
1001 \r free space on the target, or decrease the
1002 \r requested size total by: %6s MiB\n\n" $needed
1007 # Verify available space for DVD installer
1008 if [ "$srctype" = "installer" ]; then
1009 if [ "$imgtype" = "install" ]; then
1010 imgpath
=images
/install.img
1012 imgpath
=isolinux
/initrd.img
1014 installimgsize
=$
(du
-s -B 1M
$SRCMNT/$imgpath |
awk {'print $1;'})
1017 if [ -e $TGTMNT/$imgpath ]; then
1018 tbd
=$
(du
-s -B 1M
$TGTMNT/$imgpath |
awk {'print $1;'})
1020 if [ -e "$TGTMNT/$(basename "$SRC")" ]; then
1021 tbd
=$
(($tbd + $
(du
-s -B 1M
"$TGTMNT/$(basename "$SRC")" |
awk {'print $1;'})))
1023 echo "Size of $imgpath: $installimgsize"
1024 echo "Available space: $((freespace + tbd))"
1025 if (( installimgsize
> ((freespace
+ tbd
)) )); then
1026 echo "ERROR: Unable to fit DVD image + install.img on available space on the target device."
1031 if [ -z "$skipcopy" ] && [ "$srctype" = "live" ]; then
1032 if [ -d $TGTMNT/$LIVEOS -a -z "$force" ]; then
1033 echo "Already set up as live image."
1034 if [ -z "$keephome" -a -e $TGTMNT/$LIVEOS/$HOMEFILE ]; then
1035 echo "WARNING: Persistent /home will be deleted!!!"
1036 echo "Press Enter to continue or ctrl-c to abort"
1039 echo "Deleting old OS in fifteen seconds..."
1042 [ -e "$TGTMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" ] && mv $TGTMNT/$LIVEOS/$HOMEFILE $TGTMNT/$HOMEFILE
1045 rm -rf $TGTMNT/$LIVEOS
1049 # Bootloader is always reconfigured, so keep these out of the if skipcopy stuff.
1050 [ ! -d $TGTMNT/$SYSLINUXPATH ] && mkdir
-p $TGTMNT/$SYSLINUXPATH
1051 [ -n "$efi" -a ! -d $TGTMNT$EFI_BOOT ] && mkdir
-p $TGTMNT$EFI_BOOT
1054 if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
1055 echo "Copying live image to target device."
1056 [ ! -d $TGTMNT/$LIVEOS ] && mkdir
$TGTMNT/$LIVEOS
1057 [ -n "$keephome" -a -f "$TGTMNT/$HOMEFILE" ] && mv $TGTMNT/$HOMEFILE $TGTMNT/$LIVEOS/$HOMEFILE
1058 if [ -n "$skipcompress" -a -f $SRCMNT/LiveOS
/squashfs.img
]; then
1059 mount
-o loop
$SRCMNT/LiveOS
/squashfs.img
$SRCMNT || exitclean
1060 copyFile
$SRCMNT/LiveOS
/ext3fs.img
$TGTMNT/$LIVEOS/ext3fs.img ||
{
1061 umount
$SRCMNT ; exitclean
; }
1063 elif [ -f $SRCMNT/LiveOS
/squashfs.img
]; then
1064 copyFile
$SRCMNT/LiveOS
/squashfs.img
$TGTMNT/$LIVEOS/squashfs.img || exitclean
1065 elif [ -f $SRCMNT/LiveOS
/ext3fs.img
]; then
1066 copyFile
$SRCMNT/LiveOS
/ext3fs.img
$TGTMNT/$LIVEOS/ext3fs.img || exitclean
1068 if [ -f $SRCMNT/LiveOS
/osmin.img
]; then
1069 copyFile
$SRCMNT/LiveOS
/osmin.img
$TGTMNT/$LIVEOS/osmin.img || exitclean
1074 # Adjust syslinux sources for replication of installed images
1075 # between filesystem types.
1076 if [[ -d $SRCMNT/isolinux
/ ]]; then
1077 cp $SRCMNT/isolinux
/* $TGTMNT/$SYSLINUXPATH
1078 elif [[ -d $SRCMNT/syslinux
/ ]]; then
1079 cp $SRCMNT/syslinux
/* $TGTMNT/$SYSLINUXPATH
1080 if [[ -f $SRCMNT/syslinux
/extlinux.conf
]]; then
1081 mv $TGTMNT/$SYSLINUXPATH/extlinux.conf \
1082 $TGTMNT/$SYSLINUXPATH/isolinux.cfg
1083 elif [[ -f $SRCMNT/syslinux
/syslinux.cfg
]]; then
1084 mv $TGTMNT/$SYSLINUXPATH/syslinux.cfg
$TGTMNT/$SYSLINUXPATH/isolinux.cfg
1087 BOOTCONFIG
=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
1088 # Set this to nothing so sed doesn't care
1090 if [ -n "$efi" ]; then
1091 echo "Setting up $EFI_BOOT"
1092 cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
1095 # There is a problem here. On older LiveCD's the files are boot?*.conf
1096 # They really should be renamed to BOOT?*.conf
1098 # this is a little ugly, but it gets the "interesting" named config file
1099 BOOTCONFIG_EFI
=$TGTMNT$EFI_BOOT/+(BOOT|boot
)?
*.conf
1100 rm -f $TGTMNT$EFI_BOOT/grub.conf
1102 # On some images (RHEL) the BOOT*.efi file isn't in $EFI_BOOT, but is in
1103 # the eltorito image, so try to extract it if it is missing
1105 # test for presence of *.efi grub binary
1106 if [ ! -f $TGTMNT$EFI_BOOT/+(BOOT|boot
)?
*.efi
]; then
1107 if [ ! -x /usr
/bin
/dumpet
]; then
1108 echo "No /usr/bin/dumpet tool found. EFI image will not boot."
1109 echo "Source media is missing grub binary in /EFI/BOOT/*efi"
1112 # dump the eltorito image with dumpet, output is $SRC.1
1114 EFIMNT
=$
(mktemp
-d /media
/srctmp.XXXXXX
)
1115 mount
-o loop
"$SRC".1 $EFIMNT
1117 if [ -f $EFIMNT$EFI_BOOT/+(BOOT|boot
)?
*.efi
]; then
1118 cp $EFIMNT$EFI_BOOT/+(BOOT|boot
)?
*.efi
$TGTMNT$EFI_BOOT
1120 echo "No BOOT*.efi found in eltorito image. EFI will not boot"
1131 # DVD installer copy
1132 if [ -z "$skipcopy" -a \
( "$srctype" = "installer" -o "$srctype" = "netinst" \
) ]; then
1133 echo "Copying DVD image to target device."
1134 mkdir
-p $TGTMNT/images
/
1135 if [ "$imgtype" = "install" ]; then
1136 for img
in install.img updates.img product.img
; do
1137 if [ -e $SRCMNT/images
/$img ]; then
1138 copyFile
$SRCMNT/images
/$img $TGTMNT/images
/$img || exitclean
1144 # Copy packages over.
1145 # Before Fedora17 we could copy the .iso and setup a repo=
1146 # F17 and later look for repodata on the source media.
1147 # The presence of packages and LiveOS indicates F17 or later.
1148 if [ -n "$packages" -a -z "$skipcopy" ]; then
1149 if [ "$srctype" != "live" ]; then
1150 echo "Copying $SRC to device"
1151 copyFile
"$SRC" "$TGTMNT/"
1153 # Setup a repo= to point to the .iso
1154 sed -i -e "s;initrd.img;initrd.img repo=hd:$TGTLABEL:/;g" $BOOTCONFIG
1155 if [ -n "$efi" ]; then
1156 sed -i -e "s;vmlinuz;vmlinuz repo=hd:$TGTLABEL:/;g" $BOOTCONFIG_EFI
1159 echo "Copying package data from $SRC to device"
1160 rsync
--inplace -rLDP --exclude EFI
/ --exclude images
/ --exclude isolinux
/ \
1161 --exclude TRANS.TBL
--exclude LiveOS
/ "$SRCMNT/" "$TGTMNT/"
1163 echo "Waiting for device to finish writing"
1167 if [ "$srctype" = "live" ]; then
1168 # Copy this installer script.
1169 cp -fT "$thisScriptpath" $TGTMNT/$LIVEOS/livecd-iso-to-disk
1170 chmod +x
$TGTMNT/$LIVEOS/livecd-iso-to-disk
&> /dev
/null ||
:
1172 # When the source is an installed Live USB/SD image, restore the boot config
1173 # file to a base state before updating.
1174 if [[ -d $SRCMNT/syslinux
/ ]]; then
1175 echo "Preparing boot config file."
1176 sed -i -e "s/root=live:[^ ]*/root=live:CDLABEL=name/"\
1177 -e "s/liveimg .* quiet/liveimg quiet/"\
1178 $BOOTCONFIG $BOOTCONFIG_EFI
1179 sed -i -e "s/^timeout.*$/timeout\ 100/"\
1180 -e "/^totaltimeout.*$/d" $BOOTCONFIG
1185 echo "Updating boot config file"
1186 # adjust label and fstype
1187 sed -i -e "s/CDLABEL=[^ ]*/$TGTLABEL/" -e "s/rootfstype=[^ ]*/rootfstype=$TGTFS/" -e "s/LABEL=[^ ]*/$TGTLABEL/" $BOOTCONFIG $BOOTCONFIG_EFI
1188 if [ -n "$kernelargs" ]; then
1189 sed -i -e "s;initrd.img;initrd.img ${kernelargs};" $BOOTCONFIG
1190 if [ -n "$efi" ]; then
1191 sed -i -e "s;vmlinuz;vmlinuz ${kernelargs};" $BOOTCONFIG_EFI
1194 if [ "$LIVEOS" != "LiveOS" ]; then
1195 sed -i -e "s;liveimg;liveimg live_dir=$LIVEOS;" $BOOTCONFIG $BOOTCONFIG_EFI
1198 # EFI images are in $SYSLINUXPATH now
1199 if [ -n "$efi" ]; then
1200 sed -i -e "s;/isolinux/;/$SYSLINUXPATH/;g" $BOOTCONFIG_EFI
1201 sed -i -e "s;/images/pxeboot/;/$SYSLINUXPATH/;g" $BOOTCONFIG_EFI
1202 sed -i -e "s;findiso;;g" $BOOTCONFIG_EFI
1205 # DVD Installer for netinst
1206 if [ "$srctype" != "live" ]; then
1207 if [ "$imgtype" = "install" ]; then
1208 sed -i -e "s;initrd.img;initrd.img stage2=hd:$TGTLABEL:/images/install.img;g" $BOOTCONFIG
1209 if [ -n "$efi" ]; then
1210 sed -i -e "s;vmlinuz;vmlinuz stage2=hd:$TGTLABEL:/images/install.img;g" $BOOTCONFIG_EFI
1213 # The initrd has everything, so no stage2
1214 sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
1218 # Adjust the boot timeouts
1219 if [ -n "$timeout" ]; then
1220 sed -i -e "s/^timeout.*$/timeout\ $timeout/" $BOOTCONFIG
1222 if [ -n "$totaltimeout" ]; then
1223 sed -i -e "/^timeout.*$/a\totaltimeout\ $totaltimeout" $BOOTCONFIG
1226 if [ "$overlaysizemb" -gt 0 ]; then
1227 echo "Initializing persistent overlay file"
1228 OVERFILE
="overlay-$( /sbin/blkid -s LABEL -o value $TGTDEV )-$( /sbin/blkid -s UUID -o value $TGTDEV )"
1229 if [ -z "$skipcopy" ]; then
1230 if [ "$TGTFS" = "vfat" ]; then
1231 # vfat can't handle sparse files
1232 dd if=/dev
/zero of
=$TGTMNT/$LIVEOS/$OVERFILE count
=$overlaysizemb bs
=1M
1234 dd if=/dev
/null of
=$TGTMNT/$LIVEOS/$OVERFILE count
=1 bs
=1M seek
=$overlaysizemb
1237 sed -i -e "s/liveimg/liveimg overlay=${TGTLABEL}/" $BOOTCONFIG $BOOTCONFIG_EFI
1238 sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG $BOOTCONFIG_EFI
1241 if [ "$swapsizemb" -gt 0 -a -z "$skipcopy" ]; then
1242 echo "Initializing swap file"
1243 dd if=/dev
/zero of
=$TGTMNT/$LIVEOS/swap.img count
=$swapsizemb bs
=1M
1244 mkswap
-f $TGTMNT/$LIVEOS/swap.img
1247 if [ "$homesizemb" -gt 0 -a -z "$skipcopy" ]; then
1248 echo "Initializing persistent /home"
1249 homesource
=/dev
/zero
1250 [ -n "$cryptedhome" ] && homesource
=/dev
/urandom
1251 if [ "$TGTFS" = "vfat" ]; then
1252 # vfat can't handle sparse files
1253 dd if=${homesource} of
=$TGTMNT/$LIVEOS/$HOMEFILE count
=$homesizemb bs
=1M
1255 dd if=/dev
/null of
=$TGTMNT/$LIVEOS/$HOMEFILE count
=1 bs
=1M seek
=$homesizemb
1257 if [ -n "$cryptedhome" ]; then
1259 losetup
$loop $TGTMNT/$LIVEOS/$HOMEFILE
1261 echo "Encrypting persistent /home"
1262 while ! cryptsetup luksFormat
-y -q $loop; do :; done;
1264 echo "Please enter the password again to unlock the device"
1265 while ! cryptsetup luksOpen
$loop EncHomeFoo
; do :; done;
1267 mkfs.ext4
-j /dev
/mapper
/EncHomeFoo
1268 tune2fs
-c0 -i0 -ouser_xattr,acl
/dev
/mapper
/EncHomeFoo
1270 cryptsetup luksClose EncHomeFoo
1273 echo "Formatting unencrypted /home"
1274 mkfs.ext4
-F -j $TGTMNT/$LIVEOS/$HOMEFILE
1275 tune2fs
-c0 -i0 -ouser_xattr,acl
$TGTMNT/$LIVEOS/$HOMEFILE
1279 # create the forth files for booting on the XO if requested
1280 # we'd do this unconditionally, but you have to have a kernel that will
1281 # boot on the XO anyway.
1282 if [ -n "$xo" ]; then
1283 echo "Setting up /boot/olpc.fth file"
1284 args
=$
(grep "^ *append" $TGTMNT/$SYSLINUXPATH/isolinux.cfg |
head -n1 |
sed -e 's/.*initrd=[^ ]*//')
1285 if [ -z "$xonohome" -a ! -f $TGTMNT/$LIVEOS/$HOMEFILE ]; then
1286 args
="$args persistenthome=mtd0"
1288 args
="$args reset_overlay"
1289 xosyspath
=$
(echo $SYSLINUXPATH |
sed -e 's;/;\\;')
1290 if [ ! -d $TGTMNT/boot
]; then
1291 mkdir
-p $TGTMNT/boot
1293 cat > $TGTMNT/boot
/olpc.fth
<<EOF
1294 \ Boot script for USB boot
1295 hex rom-pa fffc7 + 4 \$number drop h# 2e19 < [if]
1296 patch 2drop erase claim-params
1297 : high-ramdisk ( -- )
1299 h# 22c +lp l@ 1+ memory-limit umin /ramdisk - ffff.f000 and ( new-ramdisk-adr )
1300 ramdisk-adr over /ramdisk move ( new-ramdisk-adr )
1303 ' high-ramdisk to load-ramdisk
1306 : set-bootpath-dev ( -- )
1307 " /chosen" find-package if ( phandle )
1308 " bootpath" rot get-package-property 0= if ( propval$ )
1309 get-encoded-string ( bootpath$ )
1310 [char] \ left-parse-string 2nip ( dn$ )
1315 " /sd" dn-buf count sindex 0>= if
1320 " BOOTPATHDEV" \$set-macro
1324 " $args" to boot-file
1325 " \${BOOTPATHDEV}$xosyspath\initrd0.img" expand$ to ramdisk
1326 " \${BOOTPATHDEV}$xosyspath\vmlinuz0" expand$ to boot-device
1333 if [ -z "$multi" ]; then
1334 echo "Installing boot loader"
1335 if [ -n "$efi" ]; then
1336 # replace the ia32 hack
1337 if [ -f "$TGTMNT$EFI_BOOT/BOOT.conf" ]; then
1338 cp -f $TGTMNT$EFI_BOOT/BOOTia32.conf
$TGTMNT$EFI_BOOT/BOOT.conf
1342 # this is a bit of a kludge, but syslinux doesn't guarantee the API for its com32 modules :/
1343 if [ -f $TGTMNT/$SYSLINUXPATH/vesamenu.c32
-a -f /usr
/share
/syslinux
/vesamenu.c32
]; then
1344 cp /usr
/share
/syslinux
/vesamenu.c32
$TGTMNT/$SYSLINUXPATH/vesamenu.c32
1345 elif [ -f $TGTMNT/$SYSLINUXPATH/vesamenu.c32
-a -f /usr
/lib
/syslinux
/vesamenu.c32
]; then
1346 cp /usr
/lib
/syslinux
/vesamenu.c32
$TGTMNT/$SYSLINUXPATH/vesamenu.c32
1347 elif [ -f $TGTMNT/$SYSLINUXPATH/menu.c32
-a -f /usr
/share
/syslinux
/menu.c32
]; then
1348 cp /usr
/share
/syslinux
/menu.c32
$TGTMNT/$SYSLINUXPATH/menu.c32
1349 elif [ -f $TGTMNT/$SYSLINUXPATH/menu.c32
-a -f /usr
/lib
/syslinux
/menu.c32
]; then
1350 cp /usr
/lib
/syslinux
/menu.c32
$TGTMNT/$SYSLINUXPATH/menu.c32
1353 if [ "$TGTFS" == "vfat" -o "$TGTFS" == "msdos" ]; then
1354 # syslinux expects the config to be named syslinux.cfg
1355 # and has to run with the file system unmounted
1356 mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/syslinux.cfg
1357 # deal with mtools complaining about ldlinux.sys
1358 if [ -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys
]; then
1359 rm -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys
1362 if [ -n "$SYSLINUXPATH" ]; then
1363 syslinux
-d $SYSLINUXPATH $TGTDEV
1367 elif [ "$TGTFS" == "ext2" -o "$TGTFS" == "ext3" -o "$TGTFS" == "ext4" -o "$TGTFS" == "btrfs" ]; then
1368 # extlinux expects the config to be named extlinux.conf
1369 # and has to be run with the file system mounted
1370 mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/extlinux.conf
1371 extlinux
-i $TGTMNT/$SYSLINUXPATH
1372 # Starting with syslinux 4 ldlinux.sys is used on all file systems.
1373 if [ -f "$TGTMNT/$SYSLINUXPATH/extlinux.sys" ]; then
1374 chattr -i $TGTMNT/$SYSLINUXPATH/extlinux.sys
1375 elif [ -f "$TGTMNT/$SYSLINUXPATH/ldlinux.sys" ]; then
1376 chattr -i $TGTMNT/$SYSLINUXPATH/ldlinux.sys
1381 # we need to do some more config file tweaks for multi-image mode
1382 sed -i -e "s;kernel vm;kernel /$LIVEOS/syslinux/vm;" $TGTMNT/$SYSLINUXPATH/isolinux.cfg
1383 sed -i -e "s;initrd=i;initrd=/$LIVEOS/syslinux/i;" $TGTMNT/$SYSLINUXPATH/isolinux.cfg
1384 mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/syslinux.cfg
1388 echo "Target device is now set up with a Live image!"