From: Michael Prokop Date: Fri, 17 Nov 2023 16:07:38 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/pr/239' X-Git-Tag: v0.105~7 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=d275bdfe5ba2b9abcf67687311110ae2dc5ac90f;hp=045542c14567842973d25800062765ef5b91e405;p=grml-debootstrap.git Merge remote-tracking branch 'origin/pr/239' --- diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml new file mode 100644 index 0000000..19ea46d --- /dev/null +++ b/.github/workflows/pr-review.yml @@ -0,0 +1,40 @@ +# PR Review workflows. +# The intention is for these to only find *new* issues. + +name: pr-review +on: + pull_request: +jobs: + + shellcheck-code: + name: shellcheck grml-debootstrap + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + path: "." + pattern: | + chroot-script + grml-debootstrap + config + tests/shellcheck-stub-debootstrap-variables + check_all_files_with_shebangs: "false" + + shellcheck-tests: + name: shellcheck test scripts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + path: "." + pattern: | + tests/* + check_all_files_with_shebangs: "false" diff --git a/Makefile b/Makefile index 8108abb..20e533b 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,6 @@ install: mkdir -p $(DESTDIR)/usr/sbin/ mkdir -p $(DESTDIR)/usr/share/zsh/vendor-completions install -m 644 config $(DESTDIR)/etc/debootstrap/ - install -m 644 devices.tar.gz $(DESTDIR)/etc/debootstrap/ install -m 644 locale.gen $(DESTDIR)/etc/debootstrap/ install -m 644 packages $(DESTDIR)/etc/debootstrap/ install -m 644 packages-arm64 $(DESTDIR)/etc/debootstrap/ diff --git a/chroot-script b/chroot-script index 2865387..1bd3abb 100755 --- a/chroot-script +++ b/chroot-script @@ -8,6 +8,7 @@ # GRML_CHROOT_SCRIPT_MARKER - do not remove this line unless you want to keep # this script as /bin/chroot-script on your new installed system ################################################################################ +# shellcheck disable=SC2317 # shellcheck has trouble understanding the code flow in this file # error_handler {{{ if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then @@ -18,9 +19,9 @@ if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then fi # }}} -# shellcheck disable=SC1091 +# shellcheck source=config . /etc/debootstrap/config || exit 1 -# shellcheck disable=SC1091 +# shellcheck source=tests/shellcheck-stub-debootstrap-variables . /etc/debootstrap/variables || exit 1 [ -r /proc/1 ] || mount -t proc none /proc @@ -101,20 +102,10 @@ chrootmirror() { fi fi - # LTS support - case "$RELEASE" in - squeeze) - if [ -n "$MIRROR" ] ; then - echo "Release matching $RELEASE - enabling LTS support in sources.list" - echo "deb $MIRROR ${RELEASE}-lts $COMPONENTS" >> /etc/apt/sources.list - fi - ;; - esac - # add security.debian.org: case "$RELEASE" in - unstable|sid|lenny) ;; # no security pool available - squeeze|wheezy|jessie|stretch|buster) + unstable|sid) ;; # no security pool available + jessie|stretch|buster) echo "Adding security.debian.org to sources.list." echo "deb http://security.debian.org ${RELEASE}/updates $COMPONENTS" >> /etc/apt/sources.list ;; @@ -324,11 +315,7 @@ get_kernel_version() { # shellcheck disable=SC2153 case "$ARCH" in i386) - case "$RELEASE" in - lenny|squeeze|wheezy) KARCH='686' ;; - # since jessie the linux-image-686 image doesn't exist any longer - *) KARCH='686-pae' ;; - esac + KARCH='686-pae' ;; amd64) KARCH='amd64' @@ -341,14 +328,15 @@ get_kernel_version() { return 1 esac - for KPREFIX in "" "2.6-" ; do # iterate through the kernel prefixes, - # currently "" and "2.6-" - if package_exists linux-image-${KPREFIX}${KARCH} ; then - echo ${KPREFIX}${KARCH} - return 0 - fi + local KPACKAGE + KPACKAGE=linux-image-"${KPREFIX}${KARCH}" + if package_exists "$KPACKAGE"; then + echo "${KPREFIX}${KARCH}" + return 0 + fi - done + echo "Expected kernel package $KPACKAGE not found" >&2 + return 1 } # install kernel packages {{{ @@ -405,6 +393,7 @@ passwords() fi if [ -n "$ROOTPASSWORD" ] ; then + # shellcheck disable=SC2086 echo root:"$ROOTPASSWORD" | chpasswd $CHPASSWD_OPTION export ROOTPASSWORD='' else @@ -427,6 +416,7 @@ passwords() a='1' b='2' else + # shellcheck disable=SC2086 echo root:"$a" | chpasswd $CHPASSWD_OPTION unset a unset b @@ -614,8 +604,10 @@ initrd() { echo "Generating initrd." if [ "$INITRD_GENERATOR" = 'dracut' ] ; then DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL dracut + # shellcheck disable=SC2086 dracut --no-hostonly --kver "$KERNELVER" --fstab --add-fstab /etc/fstab --force --reproducible $INITRD_GENERATOR_OPTS else + # shellcheck disable=SC2086 update-initramfs -c -t -k "$KERNELVER" $INITRD_GENERATOR_OPTS fi fi @@ -711,15 +703,19 @@ grub_install() { echo "Setting ${GRUB_PACKAGE} debconf configuration for install device to $GRUB" echo "${GRUB_PACKAGE} ${GRUB_PACKAGE}/install_devices multiselect ${grub_device}" | debconf-set-selections - if ! dpkg --list ${GRUB_PACKAGE} 2>/dev/null | grep -q '^ii' ; then + if ! dpkg --list "${GRUB_PACKAGE}" 2>/dev/null | grep -q '^ii' ; then echo "Notice: grub option set but no ${GRUB_PACKAGE} package, installing it therefore." - DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL ${GRUB_PACKAGE} + DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL "${GRUB_PACKAGE}" fi if ! [ -x "$(command -v grub-install)" ] ; then echo "Error: grub-install not available. (Error while installing grub package?)" >&2 return 1 fi + if ! [ -x "$(command -v update-grub)" ] ; then + echo "Error: update-grub not available. (Error while installing grub package?)" >&2 + return 1 + fi if [ -n "$SELECTED_PARTITIONS" ] ; then # using sw-raid for device in $SELECTED_PARTITIONS ; do @@ -733,40 +729,17 @@ grub_install() { done rm -f /boot/grub/device.map else - echo "Installing grub on ${GRUB}:" - case "$RELEASE" in - lenny|squeeze|wheezy) - local grub_dev - grub_dev="$(readlink -f "${GRUB}")" - if ! grub-install --no-floppy "${grub_dev}" ; then - echo "Error: failed to execute 'grub-install --no-floppy ${grub_dev}'." >&2 - exit 1 - fi - rm -f /boot/grub/device.map - ;; - *) - echo "(hd0) ${GRUB}" > /boot/grub/device.map - if ! grub-install "(hd0)" ; then - echo "Error: failed to execute 'grub-install (hd0)'." >&2 - exit 1 - fi - rm /boot/grub/device.map - ;; - esac + echo "Installing grub on ${GRUB}:" + echo "(hd0) ${GRUB}" > /boot/grub/device.map + if ! grub-install "(hd0)" ; then + echo "Error: failed to execute 'grub-install (hd0)'." >&2 + exit 1 + fi + rm /boot/grub/device.map fi echo "Adjusting grub configuration for use on ${GRUB}." - # finally install grub - if [ -x /usr/sbin/update-grub ] ; then - UPDATEGRUB='/usr/sbin/update-grub' - elif [ -x /sbin/update-grub ] ; then - UPDATEGRUB='/sbin/update-grub' - else - echo "Error: update-grub not available, can not execute it." >&2 - return 1 - fi - if [ -n "${BOOT_APPEND}" ] ; then echo "Adding BOOT_APPEND configuration ['${BOOT_APPEND}'] to /etc/default/grub." sed -i "/GRUB_CMDLINE_LINUX_DEFAULT/ s#\"\$# ${BOOT_APPEND}\"#" /etc/default/grub @@ -774,7 +747,8 @@ grub_install() { mountpoint /boot/efi &>/dev/null && umount /boot/efi - $UPDATEGRUB + # finally install grub. Existence of update-grub is checked above. + update-grub } # }}} diff --git a/config b/config index e902689..cd562e9 100644 --- a/config +++ b/config @@ -4,6 +4,7 @@ # Bug-Reports: see https://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. ################################################################################ +# shellcheck shell=sh ################################################################################ # Important: adjust this file if you want to execute grml-debootstrap @@ -72,7 +73,7 @@ # BACKPORTREPOS='yes' # Debian release that should be installed. -# Supported values: lenny, squeeze, wheezy, jessie, stretch, buster, bullseye, sid +# Supported values: jessie, stretch, buster, bullseye, sid # Default: 'bullseye' # RELEASE='bullseye' diff --git a/debian/control b/debian/control index 645c84c..15e4ce0 100644 --- a/debian/control +++ b/debian/control @@ -23,8 +23,9 @@ Vcs-Browser: https://github.com/grml/grml-debootstrap Package: grml-debootstrap Architecture: all Depends: + bash (>= 4.3-11+deb8u2), debian-archive-keyring, - debootstrap (>= 0.3.3.3) | cdebootstrap (>= 0.3.16) | mmdebstrap, + debootstrap (>= 1.0.65) | cdebootstrap (>= 0.3.16) | mmdebstrap, dosfstools, e2fsprogs, fdisk | util-linux (<< 2.29.2-3~), diff --git a/debian/grml-debootstrap.maintscript b/debian/grml-debootstrap.maintscript index a60be94..936057b 100644 --- a/debian/grml-debootstrap.maintscript +++ b/debian/grml-debootstrap.maintscript @@ -1 +1,2 @@ +rm_conffile /etc/debootstrap/devices.tar.gz 0.105~ rm_conffile /etc/zsh/completion.d/_grml-debootstrap 0.86~ diff --git a/devices.tar.gz b/devices.tar.gz deleted file mode 100644 index 0d02e40..0000000 Binary files a/devices.tar.gz and /dev/null differ diff --git a/grml-debootstrap b/grml-debootstrap index 5ee3e5a..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 \ @@ -1305,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)" @@ -1322,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)" @@ -1620,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 @@ -1809,55 +1796,53 @@ preparechroot() { touch "$CHROOT_VARIABLES" chmod 600 "$CHROOT_VARIABLES" # make sure nobody except root can read it echo "# Configuration of ${PN}" > "$CHROOT_VARIABLES" - # Resorting to sed(1) for escaping since "VAR='${VAR//\'/\'\\\'\'}'" does not work with all versions of Bash, - # e.g. not with 4.2.37(1)-release (a.k.a 4.2+dfsg-0.1+deb7u3) of Debian wheezy - [ -n "$ARCH" ] && echo "ARCH='$(sed "s,','\\\\'',g" <<<"${ARCH}")'" >> "$CHROOT_VARIABLES" - [ -n "$BACKPORTREPOS" ] && echo "BACKPORTREPOS='$(sed "s,','\\\\'',g" <<<"${BACKPORTREPOS}")'" >> "$CHROOT_VARIABLES" - [ -n "$BOOT_APPEND" ] && echo "BOOT_APPEND='$(sed "s,','\\\\'',g" <<<"${BOOT_APPEND}")'" >> "$CHROOT_VARIABLES" - [ -n "$CHROOT_SCRIPTS" ] && echo "CHROOT_SCRIPTS='$(sed "s,','\\\\'',g" <<<"${CHROOT_SCRIPTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$COMPONENTS" ] && echo "COMPONENTS='$(sed "s,','\\\\'',g" <<<"${COMPONENTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$CONFFILES" ] && echo "CONFFILES='$(sed "s,','\\\\'',g" <<<"${CONFFILES}")'" >> "$CHROOT_VARIABLES" - [ -n "$DEBCONF" ] && echo "DEBCONF='$(sed "s,','\\\\'',g" <<<"${DEBCONF}")'" >> "$CHROOT_VARIABLES" - [ -n "$DEBIAN_FRONTEND" ] && echo "DEBIAN_FRONTEND='$(sed "s,','\\\\'',g" <<<"${DEBIAN_FRONTEND}")'" >> "$CHROOT_VARIABLES" - [ -n "$DEBOOTSTRAP" ] && echo "DEBOOTSTRAP='$(sed "s,','\\\\'',g" <<<"${DEBOOTSTRAP}")'" >> "$CHROOT_VARIABLES" - [ -n "$DEFAULT_LOCALES" ] && echo "DEFAULT_LOCALES='$(sed "s,','\\\\'',g" <<<"${DEFAULT_LOCALES}")'" >> "$CHROOT_VARIABLES" - [ -n "$DEFAULT_LANGUAGE" ] && echo "DEFAULT_LANGUAGE='$(sed "s,','\\\\'',g" <<<"${DEFAULT_LANGUAGE}")'" >> "$CHROOT_VARIABLES" - [ -n "$EXTRAPACKAGES" ] && echo "EXTRAPACKAGES='$(sed "s,','\\\\'',g" <<<"${EXTRAPACKAGES}")'" >> "$CHROOT_VARIABLES" - [ -n "$EFI" ] && echo "EFI='$(sed "s,','\\\\'',g" <<<"${EFI}")'" >> "$CHROOT_VARIABLES" - [ -n "$FALLBACK_MIRROR" ] && echo "FALLBACK_MIRROR='$(sed "s,','\\\\'',g" <<<"${FALLBACK_MIRROR}")'" >> "$CHROOT_VARIABLES" - [ -n "$FILESYSTEM" ] && echo "FILESYSTEM='$(sed "s,','\\\\'',g" <<<"${FILESYSTEM}")'" >> "$CHROOT_VARIABLES" - [ -n "$FORCE" ] && echo "FORCE='$(sed "s,','\\\\'',g" <<<"${FORCE}")'" >> "$CHROOT_VARIABLES" - [ -n "$GRMLREPOS" ] && echo "GRMLREPOS='$(sed "s,','\\\\'',g" <<<"${GRMLREPOS}")'" >> "$CHROOT_VARIABLES" - [ -n "$GRUB" ] && echo "GRUB='$(sed "s,','\\\\'',g" <<<"${GRUB}")'" >> "$CHROOT_VARIABLES" - [ -n "$HOSTNAME" ] && echo "HOSTNAME='$(sed "s,','\\\\'',g" <<<"${HOSTNAME}")'" >> "$CHROOT_VARIABLES" - [ -n "$INITRD" ] && echo "INITRD='$(sed "s,','\\\\'',g" <<<"${INITRD}")'" >> "$CHROOT_VARIABLES" - [ -n "$INITRD_GENERATOR" ] && echo "INITRD_GENERATOR='$(sed "s,','\\\\'',g" <<<"${INITRD_GENERATOR}")'" >> "$CHROOT_VARIABLES" - [ -n "$INITRD_GENERATOR_OPTS" ] && echo "INITRD_GENERATOR_OPTS='$(sed "s,','\\\\'',g" <<<"${INITRD_GENERATOR_OPTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$INSTALL_NOTES" ] && echo "INSTALL_NOTES='$(sed "s,','\\\\'',g" <<<"${INSTALL_NOTES}")'" >> "$CHROOT_VARIABLES" - [ -n "$ISODIR" ] && echo "ISODIR='$(sed "s,','\\\\'',g" <<<"${ISO}")'" >> "$CHROOT_VARIABLES" - [ -n "$ISO" ] && echo "ISO='$(sed "s,','\\\\'',g" <<<"${ISO}")'" >> "$CHROOT_VARIABLES" - [ -n "$KEEP_SRC_LIST" ] && echo "KEEP_SRC_LIST='$(sed "s,','\\\\'',g" <<<"${KEEP_SRC_LIST}")'" >> "$CHROOT_VARIABLES" - [ -n "$LOCALES" ] && echo "LOCALES='$(sed "s,','\\\\'',g" <<<"${LOCALES}")'" >> "$CHROOT_VARIABLES" - [ -n "$MIRROR" ] && echo "MIRROR='$(sed "s,','\\\\'',g" <<<"${MIRROR}")'" >> "$CHROOT_VARIABLES" - [ -n "$MKFS" ] && echo "MKFS='$(sed "s,','\\\\'',g" <<<"${MKFS}")'" >> "$CHROOT_VARIABLES" - [ -n "$NOPASSWORD" ] && echo "NOPASSWORD=\"true\"" >> "$CHROOT_VARIABLES" - [ -n "$NOKERNEL" ] && echo "NOKERNEL=\"true\"" >> "$CHROOT_VARIABLES" - [ -n "$PACKAGES" ] && echo "PACKAGES='$(sed "s,','\\\\'',g" <<<"${PACKAGES}")'" >> "$CHROOT_VARIABLES" - [ -n "$POST_SCRIPTS" ] && echo "POST_SCRIPTS='$(sed "s,','\\\\'',g" <<<"${POST_SCRIPTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$PRE_SCRIPTS" ] && echo "PRE_SCRIPTS='$(sed "s,','\\\\'',g" <<<"${PRE_SCRIPTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$RECONFIGURE" ] && echo "RECONFIGURE='$(sed "s,','\\\\'',g" <<<"${RECONFIGURE}")'" >> "$CHROOT_VARIABLES" - [ -n "$RELEASE" ] && echo "RELEASE='$(sed "s,','\\\\'',g" <<<"${RELEASE}")'" >> "$CHROOT_VARIABLES" - [ -n "$RM_APTCACHE" ] && echo "RM_APTCACHE='$(sed "s,','\\\\'',g" <<<"${RM_APTCACHE}")'" >> "$CHROOT_VARIABLES" - [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD='$(sed "s,','\\\\'',g" <<<"${ROOTPASSWORD}")'" >> "$CHROOT_VARIABLES" - [ -n "$SCRIPTS" ] && echo "SCRIPTS='$(sed "s,','\\\\'',g" <<<"${SCRIPTS}")'" >> "$CHROOT_VARIABLES" - [ -n "$SECURE" ] && echo "SECURE='$(sed "s,','\\\\'',g" <<<"${SECURE}")'" >> "$CHROOT_VARIABLES" - [ -n "$SELECTED_PARTITIONS" ] && echo "SELECTED_PARTITIONS='$(sed "s,','\\\\'',g" <<<"${SELECTED_PARTITIONS}")'" >> "$CHROOT_VARIABLES" - [ -n "$TARGET" ] && echo "TARGET='$(sed "s,','\\\\'',g" <<<"${TARGET}")'" >> "$CHROOT_VARIABLES" - [ -n "$UPGRADE_SYSTEM" ] && echo "UPGRADE_SYSTEM='$(sed "s,','\\\\'',g" <<<"${UPGRADE_SYSTEM}")'" >> "$CHROOT_VARIABLES" - [ -n "$TARGET_UUID" ] && echo "TARGET_UUID='$(sed "s,','\\\\'',g" <<<"${TARGET_UUID}")'" >> "$CHROOT_VARIABLES" - [ -n "$TIMEZONE" ] && echo "TIMEZONE='$(sed "s,','\\\\'',g" <<<"${TIMEZONE}")'" >> "$CHROOT_VARIABLES" - [ -n "$TUNE2FS" ] && echo "TUNE2FS='$(sed "s,','\\\\'',g" <<<"${TUNE2FS}")'" >> "$CHROOT_VARIABLES" - [ -n "$VMSIZE" ] && echo "VMSIZE='$(sed "s,','\\\\'',g" <<<"${VMSIZE}")'" >> "$CHROOT_VARIABLES" + [ -n "$ARCH" ] && echo "ARCH='${ARCH//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$BACKPORTREPOS" ] && echo "BACKPORTREPOS='${BACKPORTREPOS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$BOOT_APPEND" ] && echo "BOOT_APPEND='${BOOT_APPEND//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$CHROOT_SCRIPTS" ] && echo "CHROOT_SCRIPTS='${CHROOT_SCRIPTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$COMPONENTS" ] && echo "COMPONENTS='${COMPONENTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$CONFFILES" ] && echo "CONFFILES='${CONFFILES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$DEBCONF" ] && echo "DEBCONF='${DEBCONF//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$DEBIAN_FRONTEND" ] && echo "DEBIAN_FRONTEND='${DEBIAN_FRONTEND//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$DEBOOTSTRAP" ] && echo "DEBOOTSTRAP='${DEBOOTSTRAP//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$DEFAULT_LOCALES" ] && echo "DEFAULT_LOCALES='${DEFAULT_LOCALES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$DEFAULT_LANGUAGE" ] && echo "DEFAULT_LANGUAGE='${DEFAULT_LANGUAGE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$EXTRAPACKAGES" ] && echo "EXTRAPACKAGES='${EXTRAPACKAGES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$EFI" ] && echo "EFI='${EFI//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$FALLBACK_MIRROR" ] && echo "FALLBACK_MIRROR='${FALLBACK_MIRROR//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$FILESYSTEM" ] && echo "FILESYSTEM='${FILESYSTEM//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$FORCE" ] && echo "FORCE='${FORCE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$GRMLREPOS" ] && echo "GRMLREPOS='${GRMLREPOS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$GRUB" ] && echo "GRUB='${GRUB//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$HOSTNAME" ] && echo "HOSTNAME='${HOSTNAME//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$INITRD" ] && echo "INITRD='${INITRD//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$INITRD_GENERATOR" ] && echo "INITRD_GENERATOR='${INITRD_GENERATOR//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$INITRD_GENERATOR_OPTS" ] && echo "INITRD_GENERATOR_OPTS='${INITRD_GENERATOR_OPTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$INSTALL_NOTES" ] && echo "INSTALL_NOTES='${INSTALL_NOTES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$ISODIR" ] && echo "ISODIR='${ISO//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$ISO" ] && echo "ISO='${ISO//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$KEEP_SRC_LIST" ] && echo "KEEP_SRC_LIST='${KEEP_SRC_LIST//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$LOCALES" ] && echo "LOCALES='${LOCALES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$MIRROR" ] && echo "MIRROR='${MIRROR//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$MKFS" ] && echo "MKFS='${MKFS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$NOPASSWORD" ] && echo "NOPASSWORD=\"true\"" >> "$CHROOT_VARIABLES" + [ -n "$NOKERNEL" ] && echo "NOKERNEL=\"true\"" >> "$CHROOT_VARIABLES" + [ -n "$PACKAGES" ] && echo "PACKAGES='${PACKAGES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$POST_SCRIPTS" ] && echo "POST_SCRIPTS='${POST_SCRIPTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$PRE_SCRIPTS" ] && echo "PRE_SCRIPTS='${PRE_SCRIPTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$RECONFIGURE" ] && echo "RECONFIGURE='${RECONFIGURE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$RELEASE" ] && echo "RELEASE='${RELEASE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$RM_APTCACHE" ] && echo "RM_APTCACHE='${RM_APTCACHE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD='${ROOTPASSWORD//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$SCRIPTS" ] && echo "SCRIPTS='${SCRIPTS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$SECURE" ] && echo "SECURE='${SECURE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$SELECTED_PARTITIONS" ] && echo "SELECTED_PARTITIONS='${SELECTED_PARTITIONS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$TARGET" ] && echo "TARGET='${TARGET//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$UPGRADE_SYSTEM" ] && echo "UPGRADE_SYSTEM='${UPGRADE_SYSTEM//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$TARGET_UUID" ] && echo "TARGET_UUID='${TARGET_UUID//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$TIMEZONE" ] && echo "TIMEZONE='${TIMEZONE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$TUNE2FS" ] && echo "TUNE2FS='${TUNE2FS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" + [ -n "$VMSIZE" ] && echo "VMSIZE='${VMSIZE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script chmod 755 "${MNTPOINT}"/bin/chroot-script @@ -1910,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/ @@ -1968,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" @@ -1983,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 diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index 890287d..457d4b4 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -218,8 +218,8 @@ Options and environment variables *-r*, *--release* _releasename_:: - Specify release of new Debian system. Supported releases names: lenny, - squeeze, wheezy, jessie, stretch, buster, bullseye, bookworm and sid. + Specify release of new Debian system. Supported releases names: + jessie, stretch, buster, bullseye, bookworm and sid. Corresponding with configuration variable RELEASE. Default release: bookworm *--remove-configs*:: @@ -410,7 +410,7 @@ Where do you want to install grub to? Usage example: grub=/dev/sda release=... Specify release of new Debian system. Defaults to Debian bookworm. -Supported releases: lenny, squeeze, wheezy, jessie, stretch, buster, bullseye, bookworm and sid. +Supported releases: jessie, stretch, buster, bullseye, bookworm and sid. Usage example: release=bullseye mirror=... @@ -445,11 +445,12 @@ Supported Releases include::releasetable.txt[] [NOTE] -.lenny/squeeze/wheezy/jessie/stretch/buster release +.jessie/stretch/buster release ================================================================================ -[1] Please notice that releases like lenny, squeeze, wheezy, jessie, stretch and buster are unsupported releases within Debian nowadays. -grml-debootstrap can handle the releases but you really should not use them -anymore unless you really know what you are doing. +[1] Please notice that releases like jessie, stretch and buster are unsupported releases within Debian nowadays. +grml-debootstrap can handle the releases but you really should not use them anymore unless you really know what you are doing. +Even older versions are also entirely unsupported by grml-debootstrap. + Choose the current Debian stable version instead. See https://wiki.debian.org/DebianReleases for the list of supported releases. @@ -463,26 +464,6 @@ throwing segfaults during debootstrap. This can be identified by the following m dpkg[...]: segfault at [...] To work around this issue boot your system with the kernel boot option 'vsyscall=emulate'. - -You also need to specify a filesystem that's supported by lenny, e.g. -'--filesystem ext3' since grml-debootstrap's current default (ext4) isn't -supported by lenny. - -Also when debootstrapping lenny on a live system with a kernel version -like "3.16-1-grml-amd64" lenny's libc will fail to install with: - - [...] - /var/lib/dpkg/tmp.ci/preinst: line 265: [: 3.16-1-grml-amd64: integery expression expected - /var/lib/dpkg/tmp.ci/preinst: line 231: 3.16-1-grml-amd64: syntax error: invalid arithemtic operator (error token is ".16-1-grml-amd64") - dpkg: error processing /var/cache/apt/archives/libc6_2.7-18lenny7_amd64.deb (--install): - [....] - -To workaround this either debootstrap from a system with an according -kernel version or use the "fake uname" workaround (just google for it). - -When installing lenny to a new mdraid, grml-debootstrap will use md metadata -format version 0.90. This limits the device to a maximum size of 2TB, but has -the advantage of grub-legacy actually being able to boot from it. ================================================================================ [NOTE] diff --git a/packer/Makefile b/packer/Makefile index 27f91b0..8a79a1e 100644 --- a/packer/Makefile +++ b/packer/Makefile @@ -45,17 +45,5 @@ stretch: clean fake-uname.so install jessie: clean fake-uname.so install packer build -var debian_version=$@ -var grml_debootstrap_version=$(GRML_DEBOOTSTRAP_VERSION) -var grml_debootstrap_local_path=$(GRML_DEBOOTSTRAP_LOCAL_PATH) debian64.json -# Debian 7 -wheezy: clean fake-uname.so install - packer build -var debian_version=$@ -var grml_debootstrap_version=$(GRML_DEBOOTSTRAP_VERSION) -var grml_debootstrap_local_path=$(GRML_DEBOOTSTRAP_LOCAL_PATH) debian64.json - -# Debian 6.0 -squeeze: clean fake-uname.so install - packer build -var debian_version=$@ -var grml_debootstrap_version=$(GRML_DEBOOTSTRAP_VERSION) -var grml_debootstrap_local_path=$(GRML_DEBOOTSTRAP_LOCAL_PATH) debian64.json - -# Debian 5.0 -lenny: clean fake-uname.so install - packer build -var debian_version=$@ -var grml_debootstrap_version=$(GRML_DEBOOTSTRAP_VERSION) -var grml_debootstrap_local_path=$(GRML_DEBOOTSTRAP_LOCAL_PATH) debian64.json - -.PHONY: compile bullseye buster stretch jessie wheezy squeeze lenny +.PHONY: compile bullseye buster stretch jessie .NOTPARALLEL: diff --git a/packer/debian64_provision.sh b/packer/debian64_provision.sh index d170554..480df1c 100644 --- a/packer/debian64_provision.sh +++ b/packer/debian64_provision.sh @@ -32,13 +32,6 @@ trap 'bailout ${LINENO} $?' ERR ## helper functions virtualbox_setup() { - case "$DEBIAN_VERSION" in - lenny) - echo "* Debian lenny doesn't support Virtualbox Guest Additions, skipping." - return 0 - ;; - esac - if ! mountpoint "${TARGET}" &>/dev/null ; then echo "* Mounting target system" mount "${INSTALL_TARGET}" "${TARGET}" @@ -115,12 +108,8 @@ vagrant_setup() { chroot ${TARGET} chown vagrant:vagrant /home/vagrant/.ssh /home/vagrant/.ssh/authorized_keys echo "* Setting up sudo configuration for user vagrant" - if ! [ -d "${TARGET}/etc/sudoers.d" ] ; then # lenny: - echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> "${TARGET}/etc/sudoers" - else # wheezy and newer: - echo "vagrant ALL=(ALL) NOPASSWD: ALL" > "${TARGET}/etc/sudoers.d/vagrant" - chmod 0440 "${TARGET}/etc/sudoers.d/vagrant" - fi + echo "vagrant ALL=(ALL) NOPASSWD: ALL" > "${TARGET}/etc/sudoers.d/vagrant" + chmod 0440 "${TARGET}/etc/sudoers.d/vagrant" host="$(cat ${TARGET}/etc/hostname)" if ! grep -q "${host}$" "${TARGET}"/etc/hosts ; then @@ -203,30 +192,9 @@ EOF fi } -verify_debootstrap_version() { - local required_version=1.0.65 - local present_version=$(dpkg-query --show --showformat='${Version}' debootstrap) - - if dpkg --compare-versions $present_version lt $required_version ; then - echo "** debootstrap version $present_version is older than minimum required version $required_version - upgrading." - apt-get update - apt-get -y install debootstrap - fi -} - grml_debootstrap_execution() { echo "* Installing Debian" - # release specific stuff - case "$DEBIAN_VERSION" in - lenny) - GRML_DEB_OPTIONS="--mirror http://archive.debian.org/debian/ --filesystem ext3" - ;; - stretch) - verify_debootstrap_version - ;; - esac - echo "** Executing: $GRML_DEBOOTSTRAP --hostname $DEBIAN_VERSION --release $DEBIAN_VERSION --target ${INSTALL_TARGET} --grub ${GRUB_TARGET} --password grml --force $GRML_DEB_OPTIONS" | tee -a /tmp/grml-debootstrap.log $GRML_DEBOOTSTRAP --hostname "${DEBIAN_VERSION}" --release "${DEBIAN_VERSION}" --target "${INSTALL_TARGET}" --grub "${GRUB_TARGET}" --password grml --force $GRML_DEB_OPTIONS 2>&1 | tee -a /tmp/grml-debootstrap.log } diff --git a/releasetable.txt b/releasetable.txt index 2b65e6f..d085c86 100644 --- a/releasetable.txt +++ b/releasetable.txt @@ -2,9 +2,6 @@ [width="40%",frame="topbot",options="header"] |====================== |Release |Status -|lenny |works[1] -|squeeze |works[1] -|wheezy |works[1] |jessie |works[1] |stretch |works[1] |buster |works[1] diff --git a/tests/shellcheck-stub-debootstrap-variables b/tests/shellcheck-stub-debootstrap-variables new file mode 100644 index 0000000..8fd7606 --- /dev/null +++ b/tests/shellcheck-stub-debootstrap-variables @@ -0,0 +1,7 @@ +# Stub data file for shellcheck runs. +# shellcheck shell=sh +# shellcheck disable=SC2034 # The point of our whole existence is to conflict with SC2034. + +# ARCH is defaulted in grml-debootstrap, so it is never empty. +ARCH=amd64 +