config: tidy validation

This commit is contained in:
Lyndon Brown 2020-03-28 08:08:11 +00:00 committed by Raphaël Hertzog
parent 39572ccf3f
commit 9b70092f25
1 changed files with 20 additions and 44 deletions

View File

@ -592,26 +592,17 @@ Prepare_config ()
Validate_config () Validate_config ()
{ {
case "${LB_BINARY_FILESYSTEM}" in if [ "${LB_BINARY_FILESYSTEM}" = "ntfs" ] && [ ! $(which ntfs-3g) ]; then
ntfs) Echo_error "Using ntfs as the binary filesystem is currently only supported if ntfs-3g is installed on the host system."
if [ ! $(which ntfs-3g) ]
then
Echo_error "Using ntfs as the binary filesystem is currently only supported if ntfs-3g is installed on the host system."
exit 1
fi
;;
esac
if echo ${LB_HDD_LABEL} | grep -qs ' '
then
Echo_error "There are currently no whitespaces supported in hdd labels."
exit 1 exit 1
fi fi
if [ "${LB_DEBIAN_INSTALLER}" != "none" ] if echo ${LB_HDD_LABEL} | grep -qs ' '; then
then Echo_error "There are currently no whitespaces supported in hdd labels."
exit 1
fi
if [ "${LB_DEBIAN_INSTALLER}" != "none" ]; then
# d-i true, no caching # d-i true, no caching
if ! In_list "bootstrap" ${LB_CACHE_STAGES} || [ "${LB_CACHE}" != "true" ] || [ "${LB_CACHE_PACKAGES}" != "true" ] if ! In_list "bootstrap" ${LB_CACHE_STAGES} || [ "${LB_CACHE}" != "true" ] || [ "${LB_CACHE_PACKAGES}" != "true" ]
then then
@ -619,16 +610,11 @@ Validate_config ()
fi fi
fi fi
if [ "${LB_FIRST_BOOTLOADER}" = "syslinux" ] if [ "${LB_FIRST_BOOTLOADER}" = "syslinux" ]; then
then
# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs # syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
case "${LB_BINARY_FILESYSTEM}" in if ! In_list "${LB_BINARY_FILESYSTEM}" fat16 fat32 ntfs ext2 ext3 ext4 btrfs; then
fat*|ntfs|ext[234]|btrfs) Echo_warning "You have selected values of LB_BOOTLOADERS and LB_BINARY_FILESYSTEM which are incompatible - the syslinux family only support FAT, NTFS, ext[234] or btrfs filesystems."
;; fi
*)
Echo_warning "You have selected values of LB_BOOTLOADERS and LB_BINARY_FILESYSTEM which are incompatible - the syslinux family only support FAT, NTFS, ext[234] or btrfs filesystems."
;;
esac
fi fi
if ! In_list "${LIVE_IMAGE_TYPE}" iso iso-hybrid hdd tar netboot; then if ! In_list "${LIVE_IMAGE_TYPE}" iso iso-hybrid hdd tar netboot; then
@ -636,34 +622,24 @@ Validate_config ()
exit 1 exit 1
fi fi
case "${LIVE_IMAGE_TYPE}" in if [ "${LIVE_IMAGE_TYPE}" = "hdd" ] && [ "${LB_FIRST_BOOTLOADER}" = "grub-legacy" ]; then
hdd) 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."
case "${LB_FIRST_BOOTLOADER}" in exit 1
grub-legacy) fi
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."
exit 1
;;
esac
;;
esac
if [ "$(echo \"${LB_ISO_APPLICATION}\" | wc -c)" -gt 128 ] if [ "$(echo \"${LB_ISO_APPLICATION}\" | wc -c)" -gt 128 ]; then
then
Echo_warning "You have specified a value of LB_ISO_APPLICATION that is too long; the maximum length is 128 characters." Echo_warning "You have specified a value of LB_ISO_APPLICATION that is too long; the maximum length is 128 characters."
fi fi
if [ "$(echo \"${LB_ISO_PREPARER}\" | wc -c)" -gt 128 ] if [ "$(echo \"${LB_ISO_PREPARER}\" | wc -c)" -gt 128 ]; then
then
Echo_warning "You have specified a value of LB_ISO_PREPARER that is too long; the maximum length is 128 characters." Echo_warning "You have specified a value of LB_ISO_PREPARER that is too long; the maximum length is 128 characters."
fi fi
if [ "$(echo \"${LB_ISO_PUBLISHER}\" | wc -c)" -gt 128 ] if [ "$(echo \"${LB_ISO_PUBLISHER}\" | wc -c)" -gt 128 ]; then
then
Echo_warning "You have specified a value of LB_ISO_PUBLISHER that is too long; the maximum length is 128 characters." Echo_warning "You have specified a value of LB_ISO_PUBLISHER that is too long; the maximum length is 128 characters."
fi fi
if [ "$(eval "echo \"${LB_ISO_VOLUME}\"" | wc -c)" -gt 32 ] if [ "$(eval "echo \"${LB_ISO_VOLUME}\"" | wc -c)" -gt 32 ]; then
then
Echo_warning "You have specified a value of LB_ISO_VOLUME that is too long; the maximum length is 32 characters." Echo_warning "You have specified a value of LB_ISO_VOLUME that is too long; the maximum length is 32 characters."
fi fi