--binary-images can support only a single type

whilst some parts of the codebase were set up to work with multiple types
specified, others did not work with it and would not necessarily be easy
to adjust. this thus makes some tweaks to adjust things accordingly.

 - option renamed to singular form (maintaining backwards compatibility)
 - a validation check has been added
 - unnecessary glob style type references fixed
 - checks with In_list changed to a direct singular comparison
 - typo of type "netboot" written as just "net" fixed (though unreachable
   so of no consequence; really the code could be removed but it's trivial)

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-03-28 05:13:11 +00:00 committed by Raphaël Hertzog
parent cede584a5c
commit 39e4d3e3cb
14 changed files with 38 additions and 43 deletions

View File

@ -374,7 +374,7 @@ Set_config_defaults ()
case "${LB_ARCHITECTURES}" in
amd64|i386)
case "${LIVE_IMAGE_TYPE}" in
hdd*|netboot)
hdd|netboot)
LB_BOOTLOADERS="syslinux"
;;
*)
@ -451,11 +451,11 @@ Set_config_defaults ()
if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
then
case "${LIVE_IMAGE_TYPE}" in
iso*)
iso|iso-hybrid)
_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
hdd*)
hdd)
_LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
@ -470,6 +470,9 @@ Set_config_defaults ()
;;
esac
;;
tar)
;;
esac
fi
@ -618,8 +621,13 @@ Check_config_defaults ()
esac
fi
if ! In_list "${LIVE_IMAGE_TYPE}" iso iso-hybrid hdd tar netboot; then
Echo_error "You have specified an invalid value for --binary-image."
exit 1
fi
case "${LIVE_IMAGE_TYPE}" in
hdd*)
hdd)
case "${LB_FIRST_BOOTLOADER}" in
grub-legacy)
Echo_error "You have selected a combination of bootloader and image type that is currently not supported by live-build. Please use either another bootloader or a different image type."

View File

@ -36,7 +36,7 @@
.br
[\fB\-\-binary\-filesystem\fR fat16|fat32|ext2|ext3|ext4|ntfs]
.br
[\-b|\fB\-\-binary\-images\fR iso|iso\-hybrid|netboot|tar|hdd]
[\-b|\fB\-\-binary\-image\fR iso|iso\-hybrid|netboot|tar|hdd]
.br
[\fB\-\-bootappend\-install\fR \fIPARAMETER\fR|"\fIPARAMETERS\fR"]
.br
@ -276,8 +276,8 @@ defines which package archive areas (comma or space separated) of a debian packa
defines if debian backports package archives should be included in the image or not.
.IP "\fB\-\-binary\-filesystem\fR fat16|fat32|ext2|ext3|ext4|ntfs" 4
defines the filesystem to be used in the image type. This only has an effect if the selected binary image type lets you choose a filesystem. For example, when selection ISO the resulting CD/DVD has always the filesystem ISO9660. When building HDD images for USB sticks, this is active. Note that it defaults to fat16 on all architectures except sparc where it defaults to ext4. Also note that if you choose fat16 and your resulting binary image gets bigger than 2GB, the binary filesystem automatically gets switched to fat32.
.IP "\-b|\fB\-\-binary\-images\fR iso|iso\-hybrid|netboot|tar|hdd" 4
defines the image type to build. By default, for images using syslinux this is set to iso\-hybrid to build CD/DVD images that may also be used like HDD images, for non\-syslinux images, it defaults to ISO.
.IP "\-b|\fB\-\-binary\-image\fR iso|iso\-hybrid|netboot|tar|hdd" 4
defines the image type to build. By default, for images using syslinux this is set to 'iso\-hybrid' to build CD/DVD images that may also be used like HDD images, for non\-syslinux images, it defaults to 'iso'.
.IP "\fB\-\-bootappend\-install\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4
sets boot parameters specific to debian\-installer, if included.
.IP "\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4

View File

@ -21,13 +21,9 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
case "${LIVE_IMAGE_TYPE}" in
iso*|hdd*)
;;
*)
exit 0
;;
esac
if ! In_list "${LIVE_IMAGE_TYPE}" iso iso-hybrid hdd; then
exit 0
fi
Echo_message "Begin installing disk information..."

View File

@ -40,7 +40,7 @@ Check_crossarchitectures
# Setting destination directory
case "${LIVE_IMAGE_TYPE}" in
hdd*|netboot)
hdd|netboot)
Echo_warning "Bootloader in this image type not yet supported by live-build."
Echo_error "This would produce a not bootable image, aborting (FIXME)."
exit 1

View File

@ -104,7 +104,7 @@ esac
# Setting destination directory
case "${LIVE_IMAGE_TYPE}" in
iso*|tar)
iso|iso-hybrid|tar)
case "${LB_INITRAMFS}" in
live-boot)
DESTDIR_LIVE="binary/live"
@ -118,7 +118,7 @@ case "${LIVE_IMAGE_TYPE}" in
DESTDIR_INSTALL="binary/install"
;;
hdd*|netboot)
hdd|netboot)
Echo_warning "Bootloader in this image type not yet supported by live-build."
Echo_error "This would produce a not bootable image, aborting (FIXME)."
exit 1
@ -214,11 +214,11 @@ mkdir -p binary/boot/grub
cp -r "${_SOURCE}"/* binary/boot/grub
case ${LIVE_IMAGE_TYPE} in
iso*)
iso|iso-hybrid)
FILES="chroot/usr/lib/grub/*/stage2_eltorito"
;;
hdd*|tar)
hdd|tar)
FILES="chroot/usr/lib/grub/*/stage1 chroot/usr/lib/grub/*/e2fs_stage1_5 chroot/usr/lib/grub/*/stage2"
;;
esac

View File

@ -49,7 +49,7 @@ Install_package
# Setting destination directory
case "${LIVE_IMAGE_TYPE}" in
hdd*|netboot)
hdd|netboot)
Echo_warning "Bootloader in this image type not yet supported by live-build."
Echo_error "This would produce a not bootable image, aborting (FIXME)."
exit 1
@ -60,11 +60,11 @@ esac
mkdir -p binary/boot/grub/i386-pc
case ${LIVE_IMAGE_TYPE} in
iso*)
iso|iso-hybrid)
FILES="chroot/usr/lib/grub/i386-pc/*.mod chroot/usr/lib/grub/i386-pc/*.lst chroot/usr/lib/grub/i386-pc/efiemu??.o chroot/usr/share/grub/*.pf2"
;;
hdd*|tar)
hdd|tar)
FILES="chroot/usr/lib/grub/i386-pc/*"
;;
esac

View File

@ -21,8 +21,7 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
if ! In_list hdd "${LIVE_IMAGE_TYPE}"
then
if [ "${LIVE_IMAGE_TYPE}" != "hdd" ]; then
exit 0
fi

View File

@ -40,11 +40,9 @@ then
cd "${OLDPWD}"
# Removing symlinks
case "${LIVE_IMAGE_TYPE}" in
hdd*)
find binary -type l | xargs rm -f
;;
esac
if [ "${LIVE_IMAGE_TYPE}" = "hdd" ]; then
find binary -type l | xargs rm -f
fi
fi
# Creating stage file

View File

@ -21,8 +21,7 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
if ! In_list netboot "${LIVE_IMAGE_TYPE}"
then
if [ "${LIVE_IMAGE_TYPE}" != "netboot" ]; then
exit 0
fi

View File

@ -49,7 +49,7 @@ esac
# Assembling image specifics
case "${LIVE_IMAGE_TYPE}" in
iso*)
iso|iso-hybrid)
_BOOTLOADER="isolinux"
_TARGET="binary/isolinux"
;;
@ -59,7 +59,7 @@ case "${LIVE_IMAGE_TYPE}" in
_TARGET="tftpboot"
;;
hdd*|*)
hdd|tar)
case ${LB_BINARY_FILESYSTEM} in
fat*|ntfs)
_BOOTLOADER="syslinux"

View File

@ -21,8 +21,7 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
if ! In_list tar "${LIVE_IMAGE_TYPE}"
then
if [ "${LIVE_IMAGE_TYPE}" != "tar" ]; then
exit 0
fi

View File

@ -64,7 +64,7 @@ case "${LIVE_IMAGE_TYPE}" in
_IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.img"
;;
net)
netboot)
_IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar*"
;;

View File

@ -31,7 +31,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
\t [--backports true|false]\n\
\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\
\t [-b|--binary-images iso|iso-hybrid|netboot|tar|hdd]\n\
\t [-b|--binary-image iso|iso-hybrid|netboot|tar|hdd]\n\
\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\
\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\
\t [--bootappend-live-failsafe PARAMETER|\"PARAMETERS\"]\n\
@ -151,7 +151,7 @@ Local_arguments ()
mirror-binary-security:,mirror-debian-installer:,
archive-areas:,parent-archive-areas:,chroot-filesystem:,
gzip-options:,image-name:,interactive:,keyring-packages:,linux-flavours:,linux-packages:,
security:,updates:,backports:,binary-filesystem:,binary-images:,
security:,updates:,backports:,binary-filesystem:,binary-image:,binary-images:,
apt-indices:,bootappend-install:,bootappend-live:,bootappend-live-failsafe:,bootloader:,bootloaders:,checksums:,compression:,config:,zsync:,build-with-chroot:,
debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:,
grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,hdd-partition-start:,iso-application:,iso-preparer:,iso-publisher:,
@ -519,7 +519,7 @@ Local_arguments ()
shift 2
;;
-b|--binary-images)
-b|--binary-image|--binary-images)
LIVE_IMAGE_TYPE="${2}"
shift 2
;;

View File

@ -73,10 +73,6 @@ case "${LIVE_IMAGE_TYPE}" in
DESTDIR="tftpboot/debian-install/${LB_ARCHITECTURES}"
;;
hdd*|tar)
DESTDIR="binary/install"
;;
*)
DESTDIR="binary/install"
;;