2022-04-03 16:38:59 +00:00
|
|
|
#!/bin/bash
|
2023-10-23 22:44:47 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2023-10-23 22:46:49 +00:00
|
|
|
# Copyright (C) 2023-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
|
2022-04-03 16:38:59 +00:00
|
|
|
|
|
|
|
CONFIGPATH="/storage/.config"
|
|
|
|
|
|
|
|
if [ -e "${CONFIGPATH}/rsync.conf" ]
|
|
|
|
then
|
|
|
|
source ${CONFIGPATH}/rsync.conf
|
|
|
|
fi
|
2022-04-03 17:46:03 +00:00
|
|
|
|
2022-07-06 00:38:50 +00:00
|
|
|
# If rsync.conf is missing variables set defaults
|
|
|
|
MOUNTPATH="${MOUNTPATH:=/storage/cloud}"
|
|
|
|
SYNCPATH="${SYNCPATH:=GAMES}"
|
|
|
|
BACKUPPATH="${BACKUPPATH:=/storage/roms}"
|
|
|
|
RSYNCOPTSRESTORE="${RSYNCOPTSRESTORE:=-raiv}"
|
|
|
|
|
2022-09-14 21:35:38 +00:00
|
|
|
echo -e "=> ${OS_NAME} CLOUD RESTORE UTILITY\n"
|
2022-04-03 17:46:03 +00:00
|
|
|
|
2022-09-14 21:35:38 +00:00
|
|
|
echo "Mounting ${MOUNTPATH}" 2>&1
|
|
|
|
rclonectl mount ${MOUNTPATH} 2>&1
|
2022-04-03 17:46:03 +00:00
|
|
|
|
2022-09-14 21:35:38 +00:00
|
|
|
echo "Restoring data from ${MOUNTPATH}/${SYNCPATH} to ${BACKUPPATH}" 2>&1
|
|
|
|
rsync ${RSYNCOPTSRESTORE} --include-from="${CONFIGPATH}/rsync-rules.conf" ${MOUNTPATH}/${SYNCPATH}/ ${BACKUPPATH}/ 2>&1
|
2022-04-03 17:46:03 +00:00
|
|
|
|
2022-09-14 21:35:38 +00:00
|
|
|
echo "Unmounting ${MOUNTPATH}" 2>&1
|
|
|
|
rclonectl unmount ${MOUNTPATH} 2>&1
|
2022-04-03 17:46:03 +00:00
|
|
|
sleep 3
|
2022-09-14 21:35:38 +00:00
|
|
|
clear
|