From 59cfdbf892338a4cedb84afde7968a16b8b82973 Mon Sep 17 00:00:00 2001 From: Koen Vervloesem Date: Mon, 25 Jul 2022 13:19:36 +0200 Subject: [PATCH] Fix shellscripts and use sudo for snap --- .github/workflows/build.yml | 2 +- scripts/build-images.sh | 34 ++++++++++++++++---------------- scripts/sign-model-assertions.sh | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd0c383..7018550 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,6 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Install ubuntu-image - run: snap install ubuntu-image --classic + run: sudo snap install ubuntu-image --classic - name: Build images run: ./scripts/build-images.sh diff --git a/scripts/build-images.sh b/scripts/build-images.sh index 83b60b0..3474939 100755 --- a/scripts/build-images.sh +++ b/scripts/build-images.sh @@ -9,24 +9,24 @@ rm -rf "$build_dir" mkdir "$build_dir" for model_assertion in *.model; do - echo "Building image for model assertion $model_assertion..." - ubuntu-image snap "$model_assertion" --output-dir="$build_dir" --validation=enforce - if [[ -f "$build_dir/pi.img" ]]; then - image_file=pi.img - elif [[ -f "$build_dir/pc.img" ]]; then - image_file=pc.img - else - echo "No suitable image file found" - exit 1 - fi + echo "Building image for model assertion $model_assertion..." + ubuntu-image snap "$model_assertion" --output-dir="$build_dir" --validation=enforce + if [[ -f "$build_dir/pi.img" ]]; then + image_file=pi.img + elif [[ -f "$build_dir/pc.img" ]]; then + image_file=pc.img + else + echo "No suitable image file found" + exit 1 + fi - compressed_image_file="$build_dir/${model_assertion%.model}.img.xz" - manifest_file="$build_dir/${model_assertion%.model}.manifest" + compressed_image_file="$build_dir/${model_assertion%.model}.img.xz" + manifest_file="$build_dir/${model_assertion%.model}.manifest" - echo "Compressing image to $compressed_image_file..." - xz -9 "$build_dir/$image_file" - mv "$build_dir/$image_file.xz" "$compressed_image_file" + echo "Compressing image to $compressed_image_file..." + xz -9 "$build_dir/$image_file" + mv "$build_dir/$image_file.xz" "$compressed_image_file" - echo "Saving seed manifest to $manifest_file" - mv "$build_dir/seed.manifest" "$manifest_file" + echo "Saving seed manifest to $manifest_file" + mv "$build_dir/seed.manifest" "$manifest_file" done diff --git a/scripts/sign-model-assertions.sh b/scripts/sign-model-assertions.sh index dce93b4..994b588 100755 --- a/scripts/sign-model-assertions.sh +++ b/scripts/sign-model-assertions.sh @@ -2,12 +2,12 @@ set -e if [ $# -eq 0 ]; then - echo "Specify your snapcraft key to sign the assertion model with" - exit 1 + echo "Specify your snapcraft key to sign the assertion model with" + exit 1 fi signing_key=$1 for model_assertion in *.json; do - snap sign -k "$signing_key" < "$model_assertion" > "${model_assertion%.json}.model" + snap sign -k "$signing_key" <"$model_assertion" >"${model_assertion%.json}.model" done