From 83b34cff5db624684edfa017984cb61e5bf75aaf Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 2 Mar 2021 15:45:59 +0100 Subject: [PATCH] fix: missing files and permissions --- install.inc | 43 +++++++++++++++++++++++++++++++++++++++++++ install.sh | 0 update.sh | 15 +++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 install.inc mode change 100644 => 100755 install.sh create mode 100755 update.sh diff --git a/install.inc b/install.inc new file mode 100644 index 0000000..3a49c92 --- /dev/null +++ b/install.inc @@ -0,0 +1,43 @@ +#!/bin/bash + +. maas-images.inc +. syslinux-menu.inc + +function download_version() +{ + local release_version="$1" + local drive="$2" + local target + + find_unused "$drive" + target="$unused" + if [ -z "$unused" ]; then + find_oldest "$drive" + target="$unused" + fi + if [ -z "$target" ]; then + exit 1 + fi + + downloads="$(mktemp -d)" + pushd "$downloads" + + download_and_verify "$release_version" boot-initrd + download_and_verify "$release_version" boot-kernel + download_and_verify "$release_version" squashfs + + mount_efi "$drive" + mv boot-init "$mnt"/boot-initrd."$release_version" + mv boot-kernel "$mnt"/boot-kernel."$release_version" + umount_efi + + dev_from_partnum "$drive" "$target" + dd if=squashfs of="$partition" bs=1M + rename_partition "$drive" "$target" root_"$release_version" + rm -f squashfs + popd + rmdir "$downloads" + update_syslinux_menu "$drive" +} + +# vim: set ft=sh: diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..caf0ed9 --- /dev/null +++ b/update.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. install.inc + +drive="$1" + +if [ ! -b "$drive" ]; then + echo "Usage update.sh /dev/wherever" + exit 1 +fi + +get_streams +get_latest_maas_id +download_version "$release_version" "$drive" +update_syslinux_menu "$drive"