misc build script bugfixes

This commit is contained in:
ading2210 2024-01-25 23:08:00 +00:00
parent 9a4b78d881
commit 8e51654190
3 changed files with 19 additions and 9 deletions

View File

@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: run build - name: run build
run: sudo DEBUG=1 ./build_complete.sh ${{ matrix.board }} compress_img=1 run: sudo DEBUG=1 ./build_complete.sh ${{ matrix.board }} compress_img=1 quiet_download=1
- name: upload img - name: upload img
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -18,16 +18,17 @@ if [ -z "$1" ]; then
echo "Valid named arguments (specify with 'key=value'):" echo "Valid named arguments (specify with 'key=value'):"
echo " compress_img - Compress the final disk image into a zip file. Set this to any value to enable this option." echo " compress_img - Compress the final disk image into a zip file. Set this to any value to enable this option."
echo " rootfs_dir - Use a different rootfs for the build. The directory you select will be copied before any patches are applied." echo " rootfs_dir - Use a different rootfs for the build. The directory you select will be copied before any patches are applied."
echo " quiet_download - Don't use progress bars on downloads."
exit 1 exit 1
fi fi
parse_args "$@" parse_args "$@"
needed_deps="wget python3 unzip zip git debootstrap cpio binwalk pcregrep cgpt mkfs.ext4 mkfs.ext2 fdisk rsync" needed_deps="wget python3 unzip zip git debootstrap cpio binwalk pcregrep cgpt mkfs.ext4 mkfs.ext2 fdisk rsync"
if ! check_deps "$needed_deps"; then if [ "$(check_deps "$needed_deps")" ]; then
#install deps automatically on debian and ubuntu #install deps automatically on debian and ubuntu
if [ -f "/etc/debian_version" ]; then if [ -f "/etc/debian_version" ]; then
echo "attempting to install build deps" echo "attempting to install build deps"
apt-get install wget python3-all unzip zip debootstrap cpio binwalk pcregrep cgpt rsync -y apt-get install wget python3-all unzip zip debootstrap cpio binwalk pcregrep cgpt rsync pv -y
fi fi
assert_deps "$needed_deps" assert_deps "$needed_deps"
fi fi
@ -71,13 +72,22 @@ download_and_unzip() {
local zip_path="$2" local zip_path="$2"
local bin_path="$3" local bin_path="$3"
if [ ! -f "$bin_path" ]; then if [ ! -f "$bin_path" ]; then
if [ ! "${args['quiet_download']}" ]; then
wget -q --show-progress $url -O $zip_path -c wget -q --show-progress $url -O $zip_path -c
else
wget -q $url -O $zip_path -c
fi fi
fi
if [ ! -f "$bin_path" ]; then if [ ! -f "$bin_path" ]; then
cleanup_path="$bin_path" cleanup_path="$bin_path"
echo "extracting $zip_path" echo "extracting $zip_path"
local total_bytes="$(unzip -lq $zip_path | tail -1 | xargs | cut -d' ' -f1)" local total_bytes="$(unzip -lq $zip_path | tail -1 | xargs | cut -d' ' -f1)"
if [ ! "${args['quiet_download']}" ]; then
unzip -p $zip_path | pv -s $total_bytes > $bin_path unzip -p $zip_path | pv -s $total_bytes > $bin_path
else
unzip -p $zip_path > $bin_path
fi
rm -rf $zip_path rm -rf $zip_path
cleanup_path="" cleanup_path=""
fi fi
@ -110,7 +120,7 @@ echo "patching debian rootfs"
echo "building final disk image" echo "building final disk image"
final_image="$base_dir/data/shimboot_$board.bin" final_image="$base_dir/data/shimboot_$board.bin"
rm -rf $final_image rm -rf $final_image
./build.sh $final_image $shim_bin data/rootfs ./build.sh $final_image $shim_bin $rootfs_dir
echo "build complete! the final disk image is located at $final_image" echo "build complete! the final disk image is located at $final_image"
if [ "${args['compress_img']}" ]; then if [ "${args['compress_img']}" ]; then

View File

@ -68,7 +68,7 @@ safe_mount() {
umount $2 2> /dev/null || /bin/true umount $2 2> /dev/null || /bin/true
rm -rf $2 rm -rf $2
mkdir -p $2 mkdir -p $2
mount $1 $2 mount $1 $2 || mount $1 $2 || mount $1 $2 || mount $1 $2 #try to mount multiple times
} }
create_partitions() { create_partitions() {