From 2fa43a47ec6082083e90ad600e148f8a553843a5 Mon Sep 17 00:00:00 2001 From: akanealw Date: Tue, 10 Oct 2023 18:33:44 -0500 Subject: [PATCH] added if statement for wrestic --- debian/debian-download-configure-wrestic.sh | 41 ++++++++++++--------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/debian/debian-download-configure-wrestic.sh b/debian/debian-download-configure-wrestic.sh index c490922..46bbbf0 100644 --- a/debian/debian-download-configure-wrestic.sh +++ b/debian/debian-download-configure-wrestic.sh @@ -6,21 +6,26 @@ if [ "$EUID" -ne 0 ] exit fi -apt update -apt-get install -y restic -mkdir -pv /home/akanealw/.config/wrestic -mkdir -pv /home/akanealw/restic/restore -mkdir -pv /root/restic/restore -wget -qO /usr/local/bin/wrestic http://192.168.1.50/files/wrestic/wrestic -wget -qO /home/akanealw/.config/wrestic/wrestic.toml http://192.168.1.50/files/wrestic/wrestic.toml -wget -qO /home/akanealw/scripts/wrestic-backup-to-truenas.sh http://192.168.1.50/scripts/restic/wrestic-backup-to-truenas.sh -sed -i "s/changemepls/$HOSTNAME/g" /home/akanealw/.config/wrestic/wrestic.toml -sed -r 's/(resticbackups)(.*)/\1\L\2\E/g' /home/akanealw/.config/wrestic/wrestic.toml > /home/akanealw/.config/wrestic/wrestic2.toml -mv /home/akanealw/.config/wrestic/wrestic.toml /home/akanealw/.config/wrestic/wresticbackup.toml -mv /home/akanealw/.config/wrestic/wrestic2.toml /home/akanealw/.config/wrestic/wrestic.toml -rm .config/wrestic/wresticbackup.toml -chown -R akanealw:akanealw /home/akanealw/.config -chown -R akanealw:akanealw /home/akanealw/restic -chown -R akanealw:akanealw /home/akanealw/scripts -chmod +x /home/akanealw/scripts/wrestic-backup-to-truenas.sh -chmod +x /usr/local/bin/wrestic +if [[ ! -f /home/akanealw/.config/wrestic/wrestic.toml ]] + then + apt update + apt-get install -y restic + mkdir -pv /home/akanealw/.config/wrestic + mkdir -pv /home/akanealw/restic/restore + mkdir -pv /root/restic/restore + wget -qO /usr/local/bin/wrestic http://192.168.1.50/files/wrestic/wrestic + wget -qO /home/akanealw/.config/wrestic/wrestic.toml http://192.168.1.50/files/wrestic/wrestic.toml + wget -qO /home/akanealw/scripts/wrestic-backup-to-truenas.sh http://192.168.1.50/scripts/restic/wrestic-backup-to-truenas.sh + sed -i "s/changemepls/$HOSTNAME/g" /home/akanealw/.config/wrestic/wrestic.toml + sed -r 's/(resticbackups)(.*)/\1\L\2\E/g' /home/akanealw/.config/wrestic/wrestic.toml > /home/akanealw/.config/wrestic/wrestic2.toml + mv /home/akanealw/.config/wrestic/wrestic.toml /home/akanealw/.config/wrestic/wresticbackup.toml + mv /home/akanealw/.config/wrestic/wrestic2.toml /home/akanealw/.config/wrestic/wrestic.toml + rm .config/wrestic/wresticbackup.toml + chown -R akanealw:akanealw /home/akanealw/.config + chown -R akanealw:akanealw /home/akanealw/restic + chown -R akanealw:akanealw /home/akanealw/scripts + chmod +x /home/akanealw/scripts/wrestic-backup-to-truenas.sh + chmod +x /usr/local/bin/wrestic + else + echo "Wrestic is already configured." +fi \ No newline at end of file