diff --git a/etc/archboot/defaults b/etc/archboot/defaults index c9b9d0aaa..e3fc7a708 100644 --- a/etc/archboot/defaults +++ b/etc/archboot/defaults @@ -39,6 +39,7 @@ _CUSTOM_PACMAN_CONF="/etc/archboot/pacman.conf.archboot" _CUSTOM_MIRRORLIST="/etc/archboot/mirrorlist.archboot" # local paths _ISO_HOME="/home/tobias/Arch/iso" +_ISO_HOME_CHROOTS="${_ISO_HOME}/chroots" _ISO_HOME_ARCH="${_ISO_HOME}/${_ARCH}" _ISO_HOME_SOURCE="${_ISO_HOME}/${_ARCH}/sources" # external paths diff --git a/etc/archboot/server-update.conf b/etc/archboot/server-update.conf new file mode 100644 index 000000000..114d34795 --- /dev/null +++ b/etc/archboot/server-update.conf @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# created by Tobias Powalowski +# set your managed architectures +_SERVER_ARCH="x86_64 aarch64 riscv64" +# set program updates that trigger new server release +_TRIGGER="archboot bcachefs-tools btrfs-progs coreutils cryptsetup \ + device-mapper dosfstools e2fsprogs glibc iproute2 iputils iw \ + iwd linux linux-firmware lvm2 mdadm openssh pacman systemd \ + thin-provisioning-tools ttyd util-linux xfsprogs" diff --git a/usr/bin/archboot-server-update.sh b/usr/bin/archboot-server-update.sh new file mode 100755 index 000000000..6219d9a62 --- /dev/null +++ b/usr/bin/archboot-server-update.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later +# created by Tobias Powalowski +. /etc/archboot/defaults +. /etc/archboot/server-update.conf +[[ -d "${_ISO_HOME_CHROOTS}" ]] || mkdir -p "${_ISO_HOME_CHROOTS}" +cd "${_ISO_HOME_CHROOTS}" +# stop if MASK is set +[[ -e MASK ]] && exit 0 +for i in ${_SERVER_ARCH}; do + # create container + if ! [[ -d "${i}" ]]; then + archboot-"${i}"-create-container.sh "${i}" -cp || exit 1 + rm "${i}"/var/log/pacman.log + fi + # update container to latest packages + systemd-nspawn -q -D "${i}" pacman --noconfirm -Syu + for k in ${_TRIGGER}; do + # if trigger successful, release new image to server + if rg -qw "${k}" "${i}"/var/log/pacman.log; then + archboot-"${i}"-server-release.sh || echo "Error: ${i} release!" >> error.log + break + fi + done + rm "${i}"/var/log/pacman.log +done +# vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/share/archboot/server/systemd/archboot.service b/usr/lib/systemd/system/archboot-server-update.service similarity index 57% rename from usr/share/archboot/server/systemd/archboot.service rename to usr/lib/systemd/system/archboot-server-update.service index ad4e967f4..de5cd3aa9 100644 --- a/usr/share/archboot/server/systemd/archboot.service +++ b/usr/lib/systemd/system/archboot-server-update.service @@ -2,5 +2,5 @@ Description=Check, build and upload archboot images at night [Service] -ExecStart=/home/tobias/Arch/iso/chroots/trigger-update.sh +ExecStart=/usr/bin/archboot-server-update.sh diff --git a/usr/share/archboot/server/systemd/archboot.timer b/usr/lib/systemd/system/archboot-server-update.timer similarity index 82% rename from usr/share/archboot/server/systemd/archboot.timer rename to usr/lib/systemd/system/archboot-server-update.timer index 331617460..d59a67dfd 100644 --- a/usr/share/archboot/server/systemd/archboot.timer +++ b/usr/lib/systemd/system/archboot-server-update.timer @@ -4,7 +4,7 @@ Description=Runs trigger-update.sh at night [Timer] # Run everday at 2:00 night OnCalendar=*-*-* 2:00:00 -Unit=archboot.service +Unit=archboot-server-update.service Persistent=true [Install] diff --git a/usr/share/archboot/server/trigger-update.sh b/usr/share/archboot/server/trigger-update.sh deleted file mode 100755 index 62a6dffbb..000000000 --- a/usr/share/archboot/server/trigger-update.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-or-later -# created by Tobias Powalowski -_ARCH="x86_64 aarch64 riscv64" -_TRIGGER="archboot bcachefs-tools btrfs-progs coreutils cryptsetup device-mapper dosfstools e2fsprogs glibc iproute2 iputils iw iwd linux linux-firmware lvm2 mdadm openssh pacman systemd thin-provisioning-tools ttyd util-linux xfsprogs" -_CHROOTS="/home/tobias/Arch/iso/chroots" -cd "${_CHROOTS}" || exit 1 -[[ -e MASK ]] && exit 0 -for i in ${_ARCH}; do - systemd-nspawn -q -D "${i}" pacman --noconfirm -Syu - for k in ${_TRIGGER}; 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: