added if statement for wrestic

This commit is contained in:
2023-10-10 18:33:44 -05:00
parent 1756ff2483
commit 2fa43a47ec

View File

@@ -6,21 +6,26 @@ if [ "$EUID" -ne 0 ]
exit exit
fi fi
apt update if [[ ! -f /home/akanealw/.config/wrestic/wrestic.toml ]]
apt-get install -y restic then
mkdir -pv /home/akanealw/.config/wrestic apt update
mkdir -pv /home/akanealw/restic/restore apt-get install -y restic
mkdir -pv /root/restic/restore mkdir -pv /home/akanealw/.config/wrestic
wget -qO /usr/local/bin/wrestic http://192.168.1.50/files/wrestic/wrestic mkdir -pv /home/akanealw/restic/restore
wget -qO /home/akanealw/.config/wrestic/wrestic.toml http://192.168.1.50/files/wrestic/wrestic.toml mkdir -pv /root/restic/restore
wget -qO /home/akanealw/scripts/wrestic-backup-to-truenas.sh http://192.168.1.50/scripts/restic/wrestic-backup-to-truenas.sh wget -qO /usr/local/bin/wrestic http://192.168.1.50/files/wrestic/wrestic
sed -i "s/changemepls/$HOSTNAME/g" /home/akanealw/.config/wrestic/wrestic.toml wget -qO /home/akanealw/.config/wrestic/wrestic.toml http://192.168.1.50/files/wrestic/wrestic.toml
sed -r 's/(resticbackups)(.*)/\1\L\2\E/g' /home/akanealw/.config/wrestic/wrestic.toml > /home/akanealw/.config/wrestic/wrestic2.toml wget -qO /home/akanealw/scripts/wrestic-backup-to-truenas.sh http://192.168.1.50/scripts/restic/wrestic-backup-to-truenas.sh
mv /home/akanealw/.config/wrestic/wrestic.toml /home/akanealw/.config/wrestic/wresticbackup.toml sed -i "s/changemepls/$HOSTNAME/g" /home/akanealw/.config/wrestic/wrestic.toml
mv /home/akanealw/.config/wrestic/wrestic2.toml /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
rm .config/wrestic/wresticbackup.toml mv /home/akanealw/.config/wrestic/wrestic.toml /home/akanealw/.config/wrestic/wresticbackup.toml
chown -R akanealw:akanealw /home/akanealw/.config mv /home/akanealw/.config/wrestic/wrestic2.toml /home/akanealw/.config/wrestic/wrestic.toml
chown -R akanealw:akanealw /home/akanealw/restic rm .config/wrestic/wresticbackup.toml
chown -R akanealw:akanealw /home/akanealw/scripts chown -R akanealw:akanealw /home/akanealw/.config
chmod +x /home/akanealw/scripts/wrestic-backup-to-truenas.sh chown -R akanealw:akanealw /home/akanealw/restic
chmod +x /usr/local/bin/wrestic 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