From d9219a206f8c0badd58576bdc8696ab653660979 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Tue, 23 Jul 2024 19:36:18 +0200 Subject: [PATCH] add autobuilder to server scripts --- .../archboot/server/systemd/archboot.service | 6 ++++++ usr/share/archboot/server/systemd/archboot.timer | 11 +++++++++++ usr/share/archboot/server/trigger-update.sh | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 usr/share/archboot/server/systemd/archboot.service create mode 100644 usr/share/archboot/server/systemd/archboot.timer create mode 100755 usr/share/archboot/server/trigger-update.sh diff --git a/usr/share/archboot/server/systemd/archboot.service b/usr/share/archboot/server/systemd/archboot.service new file mode 100644 index 000000000..ad4e967f4 --- /dev/null +++ b/usr/share/archboot/server/systemd/archboot.service @@ -0,0 +1,6 @@ +[Unit] +Description=Check, build and upload archboot images at night + +[Service] +ExecStart=/home/tobias/Arch/iso/chroots/trigger-update.sh + diff --git a/usr/share/archboot/server/systemd/archboot.timer b/usr/share/archboot/server/systemd/archboot.timer new file mode 100644 index 000000000..331617460 --- /dev/null +++ b/usr/share/archboot/server/systemd/archboot.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Runs trigger-update.sh at night + +[Timer] +# Run everday at 2:00 night +OnCalendar=*-*-* 2:00:00 +Unit=archboot.service +Persistent=true + +[Install] +WantedBy=multi-user.target diff --git a/usr/share/archboot/server/trigger-update.sh b/usr/share/archboot/server/trigger-update.sh new file mode 100755 index 000000000..b159cdfb7 --- /dev/null +++ b/usr/share/archboot/server/trigger-update.sh @@ -0,0 +1,16 @@ +#!/bin/bash +_ARCH="x86_64 aarch64 riscv64" +_PACKAGES="archboot bcachefs-tools btrfs-progs e2fsprogs glibc linux systemd openssh ttyd xfsprogs" +_CHROOTS="/home/tobias/Arch/iso/chroots" +cd "${_CHROOTS}" || exit 1 +for i in ${_ARCH}; do + systemd-nspawn -q -D "${i}" pacman --noconfirm -Syu + for k in ${_PACKAGES}; do + if rg -qw "${k}" "${i}"/var/log/pacman.log; then + archboot-"${i}"-server-release.sh + break + fi + done + rm "${i}"/var/log/pacman.log +done +# vim: set ft=sh ts=4 sw=4 et: