From 21b6a1298d2ae84d0243a42d78479332891be707 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 19 Oct 2022 21:31:06 +0200 Subject: [PATCH] backup --- seed/base-machine/manual/install/backup | 42 ------------------- .../templates/risotto-images.service | 6 +-- 2 files changed, 2 insertions(+), 46 deletions(-) delete mode 100755 seed/base-machine/manual/install/backup diff --git a/seed/base-machine/manual/install/backup b/seed/base-machine/manual/install/backup deleted file mode 100755 index c31a8f4..0000000 --- a/seed/base-machine/manual/install/backup +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -e - -HOST_NAME=$1 -START=$2 -if [ -z "$HOST_NAME" ]; then - echo "usage: $0 host name" - exit 1 -fi - -. config.sh - -MACHINES="" -for image in *; do - if [ -d "$image" ]; then - for os in $image/configurations/*; do - if [ -d "$os" ]; then - machine="$(basename $os)" - if [ -d "/var/lib/risotto/srv/$machine" ]; then - MACHINES="$MACHINES$machine " - fi - fi - done - fi -done -cd /var/lib/risotto/srv/ -mkdir -p "$BACKUP_DIR" -for machine in $MACHINES; do - machinectl stop $machine || true - while true; do - machinectl status "$machine" > /dev/null 2>&1 || break - sleep 1 - done - BACKUP_FILE="$BACKUP_DIR/backup_$machine.tar.bz2" - rm -f "$BACKUP_FILE" - tar -cvJf $BACKUP_FILE $machine -done - -if [ -z "$START" ]; then - machinectl start $MACHINES -fi - -exit 0 diff --git a/seed/host-systemd-machined/templates/risotto-images.service b/seed/host-systemd-machined/templates/risotto-images.service index 5a100d9..4cd70f6 100644 --- a/seed/host-systemd-machined/templates/risotto-images.service +++ b/seed/host-systemd-machined/templates/risotto-images.service @@ -4,10 +4,8 @@ After=network.target local-fs.target systemd-logind.service [Service] Type=oneshot -WorkingDirectory=%%host_install_dir -ExecStart=/usr/local/sbin/build_images -ExecStart=%%host_install_dir/backup %%host_name no -ExecStart=%%host_install_dir/install_machines %%host_name +ExecStart=/usr/local/sbin/backup_images no +ExecStart=/usr/local/sbin/update_images [Install] WantedBy=multi-user.target