From 9f592247d1dedabbd480ddd7ffd401c75237919c Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Wed, 25 May 2022 12:37:22 +0200 Subject: [PATCH] Reword arm64 build pipeline --- .gitlab-ci.yml | 9 ++------- arm64-build.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 arm64-build.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a26f87c..2547846 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,13 +32,8 @@ build-arm64: services: - name: docker:dind script: - - apk add git sudo bash - - git clone --depth 1 -b arm64 https://github.com/RPi-Distro/pi-gen - - cp config pi-gen/ - - cd pi-gen - - ls - - ./build-docker.sh + - ./arm64-build.sh artifacts: paths: - - ./pi-gen/deploy/*-Halia-arm64-lite.img + - ./*.img.xz expire_in: 1 mos 8 days diff --git a/arm64-build.sh b/arm64-build.sh new file mode 100755 index 0000000..3da00cb --- /dev/null +++ b/arm64-build.sh @@ -0,0 +1,32 @@ +#/bin/sh + +RASPIOS_IMG=2022-04-04-raspios-bullseye-arm64-lite.img + +echo "Fetching image" +curl -O https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-04-07/2022-04-04-raspios-bullseye-arm64-lite.img.xz + +echo "Uncompressing image" +unxz $RASPIOS_IMG.xz + +OFFSET_IMG=$(file $RASPIOS_IMG | cut -d';' -f3 | cut -d',' -f8 | cut -d' ' -f3) + +mkdir -p mnt + +echo "Mounting second partition" +sudo mount $RASPIOS_IMG -o offset=$((512*$OFFSET_IMG)) mnt + +echo "Chroot into partition to start edition" +sudo chroot mnt /bin/sh <<"EOT" + +usermod -l creator pi +usermod -d /home/creator -m creator +sudo -u creator mkdir -p -m 700 /home/creator/.ssh +sudo -u creator sh -c 'echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYsz4jdyzf9UcJ8eEavVmi+DNYE3ioeJBfTlVMw7Vsb tanguy@Diogenes" > /home/creator/.ssh/authorized_keys' +chmod 600 /home/creator/.ssh/authorized_keys +sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config +systemctl enable ssh +echo "kenoma" > /etc/hostname +EOT + +sudo umount mnt +xz $RASPIOS_IMG