raspiblitz/ci/arm64-rpi/packer.build.arm64-rpi.local.sh

73 lines
2.1 KiB
Bash
Raw Normal View History

Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
#!/bin/bash -e
2023-07-18 16:53:51 +00:00
echo -e "\n# Install dependencies with apt"
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
if [ "$(uname -n)" = "ubuntu" ]; then
sudo add-apt-repository -y universe
fi
# Install dependencies
# needed on Ubuntu Live ('lsb_release -cs': jammy)
sudo apt install -y qemu-user-static || exit 1
# from https://github.com/mkaczanowski/packer-builder-arm/blob/master/docker/Dockerfile
sudo apt install -y \
wget \
curl \
ca-certificates \
dosfstools \
fdisk \
gdisk \
kpartx \
libarchive-tools \
parted \
psmisc \
qemu-utils \
sudo \
xz-utils || exit 1
echo -e "\n# Install Packer..."
if ! packer version 2>/dev/null; then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository -y "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update -y && sudo apt-get install packer -y || exit 1
else
echo "# Packer is installed"
fi
echo -e "\n# Install Go"
export PATH=$PATH:/usr/local/go/bin
2023-07-18 16:53:51 +00:00
# https://go.dev/dl/
GOVERSION="1.20.6"
GOHASH="b945ae2bb5db01a0fb4786afde64e6fbab50b67f6fa0eb6cfa4924f16a7ff1eb"
if ! go version 2>/dev/null | grep "${GOVERSION}"; then
wget --progress=bar:force https://go.dev/dl/go${GOVERSION}.linux-amd64.tar.gz
echo "${GOHASH} go${GOVERSION}.linux-amd64.tar.gz" | sha256sum -c - || exit 1
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go${GOVERSION}.linux-amd64.tar.gz
sudo rm -rf go${GOVERSION}.linux-amd64.tar.gz
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
else
2023-07-18 16:53:51 +00:00
echo "# Go ${GOVERSION} is installed"
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
fi
echo -e "\n# Download the packer-builder-arm plugin"
git clone https://github.com/mkaczanowski/packer-builder-arm
cd packer-builder-arm
2023-07-18 16:53:51 +00:00
# https://github.com/mkaczanowski/packer-builder-arm/releases
git reset --hard "v1.0.7"
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
echo -e "\n# Build the packer-builder-arm plugin"
go mod download
go build || exit 1
2023-07-18 16:53:51 +00:00
# set vars
echo "# Setting the variables: $*"
# running from the ci/arm64-rpi/packer-builder-arm directory
source ../../set_variables.sh
set_variables "$@"
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
cp ../build.arm64-rpi.pkr.hcl ./
cp ../build.raspiblitz.sh ./
Add automated image builds for VM, bare metal (amd64) and RPi (arm64-rpi) (#3486) * add amd64 image build with lean and fatpack option * use the pi user for setup * add notes to ci readme * add gnome desktop to fatpack image, reduce to 30GB * documentation updates * install gnome with --force-yes * install gnome desktop non-interactively * change links to rootzoll dev * pass user and branch to build_sdcard.sh from PR * add user and branch to Makefile * Add arm64 rpi image build (#74) ci: * add arm64-rpi image build * rename to raspiblitz-amd64-debian-11.5-lean/fatpack * use rm -f to not exit with error * place amd64 images under ci/amd64/builds/ * make /dev/shm world writable for fatpack * fix vlc remove and --var syntax * remove sudo-s * leave update and upgrade to the build_sdcard.sh * increase image size to 16GB, rename build dir build_sdcard.sh: * detect raspios_arm64 with raspi.list * switch ssmtp to msmtp related: https://github.com/rootzoll/raspiblitz/pull/2232 Co-authored-by: rootzoll <johndoe@example.com> * i2pd: unified install from repo, /usr/sbin to PATH related: #2413, fixes amd64 build * update CHANGES.md * fix amd64 path in Makefile * use only qemu image, run on ubuntu-22.04 * use file_checksum for the arm64-rpi base image * Fix the local arm64-rpi image generation (#75) * add selfrun script * ubuntu: add universe repo and qemu-user-static * test on ubuntu live (jammy) * build from branches: [ "dev", "v1.8", "v1.9" ] * correct Makefile paths for the local run * make the local run non-interactive * improve readme and Makefile * increase disk image sizes to 32GB * set image sizes to 30 GB for amd64 and arm64-rpi * add network-manager for amd64 * add to readme * skip Code&Compile for VM builds * add to readme * amd64 base image update to debian 11.6.0 * remove debian version from filenames * skip Code&Compile for amd64 builds * Merge branch 'dev' into add-amd64-image-build * amd64: increase cpu and RAM, compile mempool last * trigger workflows only on scripts used or called * Update ci/arm64-rpi/packer.build.arm64-rpi.sh Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> * arm64 remove setup-qemu-action, leave npm last * set only manual trigger for fatpack, edit triggers Co-authored-by: rootzoll <johndoe@example.com> Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
2022-12-20 15:31:51 +01:00
echo -e "\n# Build the image"
command="packer build ${vars} build.arm64-rpi.pkr.hcl"
echo "# Running: $command"
$command || exit 1