distribution/packages/jelos/sources/scripts/backuptool
John c6ecb34a33
Backup 3rd Party Themes & theme settings
Will only do extra themes that get manually installed or installed from ThemeMaster.

I like to edit themes and if I want to install to a new device or have to reinstall the OS this makes it a lot easier to restore said themes.
(I lost a load of edits due to an OTA update)
2022-12-13 19:48:07 +00:00

69 lines
2 KiB
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2020 Fewtarius (https://github.com/fewtarius)
. /etc/profile
# NOTE: to customize your backups, create a backuptool.conf file in
# /storage/.config like this:
# LOCATIONS=(
# /storage/.config/retroarch/*
# /storage/roms/savestates/*
# /some/other/folder/file.name*
# )
BACKUPFOLDER="/storage/roms/backup"
BACKUPFILE="${BACKUPFOLDER}/${DISTRO}_BACKUP.zip"
mkdir -p ${BACKUPFOLDER}
DEFAULT=(
/storage/.config/fancontrol.conf
/storage/.config/backuptool.conf
/storage/.cache/bluetooth/*
/storage/.cache/connman*
/storage/.config/system/configs/system.cfg
/storage/.config/ppsspp/*
/storage/.config/retroarch/*
/storage/.config/moonlight/*
/storage/.config/game/*
/storage/.emulationstation/es_*.cfg
/storage/.emulationstation/scripts/*
/storage/.emulationstation/themesettings/*
$(find /storage/.emulationstation/themes/* -type d -maxdepth 0 -not -path "*es-theme-art-book-next" -not -path "*es-theme-minielec" -not -path "*es-theme-minimal" -not -path "*system-theme")
)
if [ -e "/storage/.config/backuptool.conf" ]
then
source /storage/.config/backuptool.conf
if [ ! $? = 0 ]
then
WARN="Error loading custom backuptool configs. Using defaults."
${DEBUG} && echo "${WARN}"
logger -t backuptool "${WARN}"
COMPRESSLOCATIONS=(${DEFAULT[@]})
else
COMPRESSLOCATIONS=(${LOCATIONS[@]})
fi
else
COMPRESSLOCATIONS=(${DEFAULT[@]})
fi
case "${1}" in
"restore")
unzip -o ${BACKUPFILE} -d /
;;
"backup")
if [ -f ${BACKUPFILE} ]
then
TODAY=`date +%y-%m-%d_%H_%M_%S`
ARCHIVEFILENAME="ARCHIVED_${DISTRO}_BACKUP-${TODAY}.zip"
mv ${BACKUPFILE} "${BACKUPFOLDER}/${ARCHIVEFILENAME}"
fi
[ -f "${BACKUPFILE}" ] && rm "${BACKUPFILE}"
zip -9 -r ${BACKUPFILE} \
${COMPRESSLOCATIONS[@]}
;;
esac