Special handling of ttrss restore

This commit is contained in:
Bob Mottram 2016-02-07 19:59:01 +00:00
parent 4875d2d7ed
commit 161ab97be1
1 changed files with 23 additions and 0 deletions

View File

@ -186,6 +186,29 @@ function restore_database {
restore_directory_from_usb "/root/temp${1}" "${1}"
RESTORE_SUBDIR="var"
if [ ${2} ]; then
# special handline of ttrss
if [[ ${2} == "ttrss" ]]; then
if [ -d /etc/share/${2} ]; then
if [ -d /root/temp${1}/etc/share/${2} ]; then
rm -rf /etc/share/${2}
mv /root/temp${1}/etc/share/${2} /etc/share/
if [ ! "$?" = "0" ]; then
unmount_drive
exit 528
fi
if [ -d /etc/letsencrypt/live/${2} ]; then
ln -s /etc/letsencrypt/live/${2}/privkey.pem /etc/ssl/private/${2}.key
ln -s /etc/letsencrypt/live/${2}/fullchain.pem /etc/ssl/certs/${2}.pem
else
# Ensure that the bundled SSL cert is being used
if [ -f /etc/ssl/certs/${2}.bundle.crt ]; then
sed -i "s|${2}.crt|${2}.bundle.crt|g" /etc/nginx/sites-available/${2}
fi
fi
fi
fi
fi
if [ -d /var/www/${2}/htdocs ]; then
if [ -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then
rm -rf /var/www/${2}/htdocs