bug fix
[automated-distro-installer] / mk-basefile-big
index 873b7ffb24be2b76aa1c297b7fb7f8f057c69541..1a6b6a99bc70dc28b12b157a34967c11ab7c0a7d 100755 (executable)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
-[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
+[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
 
 
+set -e; . /usr/local/lib/bash-bear; set +e
 
 
-x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
-x="$(readlink -f -- "$BASH_SOURCE")"; PATH="${x%/*}:$PATH" # directory of this file
+this_file="$(readlink -f -- "${BASH_SOURCE[0]}")"
+readonly this_file this_dir="${this_file%/*}"
+PATH="$this_dir:$PATH" # directory of this file
 
 usage() {
   cat <<EOF
 
 usage() {
   cat <<EOF
@@ -45,7 +47,7 @@ EOF
   exit $1
 }
 
   exit $1
 }
 
-read distver <<<"$@"
+read -r distver <<<"$@"
 
 if [[ $# != 1 ]]; then
   echo "$0: error: expected one argument"
 
 if [[ $# != 1 ]]; then
   echo "$0: error: expected one argument"
@@ -87,11 +89,12 @@ sed -i 's/^LOGUSER=/#LOGUSER=/' /etc/fai/fai.conf
 # config umount required after a failed run, proc umount always required
 umount /var/lib/fai/config ||: ; umount -R $t/proc ||:
 
 # config umount required after a failed run, proc umount always required
 umount /var/lib/fai/config ||: ; umount -R $t/proc ||:
 
-fai-redep faiserver $distro
+fai-redep faiserver.b8.nz $distro
 echo "echo $classes" > /srv/fai/config/class/51-multi-boot
 
 rm -rf $t; mkdir -p $t
 
 echo "echo $classes" > /srv/fai/config/class/51-multi-boot
 
 rm -rf $t; mkdir -p $t
 
+# shellcheck disable=SC1007 # intentional
 LANG= fai -N -u hostname_does_not_matter dirinstall $t
 
 # Turn a dirinstall into a basefile. taken from mk-basefile
 LANG= fai -N -u hostname_does_not_matter dirinstall $t
 
 # Turn a dirinstall into a basefile. taken from mk-basefile
@@ -100,7 +103,7 @@ rm -f $t/etc/hostname $t/etc/resolv.conf \
    $t/var/lib/apt/lists/*_* $t/usr/bin/qemu-*-static \
    $t/etc/udev/rules.d/70-persistent-net.rules
 echo | dd of=$t/etc/machine-id
    $t/var/lib/apt/lists/*_* $t/usr/bin/qemu-*-static \
    $t/etc/udev/rules.d/70-persistent-net.rules
 echo | dd of=$t/etc/machine-id
-tar --one-file-system -C $t -cf - . | gzip > /a/bin/fai-basefiles/basefiles/${distver^^}64BIG.tar.gz
+tar --one-file-system -C $t -cf - . | zstd -9 > /a/bin/fai-basefiles/basefiles/${distver^^}64BIG.tar.zst
 
 
 cleanup
 
 
 cleanup