diff options
author | Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> | 2022-07-20 01:25:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 01:25:19 +0300 |
commit | 7af7582fffe521d166fc6bcf6999602a29131337 (patch) | |
tree | 6b5f5cbe38520ebbb643beba3935be304944285e /build | |
parent | 9a142d13d71b4804d99e779e2fc2e2fdd11319d3 (diff) |
Create releases from GH workflow (#1507)
- Implement lxd-build GH workflow
- Implement GH workflow for building armbian and raspberry pi images
- Implement release GH workflow
Diffstat (limited to 'build')
-rwxr-xr-x | build/build-LXD.sh | 14 | ||||
-rwxr-xr-x | build/build-SD-armbian.sh | 13 | ||||
-rwxr-xr-x | build/build-SD-rpi.sh | 6 | ||||
-rw-r--r-- | build/buildlib.sh | 9 |
4 files changed, 28 insertions, 14 deletions
diff --git a/build/build-LXD.sh b/build/build-LXD.sh index 5793a26e..bf639347 100755 --- a/build/build-LXD.sh +++ b/build/build-LXD.sh @@ -8,7 +8,7 @@ # Usage: # -set -e +set -ex source build/buildlib.sh echo -e "\e[1m\n[ Build NCP LXD ]\e[0m" @@ -32,24 +32,26 @@ prepare_dirs # tmp cache output ## BUILD NCP lxc delete -f ncp 2>/dev/null || true -systemd-run --user --scope -p "Delegate=yes" lxc launch images:debian/bullseye ncp +systemd-run --user --scope -p "Delegate=yes" lxc launch -q images:debian/bullseye ncp lxc config device add ncp buildcode disk source="$(pwd)" path=/build lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done' -lxc exec ncp -- bash -c 'CODE_DIR=/build bash /build/install.sh' +lxc exec ncp -- bash -c 'CODE_DIR=/build DBG=x bash /build/install.sh' lxc exec ncp -- bash -c 'source /build/etc/library.sh; run_app_unsafe /build/post-inst.sh' lxc stop ncp lxc config device remove ncp buildcode -lxc publish ncp -f --alias ncp/"${version}" +lxc publish -q ncp -f --alias ncp/"${version}" ## pack -lxc export ncp "$TAR" +[[ " $* " =~ .*" --pack ".* ]] && lxc image export -q ncp/"${version}" "$TAR" + +exit 0 ## test #set_static_IP "$IMG" "$IP" #test_image "$IMG" "$IP" # upload -create_torrent "$TAR" +#create_torrent "$TAR" #upload_ftp "$( basename "$TAR" .tar.bz2 )" diff --git a/build/build-SD-armbian.sh b/build/build-SD-armbian.sh index ad72c790..a7e3977d 100755 --- a/build/build-SD-armbian.sh +++ b/build/build-SD-armbian.sh @@ -8,7 +8,7 @@ # Usage: ./build-SD-armbian.sh <board_code> [<board_name>] # -set -e +set -ex source build/buildlib.sh #CLEAN=0 # Pass this envvar to avoid cleaning download cache @@ -67,16 +67,21 @@ EXTRA_CONF=build/armbian/"config-$BOARD".conf # build rm -rf armbian/output/images +mkdir -p armbian/userpatches +sed -e '/docker.*run/s/-it//' armbian/config/templates/config-docker.conf > armbian/userpatches/config-docker.conf +docker pull "ghcr.io/armbian/build:$(cut -d"." -f1-2 < armbian/VERSION)-$(dpkg --print-architecture)" armbian/compile.sh docker ncp rm "$CONF" # pack image -mv armbian/output/images/Armbian*.img "$IMG" -pack_image "$IMG" "$TAR" + +[[ " $* " =~ " --pack " ]] && { mv armbian/output/images/Armbian*.img "$IMG" && pack_image "$IMG" "$TAR"; } + +exit 0 # test # TODO # upload -create_torrent "$TAR" +#create_torrent "$TAR" #upload_ftp "$( basename "$TAR" .tar.bz2 )" diff --git a/build/build-SD-rpi.sh b/build/build-SD-rpi.sh index a0a4aafd..223aed65 100755 --- a/build/build-SD-rpi.sh +++ b/build/build-SD-rpi.sh @@ -96,7 +96,9 @@ trap '' EXIT clean_chroot_raspbian ## pack -pack_image "$IMG" "$TAR" +[[ "$*" =~ .*" --pack ".* ]] && pack_image "$IMG" "$TAR" + +exit 0 ## test @@ -104,7 +106,7 @@ pack_image "$IMG" "$TAR" #test_image "$IMG" "$IP" # TODO fix tests # upload -create_torrent "$TAR" +#create_torrent "$TAR" #upload_ftp "$( basename "$TAR" .tar.bz2 )" diff --git a/build/buildlib.sh b/build/buildlib.sh index fb6be298..bef36cf0 100644 --- a/build/buildlib.sh +++ b/build/buildlib.sh @@ -173,7 +173,12 @@ function prepare_chroot_raspbian() sudo mount -o bind /dev raspbian_root/dev/ sudo mount -o bind /dev/pts raspbian_root/dev/pts - sudo cp /usr/bin/qemu-aarch64-static raspbian_root/usr/bin + if [[ -f "qemu-aarch64-static" ]] + then + sudo cp qemu-aarch64-static raspbian_root/usr/bin/ + else + sudo cp /usr/bin/qemu-aarch64-static raspbian_root/usr/bin + fi # Prevent services from auto-starting sudo bash -c "echo -e '#!/bin/sh\nexit 101' > raspbian_root/usr/sbin/policy-rc.d" @@ -302,7 +307,7 @@ function pack_image() local IMGNAME="$( basename "$IMG" )" echo -e "\n\e[1m[ Pack Image ]\e[0m" echo "packing $IMG → $TAR" - tar -I pbzip2 -C "$DIR" -cvf "$TAR" "$IMGNAME" && \ + tar -C "$DIR" -cavf "$TAR" "$IMGNAME" && \ echo -e "$TAR packed successfully" } |