Move remote wiki restore to app script

This commit is contained in:
Bob Mottram 2016-07-10 14:45:12 +01:00
parent cd3aac7c3b
commit 605ddc514e
2 changed files with 28 additions and 35 deletions

View File

@ -93,6 +93,7 @@ function restore_local_wiki {
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
fi fi
echo $"Restore of Wiki complete"
fi fi
} }
@ -105,7 +106,33 @@ function backup_remote_wiki {
} }
function restore_remote_wiki { function restore_remote_wiki {
echo -n '' if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
function_check restore_directory_from_friend
restore_directory_from_friend /root/tempwiki wiki
cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
if [ ! "$?" = "0" ]; then
exit 868
fi
restore_directory_from_friend /root/tempwiki2 wiki2
cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
if [ ! "$?" = "0" ]; then
exit 869
fi
rm -rf /root/tempwiki
rm -rf /root/tempwiki2
chown -R www-data:www-data /var/lib/dokuwiki/*
# Ensure that the bundled SSL cert is being used
if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
fi
if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
fi
echo $"Restore of Wiki complete"
fi
} }
function remove_wiki { function remove_wiki {

View File

@ -666,39 +666,6 @@ function restore_mailing_list {
fi fi
} }
function restore_wiki {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'wiki' ]]; then
return
fi
fi
if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
restore_directory_from_friend /root/tempwiki wiki
cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
if [ ! "$?" = "0" ]; then
exit 868
fi
restore_directory_from_friend /root/tempwiki2 wiki2
cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
if [ ! "$?" = "0" ]; then
exit 869
fi
rm -rf /root/tempwiki
rm -rf /root/tempwiki2
chown -R www-data:www-data /var/lib/dokuwiki/*
# Ensure that the bundled SSL cert is being used
if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
fi
if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
fi
fi
}
function restore_blog { function restore_blog {
if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'blog' ]]; then if [[ $RESTORE_APP != 'blog' ]]; then
@ -886,7 +853,6 @@ restore_mailing_list
restore_email restore_email
#restore_apps remote #restore_apps remote
restore_wiki
restore_blog restore_blog
restore_cjdns restore_cjdns
restore_voip restore_voip