X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=grml-debootstrap;h=0489c52228223913c421bad9d2efa15905427df0;hb=52965f9002cfe576bb694bfc96cf5a69e07a1e22;hp=4b04e00a7dbe12eb4b37c6295f68be6608bee7dd;hpb=1f6141f32134e1d04db366988dae9350454c2b69;p=grml-debootstrap.git diff --git a/grml-debootstrap b/grml-debootstrap index 4b04e00..0489c52 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -5,6 +5,7 @@ # Bug-Reports: see https://grml.org/bugs/ # License: This file is licensed under the GPL v2+ ################################################################################ +# shellcheck disable=SC2001,SC2181 # error_handler {{{ [ -n "$REPORT_TRAP_ERR" ] || REPORT_TRAP_ERR='no' @@ -42,7 +43,7 @@ fi # variables {{{ PN="$(basename "$0")" if [[ -d "$(dirname "$(command -v "$0")")"/.git ]]; then - VERSION="$(git --git-dir $(dirname "$(command -v "$0")")/.git describe | sed 's|^v||')" + VERSION="$(git --git-dir "$(dirname "$(command -v "$0")")"/.git describe | sed 's|^v||')" else VERSION="$(dpkg-query --show --showformat='${Version}' "$PN")" fi @@ -601,7 +602,7 @@ done [ "$_opt_contrib" ] && COMPONENTS="$COMPONENTS contrib" case "${RELEASE}" in - lenny|squeeze|wheezy|jessie|stretch|buster|bullseye) + jessie|stretch|buster|bullseye) [ "$_opt_non_free" ] && COMPONENTS="$COMPONENTS non-free" ;; *) @@ -926,16 +927,10 @@ while IFS= read -r i; do NUM_PARTITIONS=$(( NUM_PARTITIONS + 1 )) done < "$TMPFILE" -# force metadata version 0.90 for lenny so old grub can boot from this array. -METADATA_VERSION="" -if [ "$RELEASE" = "lenny" ]; then - METADATA_VERSION="-e0" -fi - ERRORFILE=$(mktemp) # shellcheck disable=SC2086 yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \ - --raid-devices="${NUM_PARTITIONS}" ${METADATA_VERSION} ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE + --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE RC=$? if [ "$RC" = 0 ] ; then dialog --title "$PN" --msgbox \ @@ -1034,14 +1029,16 @@ efi_support() { checkconfiguration() { -if efi_support ; then - if [ -z "$_opt_efi" ] ; then - ewarn "EFI support detected but no --efi option given, please consider enabling it." - fi -else - if [ -n "$_opt_efi" ] ; then - eerror "EFI option used but no EFI support detected." - bailout 1 +if [ -z "$VIRTUAL" ] ; then + if efi_support ; then + if [ -z "$_opt_efi" ] ; then + ewarn "EFI support detected but no --efi option given, please consider enabling it." + fi + else + if [ -n "$_opt_efi" ] ; then + eerror "EFI option used but no EFI support detected." + bailout 1 + fi fi fi @@ -1303,7 +1300,7 @@ mkfs() { # so disable this feature for older Debian releases where it's known to be unsupported if [ -n "$MKFS" ] && [ "$MKFS" = "mkfs.ext4" ] ; then case "$RELEASE" in - lenny|squeeze|wheezy|jessie) + jessie) # assume a more recent version if we can't identify the version via dpkg-query local e2fsprogs_version e2fsprogs_version="$(dpkg-query --show --showformat='${Version}' e2fsprogs 2>/dev/null || echo 1.44)" @@ -1320,7 +1317,7 @@ mkfs() { # Disable this feature for Debian releases older than bookworm if [ -n "$MKFS" ] && [ "$MKFS" = "mkfs.ext4" ] ; then case "$RELEASE" in - lenny|squeeze|wheezy|jessie|stretch|buster|bullseye) + jessie|stretch|buster|bullseye) local e2fsprogs_version # assume a more recent version if we can't identify the version via dpkg-query e2fsprogs_version="$(dpkg-query --show --showformat='${Version}' e2fsprogs 2>/dev/null || echo 1.47)" @@ -1618,15 +1615,7 @@ grub_install() { eerror "Error: grub not installed inside Virtual Machine. Can not install bootloader." ; eend 1 bailout 1 fi - - case "$RELEASE" in - lenny|squeeze|wheezy) - cp "${MNTPOINT}"/usr/lib/grub/i386-pc/* "${MNTPOINT}/boot/grub/" - ;; - *) - cp -a "${MNTPOINT}"/usr/lib/grub/i386-pc "${MNTPOINT}/boot/grub/" - ;; - esac + cp -a "${MNTPOINT}"/usr/lib/grub/i386-pc "${MNTPOINT}/boot/grub/" if [ -n "$VMEFI" ]; then @@ -1906,9 +1895,6 @@ preparechroot() { # setup default locales [ -n "$LOCALES" ] && cp $VERBOSE "${CONFFILES}"/locale.gen "${MNTPOINT}"/etc/locale.gen - # MAKEDEV is just a forking bomb crap, let's do it on our own instead :) - ( cd "${MNTPOINT}"/dev && tar zxf /etc/debootstrap/devices.tar.gz ) - # copy any existing files to chroot [ -d "${CONFFILES}"/bin ] && cp $VERBOSE -a -L "${CONFFILES}"/bin/* "${MNTPOINT}"/bin/ [ -d "${CONFFILES}"/boot ] && cp $VERBOSE -a -L "${CONFFILES}"/boot/* "${MNTPOINT}"/boot/ @@ -1964,11 +1950,13 @@ iface ${interface} inet dhcp einfo "Installing default /etc/network/interfaces as requested via --defaultinterfaces options." mkdir -p "${MNTPOINT}/etc/network" echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + # shellcheck disable=SC2320 eend $? elif [ -n "$VIRTUAL" ] ; then einfo "Setting up Virtual Machine, installing default /etc/network/interfaces" mkdir -p "${MNTPOINT}/etc/network" echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + # shellcheck disable=SC2320 eend $? elif [ -r /etc/network/interfaces ] ; then einfo "Copying /etc/network/interfaces from host to target system" @@ -1979,6 +1967,7 @@ iface ${interface} inet dhcp ewarn "Couldn't read /etc/network/interfaces, installing default /etc/network/interfaces" mkdir -p "${MNTPOINT}/etc/network" echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + # shellcheck disable=SC2320 eend $? fi