From 922eccba4250ec133df0284977dd1e702bf3141e Mon Sep 17 00:00:00 2001 From: ading2210 Date: Thu, 25 Jan 2024 21:19:25 +0000 Subject: [PATCH] github actions related fixes --- .github/workflows/build-rootfs.yaml | 8 +++++++- build.sh | 6 +++--- build_complete.sh | 6 +++--- build_squashfs.sh | 6 +++--- image_utils.sh | 16 ++++++++-------- patch_rootfs.sh | 16 ++++++++-------- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-rootfs.yaml b/.github/workflows/build-rootfs.yaml index 4bd8f92..0667baa 100644 --- a/.github/workflows/build-rootfs.yaml +++ b/.github/workflows/build-rootfs.yaml @@ -1,6 +1,12 @@ name: build-rootfs run-name: Build the base Debian rootfs on: [push] + +defaults: + run: + shell: bash + working-directory: ./ + jobs: main: runs-on: ubuntu-latest @@ -17,7 +23,7 @@ jobs: run: sudo DEBUG=1 ./build_rootfs.sh data/rootfs bookworm hostname=shimboot root_passwd=root username=user user_passwd=user - name: archive rootfs - run: tar -vcf data/rootfs.tar.gz -C data/rootfs ./ + run: sudo tar -vcf data/rootfs.tar.gz -C data/rootfs ./ - name: upload rootfs uses: actions/upload-artifact@v4 diff --git a/build.sh b/build.sh index ed42cf0..dc7b4cf 100755 --- a/build.sh +++ b/build.sh @@ -27,9 +27,9 @@ fi . ./common.sh assert_deps "cpio binwalk pcregrep realpath cgpt mkfs.ext4 mkfs.ext2 fdisk rsync" -output_path=$(realpath "${1}") -shim_path=$(realpath "${2}") -rootfs_dir=$(realpath "${3}") +output_path=$(realpath -m "${1}") +shim_path=$(realpath -m "${2}") +rootfs_dir=$(realpath -m "${3}") echo "created loop device for shim" shim_loop=$(create_loop "${shim_path}") diff --git a/build_complete.sh b/build_complete.sh index 3c1f41e..2220268 100755 --- a/build_complete.sh +++ b/build_complete.sh @@ -41,7 +41,7 @@ sigint_handler() { } trap sigint_handler SIGINT -base_dir="$(realpath $(dirname "$0"))" +base_dir="$(realpath -m $(dirname "$0"))" board="$1" shim_url="https://dl.osu.bio/api/raw/?path=/SH1mmer/$board.zip" boards_url="https://chromiumdash.appspot.com/cros/fetch_serving_builds?deviceCategory=ChromeOS" @@ -90,7 +90,7 @@ echo "downloading shim image" download_and_unzip $shim_url $shim_zip $shim_bin if [ ! "${args['rootfs_dir']}" ]; then - rootfs_dir="$(realpath data/rootfs_$board)" + rootfs_dir="$(realpath -m data/rootfs_$board)" rm -rf $rootfs_dir mkdir -p $rootfs_dir @@ -101,7 +101,7 @@ if [ ! "${args['rootfs_dir']}" ]; then username=user \ user_passwd=user else - rootfs_dir="$(realpath "${args['rootfs_dir']}")" + rootfs_dir="$(realpath -m "${args['rootfs_dir']}")" fi echo "patching debian rootfs" diff --git a/build_squashfs.sh b/build_squashfs.sh index e3a7d6b..2efab18 100755 --- a/build_squashfs.sh +++ b/build_squashfs.sh @@ -47,9 +47,9 @@ compile_unionfs() { cd $original_dir } -rootfs_dir=$(realpath $1) -old_dir=$(realpath $2) -shim_path=$(realpath $3) +rootfs_dir=$(realpath -m $1) +old_dir=$(realpath -m $2) +shim_path=$(realpath -m $3) shim_rootfs="/tmp/shim_rootfs" root_squashfs="$rootfs_dir/root.squashfs" diff --git a/image_utils.sh b/image_utils.sh index 76b0122..5f5f9a0 100755 --- a/image_utils.sh +++ b/image_utils.sh @@ -17,7 +17,7 @@ make_bootable() { } partition_disk() { - local image_path=$(realpath "${1}") + local image_path=$(realpath -m "${1}") local bootloader_size=${2} #create partition table with fdisk @@ -72,8 +72,8 @@ safe_mount() { } create_partitions() { - local image_loop=$(realpath "${1}") - local kernel_path=$(realpath "${2}") + local image_loop=$(realpath -m "${1}") + local kernel_path=$(realpath -m "${2}") #create stateful mkfs.ext4 "${image_loop}p1" @@ -87,9 +87,9 @@ create_partitions() { } populate_partitions() { - local image_loop=$(realpath "${1}") - local bootloader_dir=$(realpath "${2}") - local rootfs_dir=$(realpath "${3}") + local image_loop=$(realpath -m "${1}") + local bootloader_dir=$(realpath -m "${2}") + local rootfs_dir=$(realpath -m "${3}") #mount and write empty file to stateful local stateful_mount=/tmp/shim_stateful @@ -113,7 +113,7 @@ populate_partitions() { } create_image() { - local image_path=$(realpath "${1}") + local image_path=$(realpath -m "${1}") local bootloader_size=${2} local rootfs_size=${3} @@ -126,7 +126,7 @@ create_image() { } patch_initramfs() { - local initramfs_path=$(realpath $1) + local initramfs_path=$(realpath -m $1) rm "${initramfs_path}/init" -f cp -r bootloader/* "${initramfs_path}/" diff --git a/patch_rootfs.sh b/patch_rootfs.sh index 1aca979..101b19a 100755 --- a/patch_rootfs.sh +++ b/patch_rootfs.sh @@ -24,9 +24,9 @@ if [ -z "$3" ]; then fi copy_modules() { - local shim_rootfs=$(realpath $1) - local reco_rootfs=$(realpath $2) - local target_rootfs=$(realpath $3) + local shim_rootfs=$(realpath -m $1) + local reco_rootfs=$(realpath -m $2) + local target_rootfs=$(realpath -m $3) rm -rf "${target_rootfs}/lib/modules" cp -r "${shim_rootfs}/lib/modules" "${target_rootfs}/lib/modules" @@ -43,7 +43,7 @@ copy_modules() { copy_firmware() { local firmware_path="/tmp/chromium-firmware" - local target_rootfs=$(realpath $1) + local target_rootfs=$(realpath -m $1) if [ ! -e "$firmware_path" ]; then download_firmware $firmware_path @@ -54,14 +54,14 @@ copy_firmware() { download_firmware() { local firmware_url="https://chromium.googlesource.com/chromiumos/third_party/linux-firmware" - local firmware_path=$(realpath $1) + local firmware_path=$(realpath -m $1) git clone --branch master --depth=1 "${firmware_url}" $firmware_path } -shim_path=$(realpath $1) -reco_path=$(realpath $2) -target_rootfs=$(realpath $3) +shim_path=$(realpath -m $1) +reco_path=$(realpath -m $2) +target_rootfs=$(realpath -m $3) shim_rootfs="/tmp/shim_rootfs" reco_rootfs="/tmp/reco_rootfs"