liveCD doesn't boot on IBM X Series Hardware
by msacks
I am having a problem where after spinning a F13 or F14 LiveCD and
booting it on IBM X Series hardware.
If I test the same LiveCD on a different kind of hardware, it works
fine without issue.
If I test a standard Fedora LiveCD (non-spin) and boot it on the IBM
hardware, it works fine as well.
I know that the LiveCD I am spinning works, just not on IBM hardware
for some reason.
And I know Fedora works on IBM, because I've tested that as well.
What happens is the progress bar shows at the bottom of the screen
when it's booting, and then it just goes to a black screen.
Is there a known compatibility issue with IBM X series hardware and Fedora?
Is there a way to diagnose what the issue might be?
My next step was to start disabling certain packages in the spin to
see if something is conflicting on boot.
13 years, 3 months
[PATCH 3/3] Update usage documentation & add it to the script livecd-iso-to-disk
by Frederick Grose
Re: Bug 448030 <https://bugzilla.redhat.com/show_bug.cgi?id=448030> - RFE:
create a bootable Live USB stick from the running livecd
Vastly expanded documentation is provided to support this script and its new
features. Options were reordered to support following
the onboard documentation.
From: Frederick Grose <fgrose(a)gmail.com>
Date: Sun, 5 Dec 2010 21:17:13 -0500
Subject: [PATCH 3/3] Update usage documentation & add it to the script
Update the usage manual and include all options.
Provide complete usage documentation onboard the script, as the
script is often distributed independently.
---
docs/livecd-iso-to-disk.pod | 121 +++++++++++++---
tools/livecd-iso-to-disk.sh | 331
+++++++++++++++++++++++++++++++++++++------
2 files changed, 385 insertions(+), 67 deletions(-)
diff --git a/docs/livecd-iso-to-disk.pod b/docs/livecd-iso-to-disk.pod
index 1ccab66..7ef0c14 100644
--- a/docs/livecd-iso-to-disk.pod
+++ b/docs/livecd-iso-to-disk.pod
@@ -2,63 +2,138 @@
=head1 NAME
-livecd-iso-to-disk - installs bootable CD images on a USB storage devices.
+livecd-iso-to-disk - installs bootable Live images onto USB/SD storage
devices.
=head1 SYNOPSIS
-B<livecd-iso-to-disk> [--format] [--reset-mbr] [--noverify] [--efi]
[--overlay-size-mb <size>] [\-\-home\-size\-mb <size>]
[\-\-unencrypted\-home] [\-\-skipcopy] <path-to-iso> <usb storage device>
+B<livecd-iso-to-disk> [--help] [--noverify] [--format] [--reset-mbr]
[--efi] [--skipcopy] [--force] [--xo] [--xo-no-home] [--timeout <time>]
[--totaltimeout <time>] [--extra-kernel-args <args>] [--multi] [--livedir
<dir>] [--compress] [--skipcompress] [--swap-size-mb <size>]
[--overlay-size-mb <size>] [--home-size-mb <size>] [--delete-home]
[--crypted-home] [--unencrypted-home] <source> <target device>
+
+Simplest
+
+The script may be run in simplest form with just the two arguments:
+
+B<livecd-iso-to-disk> <source> <target device>
+
+To execute the script to completion, you will need to run it with root user
permissions. SYSLINUX must be installed on the computer running the
installation script.
+
+=over 4
+
+=item <source>
+
+This may be the filesystem path to a LiveOS .iso image file, such as from a
CD-ROM, DVD, or download. It could also be the device node reference for
the mount point of another LiveOS filesystem, including the
currently-running one (such as a booted Live CD/DVD/USB, where /dev/live
references the running image device).
+
+=item <target device>
+
+This should be the device partition name for the attached, target device,
such as /dev/sdb1 or /dev/sdc1. (Issue the df -Th command to get a listing
of the mounted partitions, where you can confirm the filesystem types,
available space, and device names.) Be careful to specify the correct
device, or you may overwrite important data on another disk!
+
+=back
=head1 DESCRIPTION
-B<livecd-iso-to-disk> installs a live CD or DVD image(ISO image) onto a USB
storage device. The USB storage device can then boot the installed operating
system on systems which support booting via USB. B<livecd-iso-to-disk>
requires an ISO image and a USB storage device. ISO images can be created
with B<livecd-creator>.
+B<livecd-iso-to-disk> installs a Live CD/DVD/USB image (LiveOS) onto a
USB/SD storage device (or any storage partition that will boot with a
SYSLINUX bootloader). The target storage device can then boot the installed
operating system on systems that support booting via the USB or the SD
interface. The script requires a LiveOS source image and a target storage
device. The source image may be either a LiveOS .iso file, the
currently-running LiveOS image, the device node reference for an attached
device with an installed LiveOS image, or a file backed by a block device
with an installed LiveOS image. If the operating system supports persistent
overlays for saving system changes, a pre-sized overlay may be included with
the installation.
+
+Unless you request the --format option, the installation does not destroy
data outside of the LiveOS, syslinux, & EFI folders on your target device.
This allows one to maintain other files on the target disk outside of the
LiveOS filesystem.
-B<livecd-iso-to-disk> is not a destructive process; any data you currently
have on your USB stick is preserved.
+LiveOS images provide embedded filesystems through the Device-mapper
component of the Linux kernel. The embedded filesystems exist within files
such as /LiveOS/squashfs.img (the default compressed storage) or
/LiveOS/ext3fs.img (an uncompressed version) on the primary volume partition
of the storage device. In use, these are read-only filesystems. Optionally,
one may specify a persistent LiveOS overlay to hold image-change snapshots
(that use write-once, difference-tracking storage) in the
/LiveOS/overlay-<device_id> file, which, *one should note*, always grows in
size due to the storage mechanism. (The fraction of allocated space that
has been consumed by system activity and changes may be displayed by issuing
the 'dmsetup status' command in a terminal session of a running LiveOS
image.) One way to conserve the unrecoverable, overlay file space, is to
specify a persistent home folder for user files, which will be saved in a
/LiveOS/home.img filesystem image file. This file space is encrypted by
default, but is not compressed. (One may bypass encryption with the
--unencrypted-home installation option.) Files in this home folder may be
erased to recover and reuse their storage space. The home.img file is also
convenient for backing up or swapping user account files.
=head1 OPTIONS
=over 4
+=item --help
+
+Displays usage information and exits.
+
+=item --noverify
+
+Disables the image validation process that occurs before the image is
installed from the original Live CD .iso image. When this option is
specified, the image is not verified before loading onto the target storage
device.
+
=item --format
-Formats the USB stick and creates an MS-DOS partition table (or GPT
partition table if --efi is passed).
+Formats the target device and creates an MS-DOS partition table (or GUID
partition table, if the --efi option is passed).
=item --reset-mbr
-Sets the Master Boot Record(MBR) of the USB storage device to the mbr.bin
file from the image's syslinux directory.
+Sets the Master Boot Record (MBR) of the target storage device to the
mbr.bin file from the installation system's syslinux directory. This may be
helpful in recovering a damaged or corrupted device.
-=item --noverify
+=item --efi
-Disables the image validation process which occurs before the image is
installed. When this option is enabled the image is not verified before
installation on the USB storage device.
+Creates a GUID partition table when --format is passed, and installs a
hybrid Extensible Firmware Interface (EFI)/MBR bootloader on the disk. This
is necessary for most Intel Macs.
-=item --overlay-size-mb
+=item --skipcopy
-This option sets the overlay size in megabytes. The overlay is additional
storage available to the live operating system if the operating system
supports it. The USB storage device must have enough free space for the
image and the overlay.
+Skips the copying of the live image to the target device, bypassing the
actions of the --format, --overlay-size-mb, --home-size-mb, & --swap-size-mb
options, if present on the command line. (The --skipcopy option may be used
while testing the script, in order to avoid repeated and lengthy copy
commands, or to repair boot configuration files on a previously installed
device.)
-=item --home-size-mb
+=item --force
-Sets the home directory size in megabytes.
+This option allows the installation script to bypass a delete confirmation
dialog in the event that a pre-existing LiveOS directory is found on the
target device.
-=item --unencrypted-home
+=item --xo
-Disables the encryption of the home directory.
+Used to prepare an image for the OLPC XO-1 laptop with its compressed,
JFFS2 filesystem. Do not use the following options with --xo:
-=item --skipcopy
+=over 4
-Skips the copy of the live image to the USB stick and disables the --forma,
--home-size-mb, and --swap-size-mb options. The --overlay-size-mb option is
changed to only reinitialize the existing overlay area, to recreate it from
scratch.
+--overlay-size-mb <size>, home-size-mb <size>, --delete-home, --compress
-The intended use of this option is to speed up testing of the boot
configuration of live images.
+=back
-=item --efi
+=item --xo-no-home
-Create a GPT partition table when --format is passed, and install an hybrid
EFI/MBR bootloader on the disk. This is necessary for most Intel Macs.
+Used together with the --xo option to prepare an image for an OLPC XO
laptop with the home folder on an SD card instead of the internal flash
storage.
=item --timeout
-Modify the bootloader's timeout value. This overrides the value set during
iso creation. Units are 1/10s
+Modifies the bootloader's timeout value, which indicates how long to pause
at the boot: prompt before booting automatically. This overrides the value
set during iso creation. Units are 1/10 s. The timeout is canceled when
any key is pressed, the assumption being that the user will complete the
command line. A timeout of zero will disable the timeout completely.
=item --totaltimeout
-Add a totaltimeout to the bootloader config. This is used to force and
automatic boot. This cannot be canceled by the user. Units are 1/10s
+Adds a bootloader totaltimeout, which indicates how long to wait before
booting automatically. This is used to force an automatic boot. This
timeout cannot be canceled by the user. Units are 1/10 s.
+
+=item --extra-kernel-args <args>
+
+Specifies additional kernel arguments, <args>, that will be inserted into
the syslinux and EFI boot configurations. Multiple arguments should be
specified in one string, i.e., --extra-kernel-args "arg1 arg2 ..."
+
+=item --multi
+
+Used when installing multiple image copies to signal configuration of the
boot files for the image in the --livedir <dir> parameter.
+
+=item --livedir <dir>
+
+Used with multiple image installations to designate the directory <dir> for
the particular image.
+
+=item --compress (default state for the operating system files)
+
+The default, compressed SquashFS filesystem image is copied on
installation. This option has no effect when the source filesystem
+is already expanded.
+
+=item --skipcompress (default option when --xo is specified)
+
+Expands the source SquashFS image on installation into the read-only
/LiveOS/ext3fs.img filesystem image file.
+
+=item --swap-size-mb <size>
+
+Sets up a swap file of <size> mebibytes (integer values only) on the target
device.
+
+=item --overlay-size-mb <size>
+
+This option sets the overlay size in mebibytes (integer values only). The
overlay makes persistent storage available to the live operating system, if
the operating system supports it. The persistent LiveOS overlay holds
image-change snapshots (using write-once, difference-tracking storage) in
the /LiveOS/overlay-<device_id> file, which, *one should note*, always grows
in size due to the storage mechanism. (The fraction of allocated space that
has been consumed may be displayed by issuing the 'dmsetup status' command
in a terminal session of a running LiveOS installation.) One way to
conserve the unrecoverable, overlay file space, is to specify a persistent
home folder for user files, see --home-size-mb below. The target storage
device must have enough free space for the image and the overlay. A maximum
<size> of 2047 MiB is permitted for vfat-formatted devices. If there is
insufficient room on your device, you will be given information to help in
adjusting your settings.
+
+=item --home-size-mb <size>
+
+Sets the home directory size in mebibytes (integer values only). A
persistent home directory will be made in the /LiveOS/home.img filesystem
image file. This file space is encrypted by default, but not compressed
(one may bypass encryption with the --unencrypted-home installation option).
Files in this home folder may be erased to recover and reuse their storage
space. The target storage device must have enough free space for the image,
any overlay, and the home directory. Note that the --delete-home option
must also be selected to replace an existing persistent home with a new,
empty one. A maximum <size> of 2047 MiB is permitted for vfat-formatted
devices. If there is insufficient room on your device, you will be given
information to help in adjusting your settings.
+
+=item --delete-home
+
+To prevent unwitting deletion of user files, this option must be explicitly
selected when the option --home-size-mb <size> is selected and there is an
existing persistent home directory on the target device.
+
+=item --crypted-home (default that only applies to new home-size-mb
requests)
+
+Specifies the default option to encrypt a new persistent home directory if
--home-size-mb <size> is specified.
+
+=item --unencrypted-home
+
+Prevents the default option to encrypt a new persistent home directory.
=back
@@ -68,11 +143,11 @@ David Zeuthen, Jeremy Katz, Douglas McClendon, Chris
Curran and other contributo
=head1 BUGS
-Report bugs to the mailing list C<
http://www.redhat.com/mailman/listinfo/fedora-livecd-list> or directly to
Bugzilla C<http://bugzilla.redhat.com/bugzilla/> against the C<Fedora>
product, and the C<lived-tools> component.
+Report bugs to the mailing list C<
http://admin.fedoraproject.org/mailman/listinfo/livecd> or directly to
Bugzilla C<http://bugzilla.redhat.com/bugzilla/> against the C<Fedora>
product, and the C<livecd-tools> component.
=head1 COPYRIGHT
-Copyright (C) Fedora Project 2008,2009, and various contributors. This is
free software. You may redistribute copies of it under the terms of the GNU
General Public License C<http://www.gnu.org/licenses/gpl.html>. There is NO
WARRANTY, to the extent permitted by law.
+Copyright (C) Fedora Project 2008, 2009, 2010 and various contributors.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
=head1 SEE ALSO
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3ca4ea7..45a6945 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -22,8 +22,248 @@
export PATH=/sbin:/usr/sbin:$PATH
+shortusage() {
+ echo "
+ SYNTAX
+
+ livecd-iso-to-disk [--help] [--noverify] [--format] [--reset-mbr]
[--efi]
+ [--skipcopy] [--force] [--xo] [--xo-no-home]
+ [--timeout <time>] [--totaltimeout <time>]
+ [--extra-kernel-args <args>] [--multi] [--livedir
<dir>]
+ [--compress] [--skipcompress] [--swap-size-mb
<size>]
+ [--overlay-size-mb <size>] [--home-size-mb <size>]
+ [--delete-home] [--crypted-home]
[--unencrypted-home]
+ <source> <target device>
+
+ (Enter livecd-iso-to-disk --help on the command line for more
information.)"
+}
+
usage() {
- echo "$0 [--timeout <time>] [--totaltimeout <time>] [--format]
[--reset-mbr] [--noverify] [--overlay-size-mb <size>] [--home-size-mb
<size>] [--unencrypted-home] [--skipcopy] [--efi] <source> <target device>"
+ echo "
+ "
+ shortusage
+ echo "
+ livecd-iso-to-disk - Transfer a LiveOS image so that it's bootable
off of
+ a USB/SD device.
+
+ The script may be run in simplest form with just the two arguments:
+
+ <source>
+ This may be the filesystem path to a LiveOS .iso image
file,
+ such as from a CD-ROM, DVD, or download. It could also be
the
+ device node reference for the mount point of another
LiveOS
+ filesystem, including the currently-running one (such as a
+ booted Live CD/DVD/USB, where /dev/live references the
running
+ image device).
+
+ <target device>
+ This should be the device partition name for the attached,
+ target device, such as /dev/sdb1 or /dev/sdc1. (Issue the
+ df -Th command to get a listing of the mounted partitions,
+ where you can confirm the filesystem types, available
space,
+ and device names.) Be careful to specify the correct
device,
+ or you may overwrite important data on another disk!
+
+ To execute the script to completion, you will need to run it with root
user
+ permissions.
+ SYSLINUX must be installed on the computer running the installation
script.
+
+ DESCRIPTION
+
+ livecd-iso-to-disk installs a Live CD/DVD/USB image (LiveOS) onto a
USB/SD
+ storage device (or any storage partition that will boot with a SYSLINUX
+ bootloader). The target storage device can then boot the installed
+ operating system on systems that support booting via the USB or the SD
+ interface. The script requires a LiveOS source image and a target
storage
+ device. The source image may be either a LiveOS .iso file, the
currently-
+ running LiveOS image, the device node reference for an attached device
with
+ an installed LiveOS image, or a file backed by a block device with an
+ installed LiveOS image. If the operating system supports persistent
+ overlays for saving system changes, a pre-sized overlay may be included
with
+ the installation.
+
+ Unless you request the --format option, the installation does not
destroy
+ data outside of the LiveOS, syslinux, & EFI folders on your target
device.
+ This allows one to maintain other files on the target disk outside of
the
+ LiveOS filesystem.
+
+ LiveOS images provide embedded filesystems through the Device-mapper
+ component of the Linux kernel. The embedded filesystems exist within
files
+ such as /LiveOS/squashfs.img (the default compressed storage) or
+ /LiveOS/ext3fs.img (an uncompressed version) on the primary volume
partition
+ of the storage device. In use, these are read-only filesystems.
Optionally,
+ one may specify a persistent LiveOS overlay to hold image-change
snapshots
+ (that use write-once, difference-tracking storage) in the
+ /LiveOS/overlay-<device_id> file, which, *one should note*, always
grows in
+ size due to the storage mechanism. (The fraction of allocated space
that
+ has been consumed by system activity and changes may be displayed by
issuing
+ the 'dmsetup status' command in a terminal session of a running LiveOS
+ image.) One way to conserve the unrecoverable, overlay file space, is
to
+ specify a persistent home folder for user files, which will be saved in
a
+ /LiveOS/home.img filesystem image file. This file space is encrypted
by
+ default, but is not compressed. (One may bypass encryption with the
+ --unencrypted-home installation option.) Files in this home folder may
be
+ erased to recover and reuse their storage space. The home.img file is
also
+ convenient for backing up or swapping user account files.
+
+ OPTIONS
+
+ --help
+ Displays usage information and exits.
+
+ --noverify
+ Disables the image validation process that occurs before the image
is
+ installed from the original Live CD .iso image. When this option
is
+ specified, the image is not verified before loading onto the target
+ storage device.
+
+ --format
+ Formats the target device and creates an MS-DOS partition table (or
GPT
+ partition table, if the --efi option is passed).
+
+ --reset-mbr
+ Sets the Master Boot Record (MBR) of the target storage device to
the
+ mbr.bin file from the installation system's syslinux directory.
This
+ may be helpful in recovering a damaged or corrupted device.
+
+ --efi
+ Creates a GUID partition table when --format is passed, and
installs a
+ hybrid Extensible Firmware Interface (EFI)/MBR bootloader on the
disk.
+ This is necessary for most Intel Macs.
+
+ --skipcopy
+ Skips the copying of the live image to the target device, bypassing
the
+ actions of the --format, --overlay-size-mb, --home-size-mb, &
+ --swap-size-mb options, if present on the command line. (The
--skipcopy
+ option may be used while testing the script, in order to avoid
repeated
+ and lengthy copy commands, or to repair boot configuration files on
a
+ previously installed device.)
+
+ --force
+ This option allows the installation script to bypass a delete
+ confirmation dialog in the event that a pre-existing LiveOS
directory
+ is found on the target device.
+
+ --xo
+ Used to prepare an image for the OLPC XO-1 laptop with its
compressed,
+ JFFS2 filesystem. Do not use the following options with --xo:
+ --overlay-size-mb <size>, home-size-mb <size>, --delete-home,
+ --compress
+
+ --xo-no-home
+ Used together with the --xo option to prepare an image for an OLPC
XO
+ laptop with the home folder on an SD card instead of the internal
flash
+ storage.
+
+ --timeout
+ Modifies the bootloader's timeout value, which indicates how long
to
+ pause at the boot: prompt before booting automatically. This
overrides
+ the value set during iso creation. Units are 1/10 s. The timeout
is
+ canceled when any key is pressed, the assumption being that the
user
+ will complete the command line. A timeout of zero will disable the
+ timeout completely.
+
+ --totaltimeout
+ Adds a bootloader totaltimeout, which indicates how long to wait
before
+ booting automatically. This is used to force an automatic boot.
This
+ timeout cannot be canceled by the user. Units are 1/10 s.
+
+ --extra-kernel-args <args>
+ Specifies additional kernel arguments, <args>, that will be
inserted
+ into the syslinux and EFI boot configurations. Multiple arguments
+ should be specified in one string, i.e.,
+ --extra-kernel-args \"arg1 arg2 ...\"
+
+ --multi
+ Used when installing multiple image copies to signal configuration
of
+ the boot files for the image in the --livedir <dir> parameter.
+
+
+ --livedir <dir>
+ Used with multiple image installations to designate the directory
<dir>
+ for the particular image.
+
+ --compress (default state for the operating system files)
+ The default, compressed SquashFS filesystem image is copied on
+ installation. This option has no effect when the source filesystem
is
+ already expanded.
+
+ --skipcompress (default option when --xo is specified)
+ Expands the source SquashFS image on installation into the
read-only
+ /LiveOS/ext3fs.img filesystem image file.
+
+ --swap-size-mb <size>
+ Sets up a swap file of <size> mebibytes (integer values only) on
the
+ target device.
+
+ --overlay-size-mb <size>
+ This option sets the overlay size in mebibytes (integer values
only).
+ The overlay makes persistent storage available to the live
operating
+ system, if the operating system supports it. The persistent LiveOS
+ overlay holds image-change snapshots (using write-once, difference-
+ tracking storage) in the /LiveOS/overlay-<device_id> file, which,
*one
+ should note*, always grows in size due to the storage mechanism.
(The
+ fraction of allocated space that has been consumed may be displayed
by
+ issuing the 'dmsetup status' command in a terminal session of a
running
+ LiveOS installation.) One way to conserve the unrecoverable,
overlay
+ file space, is to specify a persistent home folder for user files,
see
+ --home-size-mb below. The target storage device must have enough
free
+ space for the image and the overlay. A maximum <size> of 2047 MiB
is
+ permitted for vfat-formatted devices. If there is insufficient
room on
+ your device, you will be given information to help in adjusting
your
+ settings.
+
+ --home-size-mb <size>
+ Sets the home directory size in mebibytes (integer values only). A
+ persistent home directory will be made in the /LiveOS/home.img
+ filesystem image file. This file space is encrypted by default,
but not
+ compressed (one may bypass encryption with the --unencrypted-home
+ installation option). Files in this home folder may be erased to
+ recover and reuse their storage space. The target storage device
must
+ have enough free space for the image, any overlay, and the home
+ directory. Note that the --delete-home option must also be
selected to
+ replace an existing persistent home with a new, empty one. A
maximum
+ <size> of 2047 MiB is permitted for vfat-formatted devices. If
there is
+ insufficient room on your device, you will be given information to
help
+ in adjusting your settings.
+
+ --delete-home
+ To prevent unwitting deletion of user files, this option must be
+ explicitly selected when the option --home-size-mb <size> is
selected
+ and there is an existing persistent home directory on the target
device.
+
+ --crypted-home (default that only applies to new home-size-mb
requests)
+ Specifies the default option to encrypt a new persistent home
directory
+ if --home-size-mb <size> is specified.
+
+ --unencrypted-home
+ Prevents the default option to encrypt a new persistent home
directory.
+
+ CONTRIBUTORS
+
+ livecd-iso-to-disk: David Zeuthen, Jeremy Katz, Douglas McClendon,
+ Chris Curran and other contributors.
+ (See the AUTHORS file in the source distribution
for
+ the complete list of credits.)
+
+ BUGS
+
+ Report bugs to the mailing list
+ http://admin.fedoraproject.org/mailman/listinfo/livecd or directly to
+ Bugzilla http://bugzilla.redhat.com/bugzilla/ against the Fedora
product,
+ and the livecd-tools component.
+
+ COPYRIGHT
+
+ Copyright (C) Fedora Project 2008, 2009, 2010 and various contributors.
+ This is free software. You may redistribute copies of it under the
terms of
+ the GNU General Public License http://www.gnu.org/licenses/gpl.html.
+ There is NO WARRANTY, to the extent permitted by law.
+
+ SEE ALSO
+
+ livecd-creator, project website
http://fedoraproject.org/wiki/FedoraLiveCD
+ "
exit 1
}
@@ -327,7 +567,7 @@ checkMounted() {
checkint() {
if ! test $1 -gt 0 2>/dev/null ; then
- usage
+ shortusage
fi
}
@@ -395,45 +635,27 @@ LIVEOS=LiveOS
HOMEFILE="home.img"
while [ $# -gt 2 ]; do
case $1 in
- --overlay-size-mb)
- checkint $2
- overlaysizemb=$2
- shift
- ;;
- --home-size-mb)
- checkint $2
- homesizemb=$2
- shift
- ;;
- --swap-size-mb)
- checkint $2
- swapsizemb=$2
- shift
- ;;
- --crypted-home)
- cryptedhome=1
- ;;
- --unencrypted-home)
- cryptedhome=""
- ;;
- --delete-home)
- keephome=""
+ --help)
+ usage
;;
--noverify)
noverify=1
;;
+ --format)
+ format=1
+ ;;
--reset-mbr|--resetmbr)
resetmbr=1
;;
--efi|--mactel)
efi=1
;;
- --format)
- format=1
- ;;
--skipcopy)
skipcopy=1
;;
+ --force)
+ force=1
+ ;;
--xo)
xo=1
skipcompress=1
@@ -441,39 +663,60 @@ while [ $# -gt 2 ]; do
--xo-no-home)
xonohome=1
;;
- --compress)
- skipcompress=""
+ --timeout)
+ checkint $2
+ timeout=$2
+ shift
;;
- --skipcompress)
- skipcompress=1
+ --totaltimeout)
+ checkint $2
+ totaltimeout=$2
+ shift
;;
--extra-kernel-args)
kernelargs=$2
shift
;;
- --force)
- force=1
+ --multi)
+ multi=1
;;
--livedir)
LIVEOS=$2
shift
;;
- --multi)
- multi=1
+ --compress)
+ skipcompress=""
;;
- --timeout)
+ --skipcompress)
+ skipcompress=1
+ ;;
+ --swap-size-mb)
checkint $2
- timeout=$2
+ swapsizemb=$2
shift
;;
- --totaltimeout)
+ --overlay-size-mb)
checkint $2
- totaltimeout=$2
+ overlaysizemb=$2
+ shift
+ ;;
+ --home-size-mb)
+ checkint $2
+ homesizemb=$2
shift
;;
+ --crypted-home)
+ cryptedhome=1
+ ;;
+ --unencrypted-home)
+ cryptedhome=""
+ ;;
+ --delete-home)
+ keephome=""
+ ;;
*)
echo "invalid arg -- $1"
- usage
+ shortusage
;;
esac
shift
@@ -483,16 +726,16 @@ SRC=$(readlink -f "$1")
TGTDEV=$(readlink -f "$2")
if [ -z "$SRC" ]; then
- usage
+ shortusage
fi
if [ ! -b "$SRC" -a ! -f "$SRC" ]; then
- usage
+ shortusage
fi
# FIXME: If --format is given, we shouldn't care and just use /dev/foo1
if [ -z "$TGTDEV" -o ! -b "$TGTDEV" ]; then
- usage
+ shortusage
fi
if [ -z "$noverify" ]; then
--
1.7.3.2
13 years, 3 months
[PATCH 2/3] Support the propagation of an installed Live image
by Frederick Grose
Re: Bug 448030 <https://bugzilla.redhat.com/show_bug.cgi?id=448030> - RFE:
create a bootable Live USB stick from the running livecd
From: Frederick Grose <fgrose(a)gmail.com>
Date: Sun, 5 Dec 2010 17:57:06 -0500
Subject: [PATCH 2/3] Support the propagation of an installed Live image
Adjust the size-checking and boot configuration code to support
propagation of an installed Live image from the running or an
attached source. Copy the livecd-iso-to-disk script to the new
installations to support continued or self propagation.
---
tools/livecd-iso-to-disk.sh | 115
++++++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 45 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 9593c64..3ca4ea7 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -337,7 +337,7 @@ if [ $(id -u) != 0 ]; then
fi
detectsrctype() {
- if [ -e $SRCMNT/LiveOS/squashfs.img ]; then
+ if [[ -e $SRCMNT/$LIVEOS/osmin.img ]]; then
srctype=live
return
fi
@@ -575,54 +575,52 @@ if [ -n "$efi" -a ! -d $SRCMNT/EFI/boot ]; then
exitclean
fi
-# let's try to make sure there's enough room on the stick
-if [ -d $SRCMNT/LiveOS ]; then
- check=$SRCMNT/LiveOS
-else
- check=$SRCMNT
-fi
+# Let's try to make sure there's enough room on the target device.
if [[ -d $TGTMNT/$LIVEOS ]]; then
tbd=($(du -B 1M $TGTMNT/$LIVEOS))
- [[ -s $TGTMNT/$LIVEOS/$HOMEFILE ]] && \
+ if [[ -s $TGTMNT/$LIVEOS/$HOMEFILE ]] && [[ -n $keephome ]]; then
homesize=($(du -B 1M $TGTMNT/$LIVEOS/$HOMEFILE))
- ((homesize > 0)) && [[ -n $keephome ]] && ((tbd -= homesize))
+ ((tbd -= homesize))
+ fi
else
tbd=0
fi
-targets="$TGTMNT/$SYSLINUXPATH"
-if [[ -n $efi ]]; then
- targets+=" $TGTMNT/EFI/boot"
+
+if [[ live == $srctype ]]; then
+ targets="$TGTMNT/$SYSLINUXPATH"
+ [[ -n $efi ]] && targets+=" $TGTMNT/EFI/boot"
+ [[ -n $xo ]] && targets+=" $TGTMNT/boot/olpc.fth"
+ duTable=($(du -c -B 1M $targets 2> /dev/null))
+ ((tbd += ${duTable[*]: -2:1}))
fi
-duTable=($(du -c -B 1M $targets 2> /dev/null))
-((tbd += ${duTable[*]: -2:1}))
-sources="$SRCMNT/isolinux"
-[[ -n $efi ]] && sources+=" $SRCMNT/EFI/boot"
-if [[ -n $skipcompress ]]; then
- if [[ -s $SRCMNT/LiveOS/squashfs.img ]]; then
- if mount -o loop $SRCMNT/LiveOS/squashfs.img $SRCMNT; then
- livesize=($(du -B 1M --apparent-size
$SRCMNT/LiveOS/ext3fs.img))
- umount $SRCMNT
- else
- echo "WARNING: --skipcompress or --xo was specified but the
- currently-running kernel can not mount the SquashFS from the
source
- file to extract it. Instead, the compressed SquashFS will be
copied
- to the target device."
- skipcompress=""
- fi
+if [[ -n $skipcompress ]] && [[ -s $SRCMNT/$LIVEOS/squashfs.img ]]; then
+ if mount -o loop $SRCMNT/$LIVEOS/squashfs.img $SRCMNT; then
+ livesize=($(du -B 1M --apparent-size $SRCMNT/LiveOS/ext3fs.img))
+ umount $SRCMNT
+ else
+ echo "WARNING: --skipcompress or --xo was specified but the
+ currently-running kernel can not mount the SquashFS from the source
+ file to extract it. Instead, the compressed SquashFS will be copied
+ to the target device."
+ skipcompress=""
fi
- duTable=($(du -c -B 1M $sources 2> /dev/null))
+fi
+
+if [[ live == $srctype ]]; then
+ thisScriptpath=$(readlink -f "$0")
+ sources="$SRCMNT/$LIVEOS/ext3fs.img $SRCMNT/$LIVEOS/osmin.img"
+ [[ -z $skipcompress ]] && sources+=" $SRCMNT/$LIVEOS/squashfs.img"
+ sources+=" $SRCMNT/isolinux $SRCMNT/syslinux"
+ [[ -n $efi ]] && sources+=" $SRCMNT/EFI/boot"
+ duTable=($(du -c -B 1M "$thisScriptpath" $sources 2> /dev/null))
((livesize += ${duTable[*]: -2:1}))
-else
- sources+=" $check/osmin.img $check/squashfs.img"
- duTable=($(du -c -B 1M $sources 2> /dev/null))
- livesize=${duTable[*]: -2:1}
fi
freespace=($(df -B 1M --total $TGTDEV))
freespace=${freespace[*]: -2:1}
-if [ "$srctype" = "live" ]; then
+if [[ live == $srctype ]]; then
tba=$((overlaysizemb + homesizemb + livesize + swapsizemb))
if ((tba > freespace + tbd)); then
needed=$((tba - freespace - tbd))
@@ -641,7 +639,7 @@ if [ "$srctype" = "live" ]; then
printf " Space needed: %15s MiB\n\n" $needed
printf " To fit the installation on this device,
\r free space on the target, or decrease the
- \r requested size total by: %s MiB\n\n" $needed
+ \r requested size total by: %6s MiB\n\n" $needed
exitclean
fi
fi
@@ -694,17 +692,17 @@ if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
echo "Copying live image to the target device."
[ ! -d $TGTMNT/$LIVEOS ] && mkdir $TGTMNT/$LIVEOS
[ -n "$keephome" -a -f "$TGTMNT/$HOMEFILE" ] && mv $TGTMNT/$HOMEFILE
$TGTMNT/$LIVEOS/$HOMEFILE
- if [ -n "$skipcompress" -a -f $SRCMNT/LiveOS/squashfs.img ]; then
- mount -o loop $SRCMNT/LiveOS/squashfs.img $SRCMNT || exitclean
+ if [ -n "$skipcompress" -a -f $SRCMNT/$LIVEOS/squashfs.img ]; then
+ mount -o loop $SRCMNT/$LIVEOS/squashfs.img $SRCMNT || exitclean
copyFile $SRCMNT/LiveOS/ext3fs.img $TGTMNT/$LIVEOS/ext3fs.img ||
(umount $SRCMNT ; exitclean)
umount $SRCMNT
- elif [ -f $SRCMNT/LiveOS/squashfs.img ]; then
- copyFile $SRCMNT/LiveOS/squashfs.img $TGTMNT/$LIVEOS/squashfs.img
|| exitclean
- elif [ -f $SRCMNT/LiveOS/ext3fs.img ]; then
- copyFile $SRCMNT/LiveOS/ext3fs.img $TGTMNT/$LIVEOS/ext3fs.img ||
exitclean
+ elif [ -f $SRCMNT/$LIVEOS/squashfs.img ]; then
+ copyFile $SRCMNT/$LIVEOS/squashfs.img $TGTMNT/$LIVEOS/squashfs.img
|| exitclean
+ elif [ -f $SRCMNT/$LIVEOS/ext3fs.img ]; then
+ copyFile $SRCMNT/$LIVEOS/ext3fs.img $TGTMNT/$LIVEOS/ext3fs.img ||
exitclean
fi
- if [ -f $SRCMNT/LiveOS/osmin.img ]; then
- copyFile $SRCMNT/LiveOS/osmin.img $TGTMNT/$LIVEOS/osmin.img ||
exitclean
+ if [ -f $SRCMNT/$LIVEOS/osmin.img ]; then
+ copyFile $SRCMNT/$LIVEOS/osmin.img $TGTMNT/$LIVEOS/osmin.img ||
exitclean
fi
sync
fi
@@ -720,7 +718,19 @@ if [ \( "$srctype" = "installer" -o "$srctype" =
"netinst" \) -a -z "$skipcopy"
sync
fi
-cp $SRCMNT/isolinux/* $TGTMNT/$SYSLINUXPATH
+# Adjust syslinux sources for replication of installed images
+# between filesystem types.
+if [[ -d $SRCMNT/isolinux/ ]]; then
+ cp $SRCMNT/isolinux/* $TGTMNT/$SYSLINUXPATH
+elif [[ -d $SRCMNT/syslinux/ ]]; then
+ cp $SRCMNT/syslinux/* $TGTMNT/$SYSLINUXPATH
+ if [[ -f $SRCMNT/syslinux/extlinux.conf ]]; then
+ mv $TGTMNT/$SYSLINUXPATH/extlinux.conf \
+ $TGTMNT/$SYSLINUXPATH/isolinux.cfg
+ elif [[ -f $SRCMNT/syslinux/syslinux.cfg ]]; then
+ mv $TGTMNT/$SYSLINUXPATH/syslinux.cfg
$TGTMNT/$SYSLINUXPATH/isolinux.cfg
+ fi
+fi
BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
# Set this to nothing so sed doesn't care
BOOTCONFIG_EFI=
@@ -732,6 +742,21 @@ if [ -n "$efi" ]; then
rm -f $TGTMNT/EFI/boot/grub.conf
fi
+if [[ live == $srctype ]]; then
+ # Copy this installer script.
+ cp -fTp "$thisScriptpath" $TGTMNT/$LIVEOS/livecd-iso-to-disk &>
/dev/null
+
+ # When the source is an installed Live USB/SD image, restore the boot
config
+ # file to a base state before updating.
+ if [[ -d $SRCMNT/syslinux/ ]]; then
+ echo "Preparing boot config file."
+ sed -i -e "s/root=live:[^ ]*/root=live:CDLABEL=name/"\
+ -e "s/liveimg .* quiet/liveimg quiet/"\
+ $BOOTCONFIG $BOOTCONFIG_EFI
+ sed -i -e "s/^timeout.*$/timeout\ 100/"\
+ -e "/^totaltimeout.*$/d" $BOOTCONFIG
+ fi
+fi
echo "Updating boot config file"
# adjust label and fstype
if [ -n "$LANG" ]; then
--
1.7.3.2
13 years, 3 months
[PATCH 1/3] Rename image source- and target-related variables
by Frederick Grose
Re: Bug 448030 <https://bugzilla.redhat.com/show_bug.cgi?id=448030> - RFE:
create a bootable Live USB stick from the running livecd
Another massive code revision, to support an oft-requested feature.
See the following patches for the logic and documentation changes.
From: Frederick Grose <fgrose(a)gmail.com>
Date: Sun, 5 Dec 2010 16:49:11 -0500
Subject: [PATCH 1/3] Rename image source- and target-related variables
Source- and target-related variables are renamed to reflect these
roles rather than a media, file, or bus type. This supports the
extended capability of the script to install from Live USB/SD
sources, and removes code name ambiguity for these variables.
---
tools/livecd-iso-to-disk.sh | 368
++++++++++++++++++++++---------------------
1 files changed, 185 insertions(+), 183 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 51abc0c..9593c64 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Convert a live CD iso so that it's bootable off of a USB stick
+# Transfer a Live image so that it's bootable off of a USB/SD device.
# Copyright 2007 Red Hat, Inc.
# Jeremy Katz <katzj(a)redhat.com>
#
@@ -23,14 +23,14 @@
export PATH=/sbin:/usr/sbin:$PATH
usage() {
- echo "$0 [--timeout <time>] [--totaltimeout <time>] [--format]
[--reset-mbr] [--noverify] [--overlay-size-mb <size>] [--home-size-mb
<size>] [--unencrypted-home] [--skipcopy] [--efi] <isopath> <usbstick
device>"
+ echo "$0 [--timeout <time>] [--totaltimeout <time>] [--format]
[--reset-mbr] [--noverify] [--overlay-size-mb <size>] [--home-size-mb
<size>] [--unencrypted-home] [--skipcopy] [--efi] <source> <target device>"
exit 1
}
cleanup() {
sleep 2
- [ -d "$CDMNT" ] && umount $CDMNT && rmdir $CDMNT
- [ -d "$USBMNT" ] && umount $USBMNT && rmdir $USBMNT
+ [ -d "$SRCMNT" ] && umount $SRCMNT && rmdir $SRCMNT
+ [ -d "$TGTMNT" ] && umount $TGTMNT && rmdir $TGTMNT
}
exitclean() {
@@ -178,10 +178,10 @@ createGPTLayout() {
/sbin/udevadm settle
sleep 5
getpartition ${device#/dev/}
- USBDEV=${device}${partnum}
- umount $USBDEV &> /dev/null
- /sbin/mkdosfs -n LIVE $USBDEV
- USBLABEL="UUID=$(/sbin/blkid -s UUID -o value $USBDEV)"
+ TGTDEV=${device}${partnum}
+ umount $TGTDEV &> /dev/null
+ /sbin/mkdosfs -n LIVE $TGTDEV
+ TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
}
createMSDOSLayout() {
@@ -202,13 +202,13 @@ createMSDOSLayout() {
sleep 5
if ! isdevloop "$DEV"; then
getpartition ${device#/dev/}
- USBDEV=${device}${partnum}
+ TGTDEV=${device}${partnum}
else
- USBDEV=${device}
+ TGTDEV=${device}
fi
- umount $USBDEV &> /dev/null
- /sbin/mkdosfs -n LIVE $USBDEV
- USBLABEL="UUID=$(/sbin/blkid -s UUID -o value $USBDEV)"
+ umount $TGTDEV &> /dev/null
+ /sbin/mkdosfs -n LIVE $TGTDEV
+ TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
}
createEXTFSLayout() {
@@ -228,10 +228,10 @@ createEXTFSLayout() {
/sbin/udevadm settle
sleep 5
getpartition ${device#/dev/}
- USBDEV=${device}${partnum}
- umount $USBDEV &> /dev/null
- /sbin/mkfs.ext4 -L LIVE $USBDEV
- USBLABEL="UUID=$(/sbin/blkid -s UUID -o value $USBDEV)"
+ TGTDEV=${device}${partnum}
+ umount $TGTDEV &> /dev/null
+ /sbin/mkfs.ext4 -L LIVE $TGTDEV
+ TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
}
checkGPT() {
@@ -265,36 +265,36 @@ checkGPT() {
checkFilesystem() {
dev=$1
- USBFS=$(/sbin/blkid -s TYPE -o value $dev)
- if [ "$USBFS" != "vfat" ] && [ "$USBFS" != "msdos" ]; then
- if [ "$USBFS" != "ext2" ] && [ "$USBFS" != "ext3" ] && [ "$USBFS"
!= "ext4" ] && [ "$USBFS" != "btrfs" ]; then
- echo "USB filesystem must be vfat, ext[234] or btrfs"
+ TGTFS=$(/sbin/blkid -s TYPE -o value $dev)
+ if [ "$TGTFS" != "vfat" ] && [ "$TGTFS" != "msdos" ]; then
+ if [ "$TGTFS" != "ext2" ] && [ "$TGTFS" != "ext3" ] && [ "$TGTFS"
!= "ext4" ] && [ "$TGTFS" != "btrfs" ]; then
+ echo "Target filesystem must be vfat, ext[234] or btrfs"
exitclean
fi
fi
- USBLABEL=$(/sbin/blkid -s UUID -o value $dev)
- if [ -n "$USBLABEL" ]; then
- USBLABEL="UUID=$USBLABEL"
+ TGTLABEL=$(/sbin/blkid -s UUID -o value $dev)
+ if [ -n "$TGTLABEL" ]; then
+ TGTLABEL="UUID=$TGTLABEL"
else
- USBLABEL=$(/sbin/blkid -s LABEL -o value $dev)
- if [ -n "$USBLABEL" ]; then
- USBLABEL="LABEL=$USBLABEL"
+ TGTLABEL=$(/sbin/blkid -s LABEL -o value $dev)
+ if [ -n "$TGTLABEL" ]; then
+ TGTLABEL="LABEL=$TGTLABEL"
else
- echo "Need to have a filesystem label or UUID for your USB
device"
- if [ "$USBFS" = "vfat" -o "$USBFS" = "msdos" ]; then
+ echo "Need to have a filesystem label or UUID for your target
device"
+ if [ "$TGTFS" = "vfat" -o "$TGTFS" = "msdos" ]; then
echo "Label can be set with /sbin/dosfslabel"
- elif [ "$USBFS" = "ext2" -o "$USBFS" = "ext3" -o "$USBFS" =
"ext4" ]; then
+ elif [ "$TGTFS" = "ext2" -o "$TGTFS" = "ext3" -o "$TGTFS" =
"ext4" ]; then
echo "Label can be set with /sbin/e2label"
- elif [ "$USBFS" = "btrfs" ]; then
+ elif [ "$TGTFS" = "btrfs" ]; then
echo "Eventually you'll be able to use /sbin/btrfs
filesystem label to add a label."
fi
exitclean
fi
fi
- if [ "$USBFS" = "vfat" -o "$USBFS" = "msdos" ]; then
+ if [ "$TGTFS" = "vfat" -o "$TGTFS" = "msdos" ]; then
mountopts="-o shortname=winnt,umask=0077"
fi
}
@@ -336,21 +336,21 @@ if [ $(id -u) != 0 ]; then
exit 1
fi
-detectisotype() {
- if [ -e $CDMNT/LiveOS/squashfs.img ]; then
- isotype=live
+detectsrctype() {
+ if [ -e $SRCMNT/LiveOS/squashfs.img ]; then
+ srctype=live
return
fi
- if [ -e $CDMNT/images/install.img ]; then
- if [ -e $CDMNT/Packages ]; then
- isotype=installer
+ if [ -e $SRCMNT/images/install.img ]; then
+ if [ -e $SRCMNT/Packages ]; then
+ srctype=installer
return
else
- isotype=netinst
+ srctype=netinst
return
fi
fi
- echo "ERROR: $ISO does not appear to be a Live image or DVD installer."
+ echo "ERROR: $SRC does not appear to be a Live image or DVD installer."
exitclean
}
@@ -389,7 +389,7 @@ keephome=1
homesizemb=0
swapsizemb=0
overlaysizemb=0
-isotype=
+srctype=
LIVEOS=LiveOS
HOMEFILE="home.img"
@@ -479,26 +479,26 @@ while [ $# -gt 2 ]; do
shift
done
-ISO=$(readlink -f "$1")
-USBDEV=$(readlink -f "$2")
+SRC=$(readlink -f "$1")
+TGTDEV=$(readlink -f "$2")
-if [ -z "$ISO" ]; then
+if [ -z "$SRC" ]; then
usage
fi
-if [ ! -b "$ISO" -a ! -f "$ISO" ]; then
+if [ ! -b "$SRC" -a ! -f "$SRC" ]; then
usage
fi
# FIXME: If --format is given, we shouldn't care and just use /dev/foo1
-if [ -z "$USBDEV" -o ! -b "$USBDEV" ]; then
+if [ -z "$TGTDEV" -o ! -b "$TGTDEV" ]; then
usage
fi
if [ -z "$noverify" ]; then
# verify the image
echo "Verifying image..."
- checkisomd5 --verbose "$ISO"
+ checkisomd5 --verbose "$SRC"
if [ $? -ne 0 ]; then
echo "Are you SURE you want to continue?"
echo "Press Enter to continue or ctrl-c to abort"
@@ -506,48 +506,48 @@ if [ -z "$noverify" ]; then
fi
fi
-#checkFilesystem $USBDEV
+#checkFilesystem $TGTDEV
# do some basic sanity checks.
-checkMounted $USBDEV
+checkMounted $TGTDEV
if [ -n "$format" -a -z "$skipcopy" ]; then
- checkLVM $USBDEV
+ checkLVM $TGTDEV
# checks for a valid filesystem
if [ -n "$efi" ]; then
- createGPTLayout $USBDEV
- elif [ "$USBFS" == "vfat" -o "$USBFS" == "msdos" ]; then
- createMSDOSLayout $USBDEV
+ createGPTLayout $TGTDEV
+ elif [ "$TGTFS" == "vfat" -o "$TGTFS" == "msdos" ]; then
+ createMSDOSLayout $TGTDEV
else
- createEXTFSLayout $USBDEV
+ createEXTFSLayout $TGTDEV
fi
fi
-checkFilesystem $USBDEV
+checkFilesystem $TGTDEV
if [ -n "$efi" ]; then
- checkGPT $USBDEV
+ checkGPT $TGTDEV
fi
checkSyslinuxVersion
# Because we can't set boot flag for EFI Protective on msdos partition
tables
-[ -z "$efi" ] && checkPartActive $USBDEV
-[ -n "$resetmbr" ] && resetMBR $USBDEV
-checkMBR $USBDEV
+[ -z "$efi" ] && checkPartActive $TGTDEV
+[ -n "$resetmbr" ] && resetMBR $TGTDEV
+checkMBR $TGTDEV
-if [ "$overlaysizemb" -gt 0 -a "$USBFS" = "vfat" ]; then
+if [ "$overlaysizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
if [ "$overlaysizemb" -gt 2047 ]; then
echo "Can't have an overlay of 2048MB or greater on VFAT"
exitclean
fi
fi
-if [ "$homesizemb" -gt 0 -a "$USBFS" = "vfat" ]; then
+if [ "$homesizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
if [ "$homesizemb" -gt 2047 ]; then
echo "Can't have a home overlay greater than 2048MB on VFAT"
exitclean
fi
fi
-if [ "$swapsizemb" -gt 0 -a "$USBFS" = "vfat" ]; then
+if [ "$swapsizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
if [ "$swapsizemb" -gt 2047 ]; then
echo "Can't have a swap file greater than 2048MB on VFAT"
exitclean
@@ -555,58 +555,59 @@ if [ "$swapsizemb" -gt 0 -a "$USBFS" = "vfat" ]; then
fi
# FIXME: would be better if we had better mountpoints
-CDMNT=$(mktemp -d /media/cdtmp.XXXXXX)
-mount -o loop,ro "$ISO" $CDMNT || exitclean
-USBMNT=$(mktemp -d /media/usbdev.XXXXXX)
-mount $mountopts $USBDEV $USBMNT || exitclean
+SRCMNT=$(mktemp -d /media/srctmp.XXXXXX)
+mount -o loop,ro "$SRC" $SRCMNT || exitclean
+TGTMNT=$(mktemp -d /media/tgttmp.XXXXXX)
+mount $mountopts $TGTDEV $TGTMNT || exitclean
trap exitclean SIGINT SIGTERM
-detectisotype
+detectsrctype
-if [ -f "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt
0 ]; then
+if [ -f "$TGTMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt
0 ]; then
echo "ERROR: Requested keeping existing /home and specified a size for
/home"
echo "Please either don't specify a size or specify --delete-home"
exitclean
fi
-if [ -n "$efi" -a ! -d $CDMNT/EFI/boot ]; then
+if [ -n "$efi" -a ! -d $SRCMNT/EFI/boot ]; then
echo "ERROR: This live image does not support EFI booting"
exitclean
fi
# let's try to make sure there's enough room on the stick
-if [ -d $CDMNT/LiveOS ]; then
- check=$CDMNT/LiveOS
+if [ -d $SRCMNT/LiveOS ]; then
+ check=$SRCMNT/LiveOS
else
- check=$CDMNT
+ check=$SRCMNT
fi
-if [[ -d $USBMNT/$LIVEOS ]]; then
- tbd=($(du -B 1M $USBMNT/$LIVEOS))
- [[ -s $USBMNT/$LIVEOS/$HOMEFILE ]] && \
- homesize=($(du -B 1M $USBMNT/$LIVEOS/$HOMEFILE))
+if [[ -d $TGTMNT/$LIVEOS ]]; then
+ tbd=($(du -B 1M $TGTMNT/$LIVEOS))
+ [[ -s $TGTMNT/$LIVEOS/$HOMEFILE ]] && \
+ homesize=($(du -B 1M $TGTMNT/$LIVEOS/$HOMEFILE))
((homesize > 0)) && [[ -n $keephome ]] && ((tbd -= homesize))
else
tbd=0
fi
-targets="$USBMNT/$SYSLINUXPATH"
+targets="$TGTMNT/$SYSLINUXPATH"
if [[ -n $efi ]]; then
- targets+=" $USBMNT/EFI/boot"
+ targets+=" $TGTMNT/EFI/boot"
fi
duTable=($(du -c -B 1M $targets 2> /dev/null))
((tbd += ${duTable[*]: -2:1}))
-sources="$CDMNT/isolinux"
-[[ -n $efi ]] && sources+=" $CDMNT/EFI/boot"
+sources="$SRCMNT/isolinux"
+[[ -n $efi ]] && sources+=" $SRCMNT/EFI/boot"
if [[ -n $skipcompress ]]; then
- if [[ -s $CDMNT/LiveOS/squashfs.img ]]; then
- if mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT; then
- livesize=($(du -B 1M --apparent-size $CDMNT/LiveOS/ext3fs.img))
- umount $CDMNT
+ if [[ -s $SRCMNT/LiveOS/squashfs.img ]]; then
+ if mount -o loop $SRCMNT/LiveOS/squashfs.img $SRCMNT; then
+ livesize=($(du -B 1M --apparent-size
$SRCMNT/LiveOS/ext3fs.img))
+ umount $SRCMNT
else
- echo "WARNING: --skipcompress or --xo was specified but the
currently"
- echo "running kernel can not mount the squashfs from the ISO
file to extract"
- echo "it. The compressed squashfs will be copied to the USB
stick."
+ echo "WARNING: --skipcompress or --xo was specified but the
+ currently-running kernel can not mount the SquashFS from the
source
+ file to extract it. Instead, the compressed SquashFS will be
copied
+ to the target device."
skipcompress=""
fi
fi
@@ -618,10 +619,10 @@ else
livesize=${duTable[*]: -2:1}
fi
-freespace=($(df -B 1M --total $USBDEV))
+freespace=($(df -B 1M --total $TGTDEV))
freespace=${freespace[*]: -2:1}
-if [ "$isotype" = "live" ]; then
+if [ "$srctype" = "live" ]; then
tba=$((overlaysizemb + homesizemb + livesize + swapsizemb))
if ((tba > freespace + tbd)); then
needed=$((tba - freespace - tbd))
@@ -646,29 +647,30 @@ if [ "$isotype" = "live" ]; then
fi
# Verify available space for DVD installer
-if [ "$isotype" = "installer" ]; then
- isosize=$(du -s -B 1M $ISO | awk {'print $1;'})
- installimgsize=$(du -s -B 1M $CDMNT/images/install.img | awk {'print
$1;'})
+if [ "$srctype" = "installer" ]; then
+ srcsize=$(du -s -B 1M $SRC | awk {'print $1;'})
+ installimgsize=$(du -s -B 1M $SRCMNT/images/install.img | awk {'print
$1;'})
tbd=0
- if [ -e $USBMNT/images/install.img ]; then
- tbd=$(du -s -B 1M $USBMNT/images/install.img | awk {'print $1;'})
+ if [ -e $TGTMNT/images/install.img ]; then
+ tbd=$(du -s -B 1M $TGTMNT/images/install.img | awk {'print $1;'})
fi
- if [ -e $USBMNT/$(basename $ISO) ]; then
- tbd=$(($tbd + $(du -s -B 1M $USBMNT/$(basename $ISO) | awk {'print
$1;'})))
+ if [ -e $TGTMNT/$(basename $SRC) ]; then
+ tbd=$(($tbd + $(du -s -B 1M $TGTMNT/$(basename $SRC) | awk {'print
$1;'})))
fi
- echo "Size of DVD image: $isosize"
+ echo "Size of DVD image: $srcsize"
echo "Size of install.img: $installimgsize"
echo "Available space: $((freespace + tbd))"
- if (( ((isosize + installimgsize)) > ((freespace + tbd)) )); then
- echo "ERROR: Unable to fit DVD image + install.img on available
space on USB stick"
+ if (( ((srcsize + installimgsize)) > ((freespace + tbd)) )); then
+ echo "ERROR: Unable to fit DVD image + install.img on the available
+ space of the target device."
exitclean
fi
fi
-if [ -z "$skipcopy" ] && [ "$isotype" = "live" ]; then
- if [ -d $USBMNT/$LIVEOS -a -z "$force" ]; then
+if [ -z "$skipcopy" ] && [ "$srctype" = "live" ]; then
+ if [ -d $TGTMNT/$LIVEOS -a -z "$force" ]; then
echo "Already set up as live image."
- if [ -z "$keephome" -a -e $USBMNT/$LIVEOS/$HOMEFILE ]; then
+ if [ -z "$keephome" -a -e $TGTMNT/$LIVEOS/$HOMEFILE ]; then
echo "WARNING: Persistent /home will be deleted!!!"
echo "Press Enter to continue or ctrl-c to abort"
read
@@ -676,58 +678,58 @@ if [ -z "$skipcopy" ] && [ "$isotype" = "live" ]; then
echo "Deleting old OS in fifteen seconds..."
sleep 15
- [ -e "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" ] && mv
$USBMNT/$LIVEOS/$HOMEFILE $USBMNT/$HOMEFILE
+ [ -e "$TGTMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" ] && mv
$TGTMNT/$LIVEOS/$HOMEFILE $TGTMNT/$HOMEFILE
fi
- rm -rf $USBMNT/$LIVEOS
+ rm -rf $TGTMNT/$LIVEOS
fi
fi
# Bootloader is always reconfigured, so keep these out of the if skipcopy
stuff.
-[ ! -d $USBMNT/$SYSLINUXPATH ] && mkdir -p $USBMNT/$SYSLINUXPATH
-[ -n "$efi" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot
+[ ! -d $TGTMNT/$SYSLINUXPATH ] && mkdir -p $TGTMNT/$SYSLINUXPATH
+[ -n "$efi" -a ! -d $TGTMNT/EFI/boot ] && mkdir -p $TGTMNT/EFI/boot
# Live image copy
-if [ "$isotype" = "live" -a -z "$skipcopy" ]; then
- echo "Copying live image to USB stick"
- [ ! -d $USBMNT/$LIVEOS ] && mkdir $USBMNT/$LIVEOS
- [ -n "$keephome" -a -f "$USBMNT/$HOMEFILE" ] && mv $USBMNT/$HOMEFILE
$USBMNT/$LIVEOS/$HOMEFILE
- if [ -n "$skipcompress" -a -f $CDMNT/LiveOS/squashfs.img ]; then
- mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
- copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img ||
(umount $CDMNT ; exitclean)
- umount $CDMNT
- elif [ -f $CDMNT/LiveOS/squashfs.img ]; then
- copyFile $CDMNT/LiveOS/squashfs.img $USBMNT/$LIVEOS/squashfs.img ||
exitclean
- elif [ -f $CDMNT/LiveOS/ext3fs.img ]; then
- copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img ||
exitclean
- fi
- if [ -f $CDMNT/LiveOS/osmin.img ]; then
- copyFile $CDMNT/LiveOS/osmin.img $USBMNT/$LIVEOS/osmin.img ||
exitclean
+if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
+ echo "Copying live image to the target device."
+ [ ! -d $TGTMNT/$LIVEOS ] && mkdir $TGTMNT/$LIVEOS
+ [ -n "$keephome" -a -f "$TGTMNT/$HOMEFILE" ] && mv $TGTMNT/$HOMEFILE
$TGTMNT/$LIVEOS/$HOMEFILE
+ if [ -n "$skipcompress" -a -f $SRCMNT/LiveOS/squashfs.img ]; then
+ mount -o loop $SRCMNT/LiveOS/squashfs.img $SRCMNT || exitclean
+ copyFile $SRCMNT/LiveOS/ext3fs.img $TGTMNT/$LIVEOS/ext3fs.img ||
(umount $SRCMNT ; exitclean)
+ umount $SRCMNT
+ elif [ -f $SRCMNT/LiveOS/squashfs.img ]; then
+ copyFile $SRCMNT/LiveOS/squashfs.img $TGTMNT/$LIVEOS/squashfs.img
|| exitclean
+ elif [ -f $SRCMNT/LiveOS/ext3fs.img ]; then
+ copyFile $SRCMNT/LiveOS/ext3fs.img $TGTMNT/$LIVEOS/ext3fs.img ||
exitclean
+ fi
+ if [ -f $SRCMNT/LiveOS/osmin.img ]; then
+ copyFile $SRCMNT/LiveOS/osmin.img $TGTMNT/$LIVEOS/osmin.img ||
exitclean
fi
sync
fi
# DVD installer copy
-if [ \( "$isotype" = "installer" -o "$isotype" = "netinst" \) -a -z
"$skipcopy" ]; then
- echo "Copying DVD image to USB stick"
- mkdir -p $USBMNT/images/
- copyFile $CDMNT/images/install.img $USBMNT/images/install.img ||
exitclean
- if [ "$isotype" = "installer" ]; then
- cp $ISO $USBMNT/
+if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) -a -z
"$skipcopy" ]; then
+ echo "Copying DVD image to the target device."
+ mkdir -p $TGTMNT/images/
+ copyFile $SRCMNT/images/install.img $TGTMNT/images/install.img ||
exitclean
+ if [ "$srctype" = "installer" ]; then
+ cp $SRC $TGTMNT/
fi
sync
fi
-cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH
-BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg
+cp $SRCMNT/isolinux/* $TGTMNT/$SYSLINUXPATH
+BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
# Set this to nothing so sed doesn't care
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
- cp $CDMNT/EFI/boot/* $USBMNT/EFI/boot
+ cp $SRCMNT/EFI/boot/* $TGTMNT/EFI/boot
# this is a little ugly, but it gets the "interesting" named config
file
- BOOTCONFIG_EFI=$USBMNT/EFI/boot/boot?*.conf
- rm -f $USBMNT/EFI/boot/grub.conf
+ BOOTCONFIG_EFI=$TGTMNT/EFI/boot/boot?*.conf
+ rm -f $TGTMNT/EFI/boot/grub.conf
fi
echo "Updating boot config file"
@@ -735,7 +737,7 @@ echo "Updating boot config file"
if [ -n "$LANG" ]; then
kernelargs="$kernelargs LANG=$LANG"
fi
-sed -i -e "s/CDLABEL=[^ ]*/$USBLABEL/" -e "s/rootfstype=[^
]*/rootfstype=$USBFS/" -e "s/LABEL=[^ ]*/$USBLABEL/" $BOOTCONFIG
$BOOTCONFIG_EFI
+sed -i -e "s/CDLABEL=[^ ]*/$TGTLABEL/" -e "s/rootfstype=[^
]*/rootfstype=$TGTFS/" -e "s/LABEL=[^ ]*/$TGTLABEL/" $BOOTCONFIG
$BOOTCONFIG_EFI
if [ -n "$kernelargs" ]; then
sed -i -e "s/liveimg/liveimg ${kernelargs}/" $BOOTCONFIG
$BOOTCONFIG_EFI
fi
@@ -744,14 +746,14 @@ if [ "$LIVEOS" != "LiveOS" ]; then
fi
# DVD Installer
-if [ "$isotype" = "installer" ]; then
- sed -i -e "s;initrd=initrd.img;initrd=initrd.img ${LANG:+LANG=$LANG}
repo=hd:$USBLABEL:/;g" $BOOTCONFIG $BOOTCONFIG_EFI
+if [ "$srctype" = "installer" ]; then
+ sed -i -e "s;initrd=initrd.img;initrd=initrd.img ${LANG:+LANG=$LANG}
repo=hd:$TGTLABEL:/;g" $BOOTCONFIG $BOOTCONFIG_EFI
sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
fi
# DVD Installer for netinst
-if [ "$isotype" = "netinst" ]; then
- sed -i -e "s;stage2=\S*;stage2=hd:$USBLABEL:/images/install.img;g"
$BOOTCONFIG $BOOTCONFIG_EFI
+if [ "$srctype" = "netinst" ]; then
+ sed -i -e "s;stage2=\S*;stage2=hd:$TGTLABEL:/images/install.img;g"
$BOOTCONFIG $BOOTCONFIG_EFI
fi
# Adjust the boot timeouts
@@ -764,7 +766,7 @@ fi
# Use repo if the .iso has the repository on it, otherwise use stage2 which
# will default to using the network mirror
-if [ -e "$CDMNT/.discinfo" ]; then
+if [ -e "$SRCMNT/.discinfo" ]; then
METHODSTR=repo
else
METHODSTR=stage2
@@ -772,38 +774,38 @@ fi
if [ "$overlaysizemb" -gt 0 ]; then
echo "Initializing persistent overlay file"
- OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $USBDEV )-$(
/sbin/blkid -s UUID -o value $USBDEV )"
+ OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $TGTDEV )-$(
/sbin/blkid -s UUID -o value $TGTDEV )"
if [ -z "$skipcopy" ]; then
- if [ "$USBFS" = "vfat" ]; then
+ if [ "$TGTFS" = "vfat" ]; then
# vfat can't handle sparse files
- dd if=/dev/zero of=$USBMNT/$LIVEOS/$OVERFILE
count=$overlaysizemb bs=1M
+ dd if=/dev/zero of=$TGTMNT/$LIVEOS/$OVERFILE
count=$overlaysizemb bs=1M
else
- dd if=/dev/null of=$USBMNT/$LIVEOS/$OVERFILE count=1 bs=1M
seek=$overlaysizemb
+ dd if=/dev/null of=$TGTMNT/$LIVEOS/$OVERFILE count=1 bs=1M
seek=$overlaysizemb
fi
fi
- sed -i -e "s/liveimg/liveimg overlay=${USBLABEL}/" $BOOTCONFIG
$BOOTCONFIG_EFI
+ sed -i -e "s/liveimg/liveimg overlay=${TGTLABEL}/" $BOOTCONFIG
$BOOTCONFIG_EFI
sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG $BOOTCONFIG_EFI
fi
if [ "$swapsizemb" -gt 0 -a -z "$skipcopy" ]; then
echo "Initializing swap file"
- dd if=/dev/zero of=$USBMNT/$LIVEOS/swap.img count=$swapsizemb bs=1M
- mkswap -f $USBMNT/$LIVEOS/swap.img
+ dd if=/dev/zero of=$TGTMNT/$LIVEOS/swap.img count=$swapsizemb bs=1M
+ mkswap -f $TGTMNT/$LIVEOS/swap.img
fi
if [ "$homesizemb" -gt 0 -a -z "$skipcopy" ]; then
echo "Initializing persistent /home"
homesource=/dev/zero
[ -n "$cryptedhome" ] && homesource=/dev/urandom
- if [ "$USBFS" = "vfat" ]; then
+ if [ "$TGTFS" = "vfat" ]; then
# vfat can't handle sparse files
- dd if=${homesource} of=$USBMNT/$LIVEOS/$HOMEFILE count=$homesizemb
bs=1M
+ dd if=${homesource} of=$TGTMNT/$LIVEOS/$HOMEFILE count=$homesizemb
bs=1M
else
- dd if=/dev/null of=$USBMNT/$LIVEOS/$HOMEFILE count=1 bs=1M
seek=$homesizemb
+ dd if=/dev/null of=$TGTMNT/$LIVEOS/$HOMEFILE count=1 bs=1M
seek=$homesizemb
fi
if [ -n "$cryptedhome" ]; then
loop=$(losetup -f)
- losetup $loop $USBMNT/$LIVEOS/$HOMEFILE
+ losetup $loop $TGTMNT/$LIVEOS/$HOMEFILE
setupworked=1
until [ ${setupworked} == 0 ]; do
echo "Encrypting persistent /home"
@@ -823,8 +825,8 @@ if [ "$homesizemb" -gt 0 -a -z "$skipcopy" ]; then
losetup -d $loop
else
echo "Formatting unencrypted /home"
- mke2fs -F -j $USBMNT/$LIVEOS/$HOMEFILE
- tune2fs -c0 -i0 -ouser_xattr,acl $USBMNT/$LIVEOS/$HOMEFILE
+ mke2fs -F -j $TGTMNT/$LIVEOS/$HOMEFILE
+ tune2fs -c0 -i0 -ouser_xattr,acl $TGTMNT/$LIVEOS/$HOMEFILE
fi
fi
@@ -833,16 +835,16 @@ fi
# boot on the XO anyway.
if [ -n "$xo" ]; then
echo "Setting up /boot/olpc.fth file"
- args=$(grep "^ *append" $USBMNT/$SYSLINUXPATH/isolinux.cfg |head -n1
|sed -e 's/.*initrd=[^ ]*//')
- if [ -z "$xonohome" -a ! -f $USBMNT/$LIVEOS/$HOMEFILE ]; then
+ args=$(grep "^ *append" $TGTMNT/$SYSLINUXPATH/isolinux.cfg |head -n1
|sed -e 's/.*initrd=[^ ]*//')
+ if [ -z "$xonohome" -a ! -f $TGTMNT/$LIVEOS/$HOMEFILE ]; then
args="$args persistenthome=mtd0"
fi
args="$args reset_overlay"
xosyspath=$(echo $SYSLINUXPATH | sed -e 's;/;\\;')
- if [ ! -d $USBMNT/boot ]; then
- mkdir -p $USBMNT/boot
+ if [ ! -d $TGTMNT/boot ]; then
+ mkdir -p $TGTMNT/boot
fi
- cat > $USBMNT/boot/olpc.fth <<EOF
+ cat > $TGTMNT/boot/olpc.fth <<EOF
\ Boot script for USB boot
hex rom-pa fffc7 + 4 \$number drop h# 2e19 < [if]
patch 2drop erase claim-params
@@ -886,55 +888,55 @@ if [ -z "$multi" ]; then
echo "Installing boot loader"
if [ -n "$efi" ]; then
# replace the ia32 hack
- if [ -f "$USBMNT/EFI/boot/boot.conf" ]; then
- cp -f $USBMNT/EFI/boot/bootia32.conf $USBMNT/EFI/boot/boot.conf
+ if [ -f "$TGTMNT/EFI/boot/boot.conf" ]; then
+ cp -f $TGTMNT/EFI/boot/bootia32.conf $TGTMNT/EFI/boot/boot.conf
fi
fi
# this is a bit of a kludge, but syslinux doesn't guarantee the API for
its com32 modules :/
- if [ -f $USBMNT/$SYSLINUXPATH/vesamenu.c32 -a -f
/usr/share/syslinux/vesamenu.c32 ]; then
- cp /usr/share/syslinux/vesamenu.c32
$USBMNT/$SYSLINUXPATH/vesamenu.c32
- elif [ -f $USBMNT/$SYSLINUXPATH/vesamenu.c32 -a -f
/usr/lib/syslinux/vesamenu.c32 ]; then
- cp /usr/lib/syslinux/vesamenu.c32
$USBMNT/$SYSLINUXPATH/vesamenu.c32
- elif [ -f $USBMNT/$SYSLINUXPATH/menu.c32 -a -f
/usr/share/syslinux/menu.c32 ]; then
- cp /usr/share/syslinux/menu.c32 $USBMNT/$SYSLINUXPATH/menu.c32
- elif [ -f $USBMNT/$SYSLINUXPATH/menu.c32 -a -f
/usr/lib/syslinux/menu.c32 ]; then
- cp /usr/lib/syslinux/menu.c32 $USBMNT/$SYSLINUXPATH/menu.c32
+ if [ -f $TGTMNT/$SYSLINUXPATH/vesamenu.c32 -a -f
/usr/share/syslinux/vesamenu.c32 ]; then
+ cp /usr/share/syslinux/vesamenu.c32
$TGTMNT/$SYSLINUXPATH/vesamenu.c32
+ elif [ -f $TGTMNT/$SYSLINUXPATH/vesamenu.c32 -a -f
/usr/lib/syslinux/vesamenu.c32 ]; then
+ cp /usr/lib/syslinux/vesamenu.c32
$TGTMNT/$SYSLINUXPATH/vesamenu.c32
+ elif [ -f $TGTMNT/$SYSLINUXPATH/menu.c32 -a -f
/usr/share/syslinux/menu.c32 ]; then
+ cp /usr/share/syslinux/menu.c32 $TGTMNT/$SYSLINUXPATH/menu.c32
+ elif [ -f $TGTMNT/$SYSLINUXPATH/menu.c32 -a -f
/usr/lib/syslinux/menu.c32 ]; then
+ cp /usr/lib/syslinux/menu.c32 $TGTMNT/$SYSLINUXPATH/menu.c32
fi
- if [ "$USBFS" == "vfat" -o "$USBFS" == "msdos" ]; then
+ if [ "$TGTFS" == "vfat" -o "$TGTFS" == "msdos" ]; then
# syslinux expects the config to be named syslinux.cfg
# and has to run with the file system unmounted
- mv $USBMNT/$SYSLINUXPATH/isolinux.cfg
$USBMNT/$SYSLINUXPATH/syslinux.cfg
+ mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/syslinux.cfg
# deal with mtools complaining about ldlinux.sys
- if [ -f $USBMNT/$SYSLINUXPATH/ldlinux.sys ]; then
- rm -f $USBMNT/$SYSLINUXPATH/ldlinux.sys
+ if [ -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys ]; then
+ rm -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys
fi
cleanup
if [ -n "$SYSLINUXPATH" ]; then
- syslinux -d $SYSLINUXPATH $USBDEV
+ syslinux -d $SYSLINUXPATH $TGTDEV
else
- syslinux $USBDEV
+ syslinux $TGTDEV
fi
- elif [ "$USBFS" == "ext2" -o "$USBFS" == "ext3" -o "$USBFS" == "ext4"
-o "$USBFS" == "btrfs" ]; then
+ elif [ "$TGTFS" == "ext2" -o "$TGTFS" == "ext3" -o "$TGTFS" == "ext4"
-o "$TGTFS" == "btrfs" ]; then
# extlinux expects the config to be named extlinux.conf
# and has to be run with the file system mounted
- mv $USBMNT/$SYSLINUXPATH/isolinux.cfg
$USBMNT/$SYSLINUXPATH/extlinux.conf
- extlinux -i $USBMNT/$SYSLINUXPATH
+ mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/extlinux.conf
+ extlinux -i $TGTMNT/$SYSLINUXPATH
# Starting with syslinux 4 ldlinux.sys is used on all file systems.
- if [ -f "$USBMNT/$SYSLINUXPATH/extlinux.sys" ]; then
- chattr -i $USBMNT/$SYSLINUXPATH/extlinux.sys
- elif [ -f "$USBMNT/$SYSLINUXPATH/ldlinux.sys" ]; then
- chattr -i $USBMNT/$SYSLINUXPATH/ldlinux.sys
+ if [ -f "$TGTMNT/$SYSLINUXPATH/extlinux.sys" ]; then
+ chattr -i $TGTMNT/$SYSLINUXPATH/extlinux.sys
+ elif [ -f "$TGTMNT/$SYSLINUXPATH/ldlinux.sys" ]; then
+ chattr -i $TGTMNT/$SYSLINUXPATH/ldlinux.sys
fi
cleanup
fi
else
# we need to do some more config file tweaks for multi-image mode
- sed -i -e "s;kernel vm;kernel /$LIVEOS/syslinux/vm;"
$USBMNT/$SYSLINUXPATH/isolinux.cfg
- sed -i -e "s;initrd=i;initrd=/$LIVEOS/syslinux/i;"
$USBMNT/$SYSLINUXPATH/isolinux.cfg
- mv $USBMNT/$SYSLINUXPATH/isolinux.cfg
$USBMNT/$SYSLINUXPATH/syslinux.cfg
+ sed -i -e "s;kernel vm;kernel /$LIVEOS/syslinux/vm;"
$TGTMNT/$SYSLINUXPATH/isolinux.cfg
+ sed -i -e "s;initrd=i;initrd=/$LIVEOS/syslinux/i;"
$TGTMNT/$SYSLINUXPATH/isolinux.cfg
+ mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/syslinux.cfg
cleanup
fi
-echo "USB stick set up as live image!"
+echo "Target device is now set up with a Live image!"
--
1.7.3.2
13 years, 3 months
chkconfig on doesn't work for init script in livecd
by msacks
I am trying to get a custom init script to start up at boot time on a
livecd I am spinning, but for some reason it isn't getting picked up.
Here is the recount of what I've done:
I created a custom init script (/etc/init.d/custombinary) as follows
and put it in an rpm with my binary:
#!/bin/bash
#
# custombinary Start up the custombinary utility
#
# chkconfig: 2345 55 25
# description: This service starts up a custombinary
#
# processname: custombinary
### BEGIN INIT INFO
# Provides: custombinary
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: run custom binary
# Description: Custom binary init script script to be used with liveCD
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
start()
{
echo "Starting custom binary"
/opt/custom/bin/custombinary
}
stop()
{
echo "Shutdown"
killall -9 custombinary
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: start | stop"
exit 1
;;
esac
exit $?
I package the rpm and init script, both of those get pushed out to the
liveCD with no problem.
In my spin-kickstart file I have the following line:
%post --log=/tmp/my-post.log
/sbin/chkconfig --add custombinary
/sbin/chkconfig --level 35 custombinary on
When I run livecd-creator, I don't get any errors.
When I run a chkconfig --list custombinary I get an error saying
service custombinary supports chkconfig, but is not referenced in any
runlevel (run 'chkconfig --add custombinary'
What is super-confusing is that my init script works with chkconfig if I run
/sbin/chkconfig --add custombinary
/sbin/chkconfig --level 35 custombinary on
once my livecd is booted up, but for some reason it isn't getting
turned on by default during the livecd creation.
13 years, 3 months
Re: [Fedora-livecd-list] booting LiveCD ISO using PXELINUX [SOLVED]
by msacks
This does the trick. Thank you.
On Wed, Dec 1, 2010 at 11:11 PM, mammar <mammar(a)gmail.com> wrote:
> Hi,
>
> I have been using PXELINUX on Fedora 13 and Fedora 14 and everything is
> working great.
>
> Try the following in your pxelinux config file (changes are in red color)
>
> I am assuming that your is name is fedora-livecd.iso
>
> label LiveCD
> MENU LABEL LiveCD
> kernel livecd/vmlinuz0
> append initrd=livecd/initrd0.img media=network
> rootflags=loop root=live:/fedora-livecd.iso rootfstype=iso9660 ro liveimg
> rhgb rd_NO_LUKS rd_NO_MD rd_NO_DM ramdisk_size=164212 init=/bin/init
> iso1=nfs://imagesrv/fedora-livecd.iso
>
>
> Following is my pxelinux configuration
>
>
> label linux0
> menu label Fedora Network Installer
> kernel liveiso/vmlinuz0
> APPEND rootflags=loop initrd=liveiso/initrd0.img
> root=live:/Fedora-13-live.iso rootfstype=iso9660 rw liveimg rhgb
> rd_NO_LUKS rd_NO_MD quiet
>
>
> I am using livecd-iso-to-pxeboot script from livecd-tools package to extract
> the iso.
>
>
> Regards,
>
>
>
> On Thu, Dec 2, 2010 at 5:51 AM, msacks <ntwrkd(a)gmail.com> wrote:
>>
>> I'm stuck trying to get a Fedora 13 based LiveCD to boot using
>> PXELINUX. I confirmed that the LiveCD once burned to an ISO boots
>> fine, likewise running the ISO file inside of a VM.
>>
>> I've seen a host of bugs opened on Redhat bugzilla around this issue,
>> but none of them really point to a finite resolution.
>> I hope to shake out some clues as to how to resolve this issue.
>>
>> Here is my PXELINUX Config:
>>
>> label LiveCD
>> MENU LABEL LiveCD
>> kernel livecd/vmlinuz0
>> append initrd=livecd/initrd0.img media=network
>> root=live:CDLABEL=F13-LiveCD-POC-20101201-122711 rootfstype=auto ro
>> liveimg rhgb rd_NO_LUKS rd_NO_MD rd_NO_DM ramdisk_size=164212
>> init=/bin/init iso1=nfs://imagesrv/fedora-livecd.iso
>>
>> I am running syslinux-3.82-8.9.2
>> livecd-tools-033-3.fc13.x86_64
>> squashfs 4.0
>>
>> What happens is I see the blue Fedora status bar loading up just fine,
>> then it throws an error saying
>> "No root device found"
>> "Boot has failed, sleeping forever"
>>
>> What should the root device be?
>> Is this a bug with squash or configuration error?
>> --
>> livecd mailing list
>> livecd(a)lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/livecd
>
>
> --
> livecd mailing list
> livecd(a)lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/livecd
>
13 years, 3 months
booting LiveCD ISO using PXELINUX
by msacks
I'm stuck trying to get a Fedora 13 based LiveCD to boot using
PXELINUX. I confirmed that the LiveCD once burned to an ISO boots
fine, likewise running the ISO file inside of a VM.
I've seen a host of bugs opened on Redhat bugzilla around this issue,
but none of them really point to a finite resolution.
I hope to shake out some clues as to how to resolve this issue.
Here is my PXELINUX Config:
label LiveCD
MENU LABEL LiveCD
kernel livecd/vmlinuz0
append initrd=livecd/initrd0.img media=network
root=live:CDLABEL=F13-LiveCD-POC-20101201-122711 rootfstype=auto ro
liveimg rhgb rd_NO_LUKS rd_NO_MD rd_NO_DM ramdisk_size=164212
init=/bin/init iso1=nfs://imagesrv/fedora-livecd.iso
I am running syslinux-3.82-8.9.2
livecd-tools-033-3.fc13.x86_64
squashfs 4.0
What happens is I see the blue Fedora status bar loading up just fine,
then it throws an error saying
"No root device found"
"Boot has failed, sleeping forever"
What should the root device be?
Is this a bug with squash or configuration error?
13 years, 3 months
tools/livecd-iso-to-disk.sh
by Brian C. Lane
tools/livecd-iso-to-disk.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 232ad957b64dc29177d3309637b1a15ac979d20a
Author: Frederick Grose <fgrose(a)gmail.com>
Date: Thu Dec 2 09:48:23 2010 -0800
Fix incomplete rename of freespace variable (#656154)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 628822c..51abc0c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -635,7 +635,7 @@ if [ "$isotype" = "live" ]; then
(($swapsizemb > 0)) && \
printf " + Swap overlay size: %11s\n" $swapsizemb
printf " = Total requested space: %6s MiB\n" $tba
- printf " - Space available: %12s\n" $(($free + $tbd))
+ printf " - Space available: %12s\n" $((freespace + tbd))
printf " ==============================\n"
printf " Space needed: %15s MiB\n\n" $needed
printf " To fit the installation on this device,
@@ -658,8 +658,8 @@ if [ "$isotype" = "installer" ]; then
fi
echo "Size of DVD image: $isosize"
echo "Size of install.img: $installimgsize"
- echo "Available space: $(($free + $tbd))"
- if [ $(($isosize + $installimgsize)) -gt $(($free + $tbd)) ]; then
+ echo "Available space: $((freespace + tbd))"
+ if (( ((isosize + installimgsize)) > ((freespace + tbd)) )); then
echo "ERROR: Unable to fit DVD image + install.img on available space on USB stick"
exitclean
fi
13 years, 4 months