make shellcheck happy and randomise mac address

This commit is contained in:
Sebastian Hugentobler 2021-02-09 18:47:27 +01:00
parent 4b93866392
commit 3b68da77aa
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
2 changed files with 23 additions and 7 deletions

View file

@ -28,7 +28,7 @@ cleanup_mounts() {
}
check_tools() {
for tool in ${TOOLS[@]}; do
for tool in "${TOOLS[@]}"; do
if ! command -v "$tool" &> /dev/null
then
echo "$tool could not be found"
@ -65,8 +65,12 @@ build_img() {
sudo ./mkplatformfs.sh -p "dracut lvm2 cryptsetup" -o "$platformfs_file" pinebookpro "$rootfs_file"
sudo ./mkimage.sh -B 256MiB -o "$img" "$platformfs_file"
# shellcheck disable=SC2024
# it is correct that the decompressed image is written as the unprivileged user
sudo xz --decompress --stdout "$img.xz" > "$img"
local loop_dev="$(sudo losetup --show -f -P "$img")"
local loop_dev
loop_dev="$(sudo losetup --show -f -P "$img")"
sudo mount "$loop_dev"p2 "$TMP_DIR_MOUNT"
sudo mount "$loop_dev"p1 "$TMP_DIR_MOUNT"/boot
@ -84,9 +88,9 @@ EOT
cleanup_mounts
mkdir -p "$OUT_DIR"
xz --threads=0 --compress --stdout "$img" > "$OUT_DIR/$(basename $img.xz)"
xz --threads=0 --compress --stdout "$img" > "$OUT_DIR/$(basename "$img.xz")"
echo "built pinebookpro image: $OUT_DIR/$(basename $img.xz)"
echo "built pinebookpro image: $OUT_DIR/$(basename "$img.xz")"
}
trap cleanup 0 SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM