build image/machine every night

This commit is contained in:
Emmanuel Garette 2022-05-21 18:49:06 +02:00
parent 850b28f7e5
commit ee34de93ea
4 changed files with 31 additions and 10 deletions

View file

@ -15,6 +15,8 @@ systemctl restart systemd-networkd
systemctl enable systemd-resolved systemctl enable systemd-resolved
systemctl restart systemd-resolved systemctl restart systemd-resolved
# systemctl mask dev-hugepages.mount # systemctl mask dev-hugepages.mount
systemctl enable risotto-images.timer
systemctl restart risotto-images.timer
#nft add table nat #nft add table nat
#nft flush table nat; #nft flush table nat;

View file

@ -105,25 +105,23 @@ if [ -n "$COPR" ]; then
cd - > /dev/null cd - > /dev/null
fi fi
if [ "$FUSION" = true ]; then if [ "$FUSION" = true ]; then
dnf -y install "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$RELEASEVER.noarch.rpm" --installroot="$IMAGE_NAME_RISOTTO_IMAGE_DIR" dnf -y install "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$RELEASEVER.noarch.rpm" --installroot="$IMAGE_NAME_RISOTTO_IMAGE_DIR" > /dev/null
fi fi
# FIXME verifier s'il y a des modifs sur pre/post # FIXME verifier s'il y a des modifs sur pre/post
if [ -f "$IMAGE_NAME_RISOTTO_IMAGE_DIR".base.pkgs ] && [ -f "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs ]; then if [ -f "$IMAGE_NAME_RISOTTO_IMAGE_DIR".base.pkgs ] && [ -f "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs ]; then
echo " - différence(s) avec les paquets de base" echo " - différence(s) avec les paquets de base"
diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".base.pkgs "$BASE_PKGS_FILE" && NEW_BASE=false || NEW_BASE=true diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".base.pkgs "$BASE_PKGS_FILE" && INSTALL=false || INSTALL=true
else
NEW_BASE=true
fi
new_package
if [ "$NEW_BASE" = false ]; then
echo " - différence(s) avec les paquets de l'image"
diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs.new && INSTALL=false || INSTALL=true
else else
INSTALL=true INSTALL=true
fi fi
new_package
if [ "$INSTALL" = false ]; then
echo " - différence(s) avec les paquets de l'image"
diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs "$IMAGE_NAME_RISOTTO_IMAGE_DIR".pkgs.new && INSTALL=false || INSTALL=true
fi
find $IMAGE_NAME/manual -type f -exec md5sum '{}' \; > "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum.new find $IMAGE_NAME/manual -type f -exec md5sum '{}' \; > "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum.new
if [ "$NEW_BASE" = false ]; then if [ "$INSTALL" = false ]; then
diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum.new && INSTALL=false || INSTALL=true diff -u "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum "$IMAGE_NAME_RISOTTO_IMAGE_DIR".md5sum.new && INSTALL=false || INSTALL=true
fi fi
if [ "$INSTALL" = true ]; then if [ "$INSTALL" = true ]; then

View file

@ -0,0 +1,12 @@
[Unit]
Description=Daily images update activities
After=network.target local-fs.target systemd-logind.service
[Service]
Type=oneshot
WorkingDirectory=%%host_install_dir
ExecStart=%%host_install_dir/install_images %%host_name
ExecStart=%%host_install_dir/install_machines %%host_name
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Daily images update activities
[Timer]
OnCalendar=*-*-* 5:00
Persistent=true
[Install]
WantedBy=timers.target