Restore using absolute or relative path
Obnam restores with the full path. duplicity restores with the relative path
This commit is contained in:
parent
4fc1ad9543
commit
52bf32cb28
|
@ -169,7 +169,20 @@ function restore_remote_cryptpad {
|
|||
temp_restore_dir=/root/tempcryptpad
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_friend $temp_restore_dir cryptpad
|
||||
cp -r $temp_restore_dir$CRYPTPAD_DIR/datastore/* $CRYPTPAD_DIR/datastore/
|
||||
|
||||
if [ ! -d $temp_restore_dir$CRYPTPAD_DIR/datastore ]; then
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -r $temp_restore_dir/* $CRYPTPAD_DIR/datastore/
|
||||
else
|
||||
systemctl start cryptpad
|
||||
echo 'Failed to restore cryptpad'
|
||||
rm -rf $temp_restore_dir
|
||||
return
|
||||
fi
|
||||
else
|
||||
cp -r $temp_restore_dir$CRYPTPAD_DIR/datastore/* $CRYPTPAD_DIR/datastore/
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
systemctl start cryptpad
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -113,7 +113,11 @@ function restore_local_dlna {
|
|||
temp_restore_dir=/root/tempdlna
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir dlna
|
||||
cp -r $temp_restore_dir/var/cache/minidlna/* /var/cache/minidlna/
|
||||
if [ -d $temp_restore_dir/var/cache/minidlna ]; then
|
||||
cp -r $temp_restore_dir/var/cache/minidlna/* /var/cache/minidlna/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/cache/minidlna/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -139,7 +143,11 @@ function restore_remote_dlna {
|
|||
temp_restore_dir=/root/tempdlna
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir dlna
|
||||
cp -r $temp_restore_dir/var/cache/minidlna/* /var/cache/minidlna/
|
||||
if [ -d $temp_restore_dir/var/cache/minidlna ]; then
|
||||
cp -r $temp_restore_dir/var/cache/minidlna/* /var/cache/minidlna/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/cache/minidlna/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 982
|
||||
fi
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License
|
||||
# =======
|
||||
#
|
||||
# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
|
||||
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -144,59 +144,7 @@ function backup_local_dokuwiki {
|
|||
fi
|
||||
}
|
||||
|
||||
function restore_local_dokuwiki_legacy {
|
||||
if [ -d /var/lib/dokuwiki ]; then
|
||||
echo $"Restoring Legacy Dokuwiki installation"
|
||||
function_check get_completion_param
|
||||
DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
|
||||
|
||||
temp_restore_dir=/root/tempdokuwiki
|
||||
function_check restore_directory_from_usb
|
||||
if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
|
||||
restore_directory_from_usb ${temp_restore_dir} dokuwiki
|
||||
else
|
||||
restore_directory_from_usb ${temp_restore_dir} wiki
|
||||
fi
|
||||
|
||||
# restore the data
|
||||
cp -r ${temp_restore_dir}/var/lib/dokuwiki/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check restore_directory_from_usb
|
||||
set_user_permissions
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
rm -rf ${temp_restore_dir}
|
||||
exit 73562
|
||||
fi
|
||||
|
||||
# restore the users
|
||||
cp -r ${temp_restore_dir}/var/lib/dokuwiki/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl
|
||||
cp -r ${temp_restore_dir}/var/lib/dokuwiki/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check restore_directory_from_usb
|
||||
set_user_permissions
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
rm -rf ${temp_restore_dir}
|
||||
exit 23985
|
||||
fi
|
||||
rm -rf ${temp_restore_dir}
|
||||
|
||||
chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
|
||||
chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib
|
||||
chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
|
||||
chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
|
||||
chown -R www-data:www-data /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
|
||||
echo $"Restore of Legacy Dokuwiki complete"
|
||||
fi
|
||||
}
|
||||
|
||||
function restore_local_dokuwiki {
|
||||
if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
|
||||
restore_local_dokuwiki_legacy
|
||||
return
|
||||
fi
|
||||
|
||||
echo $"Restoring Dokuwiki installation"
|
||||
function_check get_completion_param
|
||||
DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
|
||||
|
@ -205,7 +153,11 @@ function restore_local_dokuwiki {
|
|||
temp_restore_dir=/root/tempdokuwikidat
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir} dokuwikidat
|
||||
cp -r ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
|
||||
if [ -d ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/data ]; then
|
||||
cp -r ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check restore_directory_from_usb
|
||||
set_user_permissions
|
||||
|
@ -220,8 +172,13 @@ function restore_local_dokuwiki {
|
|||
temp_restore_dir=/root/tempdokuwikiacl
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir} dokuwikiacl
|
||||
cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/
|
||||
if [ -d ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl ]; then
|
||||
cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/
|
||||
else
|
||||
cp ${temp_restore_dir}/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
cp ${temp_restore_dir}/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check restore_directory_from_usb
|
||||
set_user_permissions
|
||||
|
@ -257,24 +214,34 @@ function restore_remote_dokuwiki {
|
|||
|
||||
if [ -d $SERVER_DIRECTORY/backup/dokuwikidat ]; then
|
||||
echo $"Restoring Dokuwiki data for $DOKUWIKI_DOMAIN_NAME"
|
||||
restore_directory_from_friend /root/tempdokuwikidat dokuwikidat
|
||||
cp -r /root/tempdokuwikidat/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/
|
||||
temp_restore_dir=/root/tempdokuwikidat
|
||||
restore_directory_from_friend $temp_restore_dir dokuwikidat
|
||||
if [ -d $temp_restore_dir/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data ]; then
|
||||
cp -r $temp_restore_dir/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 92634
|
||||
fi
|
||||
rm -rf /root/tempdokuwikidat
|
||||
rm -rf $temp_restore_dir
|
||||
|
||||
echo $"Restore of Dokuwiki data complete"
|
||||
fi
|
||||
|
||||
if [ -d $SERVER_DIRECTORY/backup/dokuwikiacl ]; then
|
||||
echo $"Restoring Dokuwiki users for $DOKUWIKI_DOMAIN_NAME"
|
||||
restore_directory_from_friend /root/tempdokuwikiacl dokuwikiacl
|
||||
cp -r /root/tempdokuwikidat/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
temp_restore_dir=/root/tempdokuwikiacl
|
||||
restore_directory_from_friend $temp_restore_dir dokuwikiacl
|
||||
if [ -d $temp_restore_dir/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl ]; then
|
||||
cp -r $temp_restore_dir/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 735287
|
||||
fi
|
||||
rm -rf /root/tempdokuwikiacl
|
||||
rm -rf $temp_restore_dir
|
||||
|
||||
echo $"Restore of Dokuwiki users complete"
|
||||
fi
|
||||
|
|
|
@ -81,7 +81,14 @@ function restore_local_emacs {
|
|||
echo $"Restoring Emacs config for $USERNAME"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir emacs/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.emacs.d ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
|
||||
else
|
||||
if [ ! -d /home/$USERNAME/.emacs.d ]; then
|
||||
mkdir /home/$USERNAME/.emacs.d
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.emacs.d
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -90,7 +97,11 @@ function restore_local_emacs {
|
|||
backup_unmount_drive
|
||||
exit 664
|
||||
fi
|
||||
cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.emacs.d ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
|
||||
else
|
||||
cp -f $temp_restore_dir/dotemacs /home/$USERNAME/.emacs
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
done
|
||||
|
@ -125,7 +136,14 @@ function restore_remote_emacs {
|
|||
echo $"Restoring Emacs config for $USERNAME"
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir emacs/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.emacs.d ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
|
||||
else
|
||||
if [ ! -d /home/$USERNAME/.emacs.d ]; then
|
||||
mkdir /home/$USERNAME/.emacs.d
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.emacs.d/*
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -134,7 +152,11 @@ function restore_remote_emacs {
|
|||
backup_unmount_drive
|
||||
exit 664
|
||||
fi
|
||||
cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.emacs.d ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
|
||||
else
|
||||
cp -f $temp_restore_dir/dotemacs /home/$USERNAME/.emacs
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -251,7 +251,11 @@ function restore_local_ghost {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir ghostcontent
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content ]; then
|
||||
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
fi
|
||||
chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/content
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
@ -291,7 +295,11 @@ function restore_remote_ghost {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir ghostcontent
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content ]; then
|
||||
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
|
||||
fi
|
||||
chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
|
|
@ -430,16 +430,31 @@ function restore_local_gnusocial {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir gnusocialconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
|
||||
if [ -d cp $temp_restore_dir$gnusocial_dir ]; then
|
||||
cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
|
||||
else
|
||||
cp $temp_restore_dir/backup/config.php $gnusocial_dir/
|
||||
if [ ! -d $gnusocial_dir/static ]; then
|
||||
mkdir $gnusocial_dir/static
|
||||
fi
|
||||
cp -rp $temp_restore_dir/static/* $gnusocial_dir/static/
|
||||
fi
|
||||
chown www-data:www-data $gnusocial_dir/config.php
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
|
||||
chown -R www-data:www-data $gnusocial_dir/static
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_usb $temp_restore_dir gnusocialfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
|
||||
if [ -d cp $temp_restore_dir$gnusocial_dir/file ]; then
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
|
||||
else
|
||||
if [ ! -d $gnusocial_dir/file ]; then
|
||||
mkdir $gnusocial_dir/file
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $gnusocial_dir/file
|
||||
fi
|
||||
chown -R www-data:www-data $gnusocial_dir/file
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
@ -511,16 +526,31 @@ function restore_remote_gnusocial {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir gnusocialconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
|
||||
if [ -d $temp_restore_dir$gnusocial_dir ]; then
|
||||
cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
|
||||
else
|
||||
cp $temp_restore_dir/backup/config.php $gnusocial_dir/
|
||||
if [ ! -d $gnusocial_dir/static ]; then
|
||||
mkdir $gnusocial_dir/static
|
||||
fi
|
||||
cp -rp $temp_restore_dir/static/* $gnusocial_dir/static/
|
||||
fi
|
||||
chown www-data:www-data $gnusocial_dir/config.php
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
|
||||
chown -R www-data:www-data $gnusocial_dir/static
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_friend $temp_restore_dir gnusocialfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
|
||||
if [ ! -d $temp_restore_dir$gnusocial_dir/file ]; then
|
||||
cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
|
||||
else
|
||||
if [ ! -d $gnusocial_dir/file ]; then
|
||||
mkdir $gnusocial_dir/file
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $gnusocial_dir/file/
|
||||
fi
|
||||
chown -R www-data:www-data $gnusocial_dir/file
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
|
|
@ -249,7 +249,11 @@ function restore_local_gogs {
|
|||
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
|
||||
mkdir -p /home/${GOGS_USERNAME}/custom
|
||||
fi
|
||||
cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
|
||||
if [ ! -d ${temp_restore_dir}/home/${GOGS_USERNAME}/custom ]; then
|
||||
cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/custom/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -260,7 +264,11 @@ function restore_local_gogs {
|
|||
echo $"Restoring Gogs repos"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir}repos gogsrepos
|
||||
cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
if [ ! -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -274,7 +282,11 @@ function restore_local_gogs {
|
|||
if [ ! -d /home/${GOGS_USERNAME}/.ssh ]; then
|
||||
mkdir /home/${GOGS_USERNAME}/.ssh
|
||||
fi
|
||||
cp -r ${temp_restore_dir}ssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
|
||||
if [ -d ${temp_restore_dir}ssh/home/${GOGS_USERNAME}/.ssh ]; then
|
||||
cp -r ${temp_restore_dir}ssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/.ssh/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -338,13 +350,21 @@ function restore_remote_gogs {
|
|||
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
|
||||
mkdir -p /home/${GOGS_USERNAME}/custom
|
||||
fi
|
||||
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
||||
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||
else
|
||||
cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 58852
|
||||
fi
|
||||
echo $"Restoring Gogs repos"
|
||||
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
||||
cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
if [ -d /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
else
|
||||
cp -r /root/tempgogsrepos/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 7649
|
||||
fi
|
||||
|
@ -353,7 +373,11 @@ function restore_remote_gogs {
|
|||
if [ ! -d /home/${GOGS_USERNAME}/.ssh ]; then
|
||||
mkdir /home/${GOGS_USERNAME}/.ssh
|
||||
fi
|
||||
cp -r /root/tempgogsssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
|
||||
if [ -d /root/tempgogsssh/home/${GOGS_USERNAME}/.ssh ]; then
|
||||
cp -r /root/tempgogsssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
|
||||
else
|
||||
cp -r /root/tempgogsssh/* /home/${GOGS_USERNAME}/.ssh/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 74239
|
||||
fi
|
||||
|
|
|
@ -249,8 +249,15 @@ function restore_local_htmly {
|
|||
fi
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
if [ -d ${temp_restore_dir}/var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
else
|
||||
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
mkdir /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
fi
|
||||
cp -r ${temp_restore_dir}/* /var/www/${HTMLY_DOMAIN_NAME}/htdocs/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/previous /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
|
@ -315,8 +322,17 @@ function restore_remote_htmly {
|
|||
fi
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
|
||||
if [ -d ${temp_restore_dir}/var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
else
|
||||
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
mkdir /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
fi
|
||||
cp -r ${temp_restore_dir}/* /var/www/${HTMLY_DOMAIN_NAME}/htdocs/
|
||||
fi
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/previous /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
|
|
|
@ -119,7 +119,11 @@ function restore_local_ipfs {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir ipfs
|
||||
ADMIN_USERNAME=$(get_completion_param "Admin user")
|
||||
cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs ]; then
|
||||
cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
|
||||
else
|
||||
cp -rf $temp_restore_dir/* /home/$ADMIN_USERNAME/.ipfs
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -151,7 +155,11 @@ function restore_remote_ipfs {
|
|||
temp_restore_dir=/root/tempipfs
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir ipfs
|
||||
cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs ]; then
|
||||
cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
|
||||
else
|
||||
cp -rf $temp_restore_dir/* /home/$ADMIN_USERNAME/.ipfs
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
|
|
@ -243,14 +243,25 @@ function restore_local_kanboard {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir kanboardconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$kanboard_dir/backup/config.php $kanboard_dir/
|
||||
if [ -d $temp_restore_dir$kanboard_dir/backup ]; then
|
||||
cp $temp_restore_dir$kanboard_dir/backup/config.php $kanboard_dir/
|
||||
else
|
||||
cp $temp_restore_dir/config.php $kanboard_dir/
|
||||
fi
|
||||
chown www-data:www-data $kanboard_dir/config.php
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_usb $temp_restore_dir kanboardfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$kanboard_dir/data $kanboard_dir/
|
||||
if [ -d $temp_restore_dir$kanboard_dir/data ]; then
|
||||
cp -rp $temp_restore_dir$kanboard_dir/data $kanboard_dir/
|
||||
else
|
||||
if [ ! -d $kanboard_dir/data ]; then
|
||||
mkdir $kanboard_dir/data
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $kanboard_dir/data/
|
||||
fi
|
||||
chown -R www-data:www-data $kanboard_dir/data
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
@ -313,14 +324,25 @@ function restore_remote_kanboard {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir kanboardconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$kanboard_dir/backup/config.php $kanboard_dir/
|
||||
if [ -d $temp_restore_dir$kanboard_dir/backup ]; then
|
||||
cp $temp_restore_dir$kanboard_dir/backup/config.php $kanboard_dir/
|
||||
else
|
||||
cp $temp_restore_dir/config.php $kanboard_dir/
|
||||
fi
|
||||
chown www-data:www-data $kanboard_dir/config.php
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_friend $temp_restore_dir kanboardfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$kanboard_dir/data $kanboard_dir/
|
||||
if [ -d $temp_restore_dir$kanboard_dir/data ]; then
|
||||
cp -rp $temp_restore_dir$kanboard_dir/data $kanboard_dir/
|
||||
else
|
||||
if [ ! -d $kanboard_dir/data ]; then
|
||||
mkdir $kanboard_dir/data
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $kanboard_dir/data/
|
||||
fi
|
||||
chown -R www-data:www-data $kanboard_dir/data
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
|
|
@ -202,7 +202,11 @@ function restore_local_keyserver {
|
|||
temp_restore_dir=/root/tempkeyserverconfig
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir keyserverconfig
|
||||
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
|
||||
if [ -d $temp_restore_dir/etc/sks ]; then
|
||||
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/sks/
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
chown -Rc debian-sks: /etc/sks/sksconf
|
||||
chown -Rc debian-sks: /etc/sks/mailsync
|
||||
|
@ -211,7 +215,14 @@ function restore_local_keyserver {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir keyserver
|
||||
mv /var/lib/sks/DB /var/lib/sks/DB_prev
|
||||
cp -r $temp_restore_dir/var/lib/sks/DB /var/lib/sks/DB
|
||||
if [ -d $temp_restore_dir/var/lib/sks/DB ]; then
|
||||
cp -r $temp_restore_dir/var/lib/sks/DB /var/lib/sks/DB
|
||||
else
|
||||
if [ ! -d /var/lib/sks/DB ]; then
|
||||
mkdir /var/lib/sks/DB
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /var/lib/sks/DB
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
# restore the old database
|
||||
rm -rf /var/lib/sks/DB
|
||||
|
@ -272,7 +283,11 @@ function restore_remote_keyserver {
|
|||
temp_restore_dir=/root/tempkeyserverconfig
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir keyserverconfig
|
||||
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
|
||||
if [ -d $temp_restore_dir/etc/sks ]; then
|
||||
cp -r $temp_restore_dir/etc/sks/* /etc/sks/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/sks/
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
chown -Rc debian-sks: /etc/sks/sksconf
|
||||
chown -Rc debian-sks: /etc/sks/mailsync
|
||||
|
@ -281,7 +296,14 @@ function restore_remote_keyserver {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir keyserver
|
||||
mv /var/lib/sks/DB /var/lib/sks/DB_prev
|
||||
cp -r $temp_restore_dir/var/lib/sks/DB /var/lib/sks/DB
|
||||
if [ -d $temp_restore_dir/var/lib/sks/DB ]; then
|
||||
cp -r $temp_restore_dir/var/lib/sks/DB /var/lib/sks/DB
|
||||
else
|
||||
if [ ! -d /var/lib/sks/DB ]; then
|
||||
mkdir /var/lib/sks/DB
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /var/lib/sks/DB
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
# restore the old database
|
||||
rm -rf /var/lib/sks/DB
|
||||
|
|
|
@ -415,7 +415,11 @@ function restore_local_matrix {
|
|||
temp_restore_dir=/root/tempmatrix
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir matrix
|
||||
cp -r $temp_restore_dir/etc/matrix/* /etc/matrix
|
||||
if [ -d $temp_restore_dir/etc/matrix ]; then
|
||||
cp -r $temp_restore_dir/etc/matrix/* /etc/matrix
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/matrix/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
|
@ -426,7 +430,11 @@ function restore_local_matrix {
|
|||
|
||||
temp_restore_dir=/root/tempmatrixdata
|
||||
restore_directory_from_usb $temp_restore_dir matrixdata
|
||||
cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR
|
||||
if [ -d $temp_restore_dir$MATRIX_DATA_DIR ]; then
|
||||
cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR
|
||||
else
|
||||
cp -r $temp_restore_dir/* $MATRIX_DATA_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
|
@ -472,7 +480,11 @@ function restore_remote_matrix {
|
|||
temp_restore_dir=/root/tempmatrix
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir matrix
|
||||
cp -r $temp_restore_dir/etc/matrix/* /etc/matrix
|
||||
if [ -d $temp_restore_dir/etc/matrix ]; then
|
||||
cp -r $temp_restore_dir/etc/matrix/* /etc/matrix
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/matrix/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 38935
|
||||
fi
|
||||
|
@ -481,7 +493,11 @@ function restore_remote_matrix {
|
|||
|
||||
temp_restore_dir=/root/tempmatrixdata
|
||||
restore_directory_from_friend $temp_restore_dir matrixdata
|
||||
cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR
|
||||
if [ -d $temp_restore_dir$MATRIX_DATA_DIR ]; then
|
||||
cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR
|
||||
else
|
||||
cp -r $temp_restore_dir/* $MATRIX_DATA_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 60923
|
||||
fi
|
||||
|
|
|
@ -177,7 +177,11 @@ function restore_local_mediagoblin {
|
|||
temp_restore_dir=/root/tempmediagoblin
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir} mediagoblin
|
||||
cp -r ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR/* $MEDIAGOBLIN_BASE_DIR/
|
||||
if [ -d ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR ]; then
|
||||
cp -r ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR/* $MEDIAGOBLIN_BASE_DIR/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* $MEDIAGOBLIN_BASE_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check restore_directory_from_usb
|
||||
set_user_permissions
|
||||
|
@ -186,7 +190,11 @@ function restore_local_mediagoblin {
|
|||
exit 45327
|
||||
fi
|
||||
restore_directory_from_usb ${temp_restore_dir}2 mediagoblindata
|
||||
cp -r ${temp_restore_dir}2/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
||||
if [ -d ${temp_restore_dir}2/var/lib/mediagoblin ]; then
|
||||
cp -r ${temp_restore_dir}2/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
||||
else
|
||||
cp -r ${temp_restore_dir}2/* /var/lib/mediagoblin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -214,21 +222,30 @@ function backup_remote_mediagoblin {
|
|||
function restore_remote_mediagoblin {
|
||||
MEDIAGOBLIN_BASE_DIR=/var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
|
||||
if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
|
||||
temp_restore_dir=/root/tempmediagoblin
|
||||
function_check get_completion_param
|
||||
MEDIAGOBLIN_DOMAIN_NAME=$(get_completion_param "mediagoblin domain")
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend /root/tempmediagoblin mediagoblin
|
||||
cp -r /root/tempmediagoblin/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
||||
restore_directory_from_friend $temp_restore_dir mediagoblin
|
||||
if [ -d ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR ]; then
|
||||
cp -r ${temp_restore_dir}$MEDIAGOBLIN_BASE_DIR/* $MEDIAGOBLIN_BASE_DIR/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* $MEDIAGOBLIN_BASE_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 264824
|
||||
fi
|
||||
restore_directory_from_friend /root/tempmediagoblin2 mediagoblindata
|
||||
cp -r /root/tempmediagoblin/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
||||
restore_directory_from_friend ${temp_restore_dir}2 mediagoblindata
|
||||
if [ -d ${temp_restore_dir}2/var/lib/mediagoblin ]; then
|
||||
cp -r ${temp_restore_dir}2/var/lib/mediagoblin/* /var/lib/mediagoblin/
|
||||
else
|
||||
cp -r ${temp_restore_dir}2/* /var/lib/mediagoblin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 268492
|
||||
fi
|
||||
rm -rf /root/tempmediagoblin
|
||||
rm -rf /root/tempmediagoblin2
|
||||
rm -rf ${temp_restore_dir}
|
||||
rm -rf ${temp_restore_dir}2
|
||||
chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
|
||||
chown -hR mediagoblin:www-data /var/lib/mediagoblin
|
||||
chmod -R g+wx /var/lib/mediagoblin
|
||||
|
|
|
@ -107,7 +107,11 @@ function restore_local_mumble {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir voip
|
||||
restore_directory_from_usb $temp_restore_dir mumble
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
||||
else
|
||||
cp -f $temp_restore_dir/mumble-server.ini /etc/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -116,7 +120,11 @@ function restore_local_mumble {
|
|||
backup_unmount_drive
|
||||
exit 3679
|
||||
fi
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
||||
else
|
||||
cp -f $temp_restore_dir/mumble-server.sqlite /var/lib/mumble-server/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -152,17 +160,29 @@ function restore_remote_mumble {
|
|||
temp_restore_dir=/root/tempmumble
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir mumble
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
|
||||
else
|
||||
cp -f $temp_restore_dir/mumble-server.ini /etc/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 7823
|
||||
fi
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||
else
|
||||
cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 7823
|
||||
fi
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
||||
if [ $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
|
||||
else
|
||||
cp -f $temp_restore_dir/mumble-server.sqlite /var/lib/mumble-server/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 276
|
||||
|
|
|
@ -254,8 +254,13 @@ function restore_local_nextcloud {
|
|||
|
||||
temp_restore_dir=/root/tempnextcloudfiles
|
||||
restore_directory_from_usb $temp_restore_dir nextcloudfiles
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name data)
|
||||
cp -r ${temp_source_dir} /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
|
||||
if [ -d $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/data ]; then
|
||||
cp -r $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/data /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
fi
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -265,8 +270,13 @@ function restore_local_nextcloud {
|
|||
|
||||
temp_restore_dir=/root/tempnextcloudconfig
|
||||
restore_directory_from_usb $temp_restore_dir nextcloudconfig
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name config)
|
||||
cp -r ${temp_source_dir} /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/
|
||||
|
||||
if [ -d $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config ]; then
|
||||
cp -r $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/
|
||||
fi
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -324,8 +334,13 @@ function restore_remote_nextcloud {
|
|||
|
||||
temp_restore_dir=/root/tempnextcloudfiles
|
||||
restore_directory_from_friend $temp_restore_dir nextcloudfiles
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name data)
|
||||
cp -r ${temp_source_dir} /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
|
||||
if [ -d $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/data ]; then
|
||||
cp -r $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/data /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/${NEXTCLOUD_DOMAIN_NAME}/
|
||||
fi
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 768254
|
||||
fi
|
||||
|
@ -333,8 +348,13 @@ function restore_remote_nextcloud {
|
|||
|
||||
temp_restore_dir=/root/tempnextcloudconfig
|
||||
restore_directory_from_friend $temp_restore_dir nextcloudconfig
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name config)
|
||||
cp -r ${temp_source_dir} /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/
|
||||
|
||||
if [ -d $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config ]; then
|
||||
cp -r $temp_restore_dir/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/
|
||||
fi
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 573427
|
||||
fi
|
||||
|
|
|
@ -449,7 +449,11 @@ function restore_local_pelican {
|
|||
temp_restore_dir=/root/temppelican
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir pelican
|
||||
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
|
||||
if [ -d $temp_restore_dir/etc/blog ]; then
|
||||
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/blog/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -466,7 +470,11 @@ function restore_local_pelican {
|
|||
temp_restore_dir=/root/temppelican-site
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir pelican-site
|
||||
cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
if [ -d $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs ]; then
|
||||
cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -495,7 +503,11 @@ function restore_remote_pelican {
|
|||
temp_restore_dir=/root/temppelican
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir pelican
|
||||
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
|
||||
if [ -d $temp_restore_dir/etc/blog ]; then
|
||||
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/blog/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 782352
|
||||
fi
|
||||
|
@ -507,7 +519,11 @@ function restore_remote_pelican {
|
|||
temp_restore_dir=/root/temppelican-site
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir pelican-site
|
||||
cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
if [ -d $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs ]; then
|
||||
cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 76382562
|
||||
fi
|
||||
|
|
|
@ -446,16 +446,31 @@ function restore_local_postactiv {
|
|||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir postactivconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
||||
if [ -d $temp_restore_dir$postactiv_dir ]; then
|
||||
cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
||||
cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
||||
else
|
||||
cp $temp_restore_dir/backup/config.php $postactiv_dir/
|
||||
if [ ! -d $postactiv_dir/static ]; then
|
||||
mkdir $postactiv_dir/static
|
||||
fi
|
||||
cp -rp $temp_restore_dir/static/* $postactiv_dir/static/
|
||||
fi
|
||||
chown www-data:www-data $postactiv_dir/config.php
|
||||
cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
||||
chown -R www-data:www-data $postactiv_dir/static
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_usb $temp_restore_dir postactivfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
||||
if [ -d $temp_restore_dir$postactiv_dir/file ]; then
|
||||
cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
||||
else
|
||||
if [ ! -d $postactiv_dir/file ]; then
|
||||
mkdir $postactiv_dir/file
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $postactiv_dir/file/
|
||||
fi
|
||||
chown -R www-data:www-data $postactiv_dir/file
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
@ -527,16 +542,31 @@ function restore_remote_postactiv {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir postactivconfig
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
||||
if [ -d $temp_restore_dir$postactiv_dir ]; then
|
||||
cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
||||
cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
||||
else
|
||||
cp $temp_restore_dir/config.php $postactiv_dir/
|
||||
if [ ! -d $postactiv_dir/static ]; then
|
||||
mkdir $postactiv_dir/static
|
||||
fi
|
||||
cp -rp $temp_restore_dir/static/* $postactiv_dir/static/
|
||||
fi
|
||||
chown www-data:www-data $postactiv_dir/config.php
|
||||
cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
||||
chown -R www-data:www-data $postactiv_dir/static
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
restore_directory_from_friend $temp_restore_dir postactivfile
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
||||
if [ -d $temp_restore_dir$postactiv_dir/file ]; then
|
||||
cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
||||
else
|
||||
if [ ! -d $postactiv_dir/file ]; then
|
||||
mkdir $postactiv_dir/file
|
||||
fi
|
||||
cp -rp $temp_restore_dir/* $postactiv_dir/file/
|
||||
fi
|
||||
chown -R www-data:www-data $postactiv_dir/file
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
|
|
@ -214,7 +214,11 @@ function restore_local_radicale {
|
|||
temp_restore_dir=/root/tempradicale
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir radicale
|
||||
cp -r $temp_restore_dir${RADICALE_DIRECTORY}/* ${RADICALE_DIRECTORY}
|
||||
if [ -d $temp_restore_dir${RADICALE_DIRECTORY} ]; then
|
||||
cp -r $temp_restore_dir${RADICALE_DIRECTORY}/* ${RADICALE_DIRECTORY}
|
||||
else
|
||||
cp -r $temp_restore_dir/* ${RADICALE_DIRECTORY}/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
|
@ -224,7 +228,11 @@ function restore_local_radicale {
|
|||
|
||||
temp_restore_dir=/root/tempradicalewww
|
||||
restore_directory_from_usb $temp_restore_dir radicalewww
|
||||
cp -r $temp_restore_dir/var/www/radicale/* /var/www/radicale
|
||||
if [ -d $temp_restore_dir/var/www/radicale ]; then
|
||||
cp -r $temp_restore_dir/var/www/radicale/* /var/www/radicale
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/radicale/*
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check backup_unmount_drive
|
||||
backup_unmount_drive
|
||||
|
@ -251,7 +259,11 @@ function restore_remote_radicale {
|
|||
temp_restore_dir=/root/tempradicale
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir radicale
|
||||
cp -r $temp_restore_dir${RADICALE_DIRECTORY}/* ${RADICALE_DIRECTORY}
|
||||
if [ -d $temp_restore_dir${RADICALE_DIRECTORY} ]; then
|
||||
cp -r $temp_restore_dir${RADICALE_DIRECTORY}/* ${RADICALE_DIRECTORY}
|
||||
else
|
||||
cp -r $temp_restore_dir/* ${RADICALE_DIRECTORY}/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 236746
|
||||
fi
|
||||
|
@ -259,7 +271,11 @@ function restore_remote_radicale {
|
|||
|
||||
temp_restore_dir=/root/tempradicalewww
|
||||
restore_directory_from_friend $temp_restore_dir radicalewww
|
||||
cp -r $temp_restore_dir/var/www/radicale/* /var/www/radicale
|
||||
if [ -d $temp_restore_dir/var/www/radicale ]; then
|
||||
cp -r $temp_restore_dir/var/www/radicale/* /var/www/radicale
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/www/radicale
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 3674284
|
||||
fi
|
||||
|
|
|
@ -171,9 +171,13 @@ function restore_local_rss {
|
|||
restore_database ttrss ${RSS_READER_DOMAIN_NAME}
|
||||
|
||||
if [ -d /etc/share/tt-rss ]; then
|
||||
if [ -d /root/tempttrss/etc/share/tt-rss ]; then
|
||||
rm -rf /etc/share/tt-rss
|
||||
mv /root/tempttrss/etc/share/tt-rss /etc/share/
|
||||
if [ -d $temp_restore_dir/etc/share/tt-rss ]; then
|
||||
if [ -d $temp_restore_dir/etc/share/tt-rss ]; then
|
||||
rm -rf /etc/share/tt-rss
|
||||
mv $temp_restore_dir/etc/share/tt-rss /etc/share/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/share/tt-rss/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -230,6 +234,7 @@ function backup_remote_rss {
|
|||
}
|
||||
|
||||
function restore_remote_rss {
|
||||
temp_restore_dir=/root/tempttrss
|
||||
if grep -q "rss reader domain" $COMPLETION_FILE; then
|
||||
echo $"Restoring ttrss"
|
||||
function_check restore_database_from_friend
|
||||
|
@ -240,8 +245,12 @@ function restore_remote_rss {
|
|||
restore_database_from_friend ttrss ${RSS_READER_DOMAIN_NAME}
|
||||
|
||||
if [ -d /etc/share/tt-rss ]; then
|
||||
rm -rf /etc/share/tt-rss
|
||||
mv /root/tempttrss/etc/share/tt-rss /etc/share/
|
||||
if [ -d $temp_restore_dir/etc/share/tt-rss ]; then
|
||||
rm -rf /etc/share/tt-rss
|
||||
mv $temp_restore_dir/etc/share/tt-rss /etc/share/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/share/tt-rss/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 6391
|
||||
fi
|
||||
|
|
|
@ -144,8 +144,13 @@ function restore_local_scuttlebot {
|
|||
temp_restore_dir=/root/tempscuttlebot
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir scuttlebot
|
||||
cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
|
||||
if [ -d $temp_restore_dir/etc/scuttlebot/.ssb ]; then
|
||||
cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/scuttlebot/.ssb/*
|
||||
fi
|
||||
systemctl start scuttlebot
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -164,8 +169,13 @@ function restore_remote_scuttlebot {
|
|||
temp_restore_dir=/root/tempscuttlebot
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir scuttlebot
|
||||
cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
|
||||
if [ -d $temp_restore_dir/etc/scuttlebot/.ssb ]; then
|
||||
cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /etc/scuttlebot/.ssb/*
|
||||
fi
|
||||
systemctl start scuttlebot
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,11 @@ function restore_local_sip {
|
|||
temp_restore_dir=/root/tempsip
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir sip
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||
else
|
||||
cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -173,7 +177,23 @@ function backup_remote_sip {
|
|||
}
|
||||
|
||||
function restore_remote_sip {
|
||||
echo -n ''
|
||||
temp_restore_dir=/root/tempsip
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir sip
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
|
||||
else
|
||||
cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 3679
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
systemctl restart sipwitch
|
||||
}
|
||||
|
||||
function remove_sip {
|
||||
|
|
|
@ -286,7 +286,13 @@ function restore_local_syncthing {
|
|||
echo $"Restoring syncthing configuration"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
|
||||
cp -r ${temp_restore_dir}config/* /
|
||||
#cp -r ${temp_restore_dir}config/* /
|
||||
|
||||
if [ ! -d /root/.config/syncthing ]; then
|
||||
mkdir -p /root/.config/syncthing
|
||||
fi
|
||||
cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -300,7 +306,13 @@ function restore_local_syncthing {
|
|||
if [ -d $USB_MOUNT/backup/syncthingshared ]; then
|
||||
echo $"Restoring syncthing shared files"
|
||||
restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
|
||||
cp -r ${temp_restore_dir}shared/* /
|
||||
#cp -r ${temp_restore_dir}shared/* /
|
||||
|
||||
if [ ! -d /var/lib/syncthing/SyncShared ]; then
|
||||
mkdir -p /var/lib/syncthing/SyncShared
|
||||
fi
|
||||
cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -320,7 +332,11 @@ function restore_local_syncthing {
|
|||
fi
|
||||
echo $"Restoring syncthing files for $USERNAME"
|
||||
restore_directory_from_usb ${temp_restore_dir} syncthing/$USERNAME
|
||||
cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
|
||||
if [ -d ${temp_restore_dir}/home/$USERNAME/Sync ]; then
|
||||
cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/$USERNAME/Sync/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf ${temp_restore_dir}
|
||||
set_user_permissions
|
||||
|
@ -399,7 +415,11 @@ function restore_remote_syncthing {
|
|||
temp_restore_dir=/root/tempsyncthingconfig
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir syncthingconfig
|
||||
cp -r $temp_restore_dir/* /
|
||||
#cp -r $temp_restore_dir/* /
|
||||
if [ ! -d /root/.config/syncthing ]; then
|
||||
mkdir -p /root/.config/syncthing
|
||||
fi
|
||||
cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
systemctl start syncthing
|
||||
systemctl start cron
|
||||
|
@ -413,7 +433,11 @@ function restore_remote_syncthing {
|
|||
temp_restore_dir=/root/tempsyncthingshared
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir syncthingshared
|
||||
cp -r $temp_restore_dir/* /
|
||||
#cp -r $temp_restore_dir/* /
|
||||
if [ ! -d /var/lib/syncthing/SyncShared ]; then
|
||||
mkdir -p /var/lib/syncthing/SyncShared
|
||||
fi
|
||||
cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
systemctl start syncthing
|
||||
systemctl start cron
|
||||
|
@ -433,7 +457,11 @@ function restore_remote_syncthing {
|
|||
temp_restore_dir=/root/tempsyncthing
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir syncthing/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/Sync ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/Sync/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
systemctl start syncthing
|
||||
|
|
|
@ -298,13 +298,22 @@ function restore_local_tahoelafs {
|
|||
systemctl stop tahoelafs-client
|
||||
temp_restore_dir=/root/temptahoelafs
|
||||
restore_directory_from_usb $temp_restore_dir tahoelafs
|
||||
mv $TAHOE_DIR ${TAHOE_DIR}-old
|
||||
cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
|
||||
if [ -d $temp_restore_dir$TAHOE_DIR ]; then
|
||||
mv $TAHOE_DIR ${TAHOE_DIR}-old
|
||||
cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
|
||||
else
|
||||
cp -r $temp_restore_dir/* $TAHOE_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
mv ${TAHOE_DIR}-old $TAHOE_DIR
|
||||
if [ -d ${TAHOE_DIR}-old ]; then
|
||||
mv ${TAHOE_DIR}-old $TAHOE_DIR
|
||||
fi
|
||||
exit 246833
|
||||
fi
|
||||
rm -rf ${TAHOE_DIR}-old
|
||||
if [ -d ${TAHOE_DIR}-old ]; then
|
||||
rm -rf ${TAHOE_DIR}-old
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
chown -R tahoelafs:debian-tor $TAHOE_DIR
|
||||
systemctl start tahoelafs-client
|
||||
systemctl start tahoelafs-storage
|
||||
|
@ -331,13 +340,22 @@ function restore_remote_tahoelafs {
|
|||
systemctl stop tahoelafs-client
|
||||
temp_restore_dir=/root/temptahoelafs
|
||||
restore_directory_from_friend $temp_restore_dir tahoelafs
|
||||
mv $TAHOE_DIR ${TAHOE_DIR}-old
|
||||
cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
|
||||
if [ -d $temp_restore_dir$TAHOE_DIR ]; then
|
||||
mv $TAHOE_DIR ${TAHOE_DIR}-old
|
||||
cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
|
||||
else
|
||||
cp -r $temp_restore_dir/* $TAHOE_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
mv ${TAHOE_DIR}old $TAHOE_DIR
|
||||
if [ -d ${$TAHOE_DIR}-old ]; then
|
||||
mv ${TAHOE_DIR}-old $TAHOE_DIR
|
||||
fi
|
||||
exit 623925
|
||||
fi
|
||||
rm -rf ${$TAHOE_DIR}-old
|
||||
if [ -d ${$TAHOE_DIR}-old ]; then
|
||||
rm -rf ${$TAHOE_DIR}-old
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
chown -R tahoelafs:debian-tor $TAHOE_DIR
|
||||
systemctl start tahoelafs-client
|
||||
systemctl start tahoelafs-storage
|
||||
|
|
|
@ -213,7 +213,8 @@ function restore_local_tox {
|
|||
if [ -d $USB_MOUNT/backup/tox ]; then
|
||||
echo $"Restoring Tox node settings"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb / tox
|
||||
#restore_directory_from_usb / tox
|
||||
restore_directory_from_usb /var/lib/tox-bootstrapd tox
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -250,7 +251,8 @@ function restore_remote_tox {
|
|||
if [ -d $SERVER_DIRECTORY/backup/tox ]; then
|
||||
echo $"Restoring Tox node settings"
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend / tox
|
||||
#restore_directory_from_friend / tox
|
||||
restore_directory_from_friend /var/lib/tox-bootstrapd tox
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 93653
|
||||
fi
|
||||
|
|
|
@ -249,18 +249,14 @@ function restore_local_turtl {
|
|||
if [ $TURTL_DOMAIN_NAME ]; then
|
||||
temp_restore_dir=/root/tempturtl
|
||||
restore_directory_from_usb $temp_restore_dir turtl
|
||||
if [ -d $TURTL_BASE_DIR ]; then
|
||||
if [ -d /etc/turtl_previous ]; then
|
||||
rm -rf /etc/turtl_previous
|
||||
fi
|
||||
mv $TURTL_BASE_DIR /etc/turtl_previous
|
||||
|
||||
if [ -d ${temp_restore_dir}/etc/turtl ]; then
|
||||
cp -r ${temp_restore_dir}/etc/turtl/* /etc/turtl/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /etc/turtl/
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name turtl)
|
||||
cp -r ${temp_source_dir} /etc/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /etc/turtl_previous ]; then
|
||||
mv /etc/turtl_previous $TURTL_BASE_DIR
|
||||
fi
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 36723
|
||||
|
@ -270,18 +266,14 @@ function restore_local_turtl {
|
|||
|
||||
temp_restore_dir=/root/temprethinkdb
|
||||
restore_directory_from_usb $temp_restore_dir rethinkdb
|
||||
if [ -d /var/lib/rethinkdb ]; then
|
||||
if [ -d /var/lib/previous_rethinkdb ]; then
|
||||
rm -rf /var/lib/previous_rethinkdb
|
||||
fi
|
||||
mv /var/lib/rethinkdb /var/lib/previous_rethinkdb
|
||||
|
||||
if [ -d ${temp_restore_dir}/var/lib/rethinkdb ]; then
|
||||
cp -r ${temp_restore_dir}/var/lib/rethinkdb/* /var/lib/rethinkdb/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /var/lib/rethinkdb/
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name rethinkdb)
|
||||
cp -r ${temp_source_dir} /var/lib/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/lib/previous_rethinkdb ]; then
|
||||
mv /var/lib/previous_rethinkdb /var/lib/rethinkdb
|
||||
fi
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 378324
|
||||
|
@ -319,18 +311,18 @@ function restore_remote_turtl {
|
|||
mkdir $temp_restore_dir
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir turtl
|
||||
if [ -d $TURTL_BASE_DIR ]; then
|
||||
if [ -d /etc/turtl_previous ]; then
|
||||
rm -rf /etc/turtl_previous
|
||||
fi
|
||||
mv $TURTL_BASE_DIR /etc/turtl_previous
|
||||
|
||||
if [ -d ${temp_restore_dir}/etc/turtl ]; then
|
||||
cp -r ${temp_restore_dir}/etc/turtl/* /etc/turtl/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /etc/turtl/
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name turtl)
|
||||
cp -r ${temp_source_dir} /etc/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /etc/turtl_previous ]; then
|
||||
mv /etc/turtl_previous $TURTL_BASE_DIR
|
||||
fi
|
||||
set_user_permissions
|
||||
exit 37823
|
||||
fi
|
||||
rm -rf ${temp_restore_dir}
|
||||
|
@ -339,18 +331,15 @@ function restore_remote_turtl {
|
|||
mkdir $temp_restore_dir
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir rethinkdb
|
||||
if [ -d /var/lib/rethinkdb ]; then
|
||||
if [ -d /var/lib/previous_rethinkdb ]; then
|
||||
rm -rf /var/lib/previous_rethinkdb
|
||||
fi
|
||||
mv /var/lib/rethinkdb /var/lib/previous_rethinkdb
|
||||
|
||||
if [ -d ${temp_restore_dir}/var/lib/rethinkdb ]; then
|
||||
cp -r ${temp_restore_dir}/var/lib/rethinkdb/* /var/lib/rethinkdb/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /var/lib/rethinkdb/
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name rethinkdb)
|
||||
cp -r ${temp_source_dir} /var/lib/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/lib/previous_rethinkdb ]; then
|
||||
mv /var/lib/previous_rethinkdb /var/lib/rethinkdb
|
||||
fi
|
||||
set_user_permissions
|
||||
exit 26783
|
||||
fi
|
||||
rm -rf ${temp_restore_dir}
|
||||
|
|
|
@ -100,7 +100,14 @@ function restore_local_vim {
|
|||
echo $"Restoring Vim config for $USERNAME"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir vim/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR /home/$USERNAME/
|
||||
else
|
||||
if [ ! -d /home/$USERNAME/$VIM_TEMP_DIR ]; then
|
||||
mkdir /home/$USERNAME/$VIM_TEMP_DIR
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/$VIM_TEMP_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
@ -168,7 +175,14 @@ function restore_remote_vim {
|
|||
echo $"Restoring Vim config for $USERNAME"
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir vim/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/$VIM_TEMP_DIR /home/$USERNAME/
|
||||
else
|
||||
if [ ! -d /home/$USERNAME/$VIM_TEMP_DIR ]; then
|
||||
mkdir /home/$USERNAME/$VIM_TEMP_DIR
|
||||
fi
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/$VIM_TEMP_DIR/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
function_check set_user_permissions
|
||||
|
|
|
@ -134,8 +134,12 @@ function restore_local_wekan {
|
|||
temp_restore_dir=/root/tempwekan
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir wekan
|
||||
cp -r $temp_restore_dir$WEKAN_DIR/data/* $WEKAN_DIR/data/
|
||||
|
||||
if [ -d $temp_restore_dir$WEKAN_DIR/data ]; then
|
||||
cp -r $temp_restore_dir$WEKAN_DIR/data/* $WEKAN_DIR/data/
|
||||
else
|
||||
cp -r $temp_restore_dir/* $WEKAN_DIR/data/
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
systemctl start wekan
|
||||
fi
|
||||
}
|
||||
|
@ -177,8 +181,12 @@ function restore_remote_wekan {
|
|||
temp_restore_dir=/root/tempwekan
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_friend $temp_restore_dir wekan
|
||||
cp -r $temp_restore_dir$WEKAN_DIR/data/* $WEKAN_DIR/data/
|
||||
|
||||
if [ -d $temp_restore_dir$WEKAN_DIR/data ]; then
|
||||
cp -r $temp_restore_dir$WEKAN_DIR/data/* $WEKAN_DIR/data/
|
||||
else
|
||||
cp -r $temp_restore_dir/* $WEKAN_DIR/data/
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
systemctl start wekan
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -460,7 +460,11 @@ function restore_local_xmpp {
|
|||
temp_restore_dir=/root/tempxmpp
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir xmpp
|
||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||
if [ -d $temp_restore_dir/var/lib/prosody ]; then
|
||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/lib/prosody/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
set_user_permissions
|
||||
|
@ -489,7 +493,11 @@ function restore_remote_xmpp {
|
|||
temp_restore_dir=/root/tempxmpp
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir xmpp
|
||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||
if [ -d $temp_restore_dir/var/lib/prosody ]; then
|
||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/lib/prosody/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 725
|
||||
fi
|
||||
|
|
|
@ -123,8 +123,10 @@ function restore_blocklist {
|
|||
temp_restore_dir=/root/tempblocklist
|
||||
restore_directory_from_usb $temp_restore_dir blocklist
|
||||
|
||||
if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||
if [ -d $temp_restore_dir/root/tempbackupblocklist ]; then
|
||||
cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||
else
|
||||
cp -f $temp_restore_dir/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||
fi
|
||||
|
||||
rm -rf $temp_restore_dir
|
||||
|
@ -146,13 +148,25 @@ function restore_configfiles {
|
|||
temp_restore_dir=/root/tempconfigfiles
|
||||
restore_directory_from_usb $temp_restore_dir configfiles
|
||||
|
||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
if [ -d $temp_restore_dir/root ]; then
|
||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
if [ -f $temp_restore_dir/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -196,8 +210,14 @@ function restore_configfiles {
|
|||
fi
|
||||
|
||||
# restore nginx password hashes
|
||||
if [ -f $temp_restore_dir/root/htpasswd ]; then
|
||||
cp -f $temp_restore_dir/root/htpasswd /etc/nginx/.htpasswd
|
||||
if [ -d $temp_restore_dir/root ]; then
|
||||
if [ -f $temp_restore_dir/root/htpasswd ]; then
|
||||
cp -f $temp_restore_dir/root/htpasswd /etc/nginx/.htpasswd
|
||||
fi
|
||||
else
|
||||
if [ -f $temp_restore_dir/htpasswd ]; then
|
||||
cp -f $temp_restore_dir/htpasswd /etc/nginx/.htpasswd
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf $temp_restore_dir
|
||||
|
@ -238,11 +258,19 @@ function restore_mariadb {
|
|||
db_pass=$(cat /root/.mariadboriginal)
|
||||
if [ ${#db_pass} -gt 0 ]; then
|
||||
echo $"Restore the MariaDB user table"
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
if [ -d ${temp_restore_dir}${temp_restore_dir} ]; then
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
else
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}/mysql.sql)
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $"Try again using the password obtained from backup"
|
||||
db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
if [ -d ${temp_restore_dir}${temp_restore_dir} ]; then
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
else
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}/mysql.sql)
|
||||
fi
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "$mysqlsuccess"
|
||||
|
@ -269,7 +297,8 @@ function restore_letsencrypt {
|
|||
fi
|
||||
if [ -d $USB_MOUNT/backup/letsencrypt ]; then
|
||||
echo $"Restoring Lets Encrypt settings"
|
||||
restore_directory_from_usb / letsencrypt
|
||||
#restore_directory_from_usb / letsencrypt
|
||||
restore_directory_from_usb /etc/letsencrypt letsencrypt
|
||||
chgrp -R ssl-cert /etc/letsencrypt
|
||||
chmod -R g=rX /etc/letsencrypt
|
||||
fi
|
||||
|
@ -284,7 +313,8 @@ function restore_passwordstore {
|
|||
if [ -d $USB_MOUNT/backup/passwordstore ]; then
|
||||
store_original_mariadb_password
|
||||
echo $"Restoring password store"
|
||||
restore_directory_from_usb / passwordstore
|
||||
#restore_directory_from_usb / passwordstore
|
||||
restore_directory_from_usb /root/.passwords passwordstore
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -296,7 +326,8 @@ function restore_tor {
|
|||
fi
|
||||
if [ -d $USB_MOUNT/backup/tor ]; then
|
||||
echo $"Restoring Tor settings"
|
||||
restore_directory_from_usb / tor
|
||||
#restore_directory_from_usb / tor
|
||||
restore_directory_from_usb /var/lib/tor tor
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -316,15 +347,28 @@ function restore_mutt_settings {
|
|||
echo $"Restoring Mutt settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempmutt
|
||||
restore_directory_from_usb $temp_restore_dir mutt/$USERNAME
|
||||
if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/tempbackup ]; then
|
||||
if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
fi
|
||||
else
|
||||
if [ -f $temp_restore_dir/.muttrc ]; then
|
||||
cp -f $temp_restore_dir/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f $temp_restore_dir/Muttrc ]; then
|
||||
cp -f $temp_restore_dir/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
fi
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
|
@ -353,7 +397,11 @@ function restore_gpg {
|
|||
echo $"Restoring gnupg settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempgnupg
|
||||
restore_directory_from_usb $temp_restore_dir gnupg/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.gnupg /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.gnupg ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.gnupg /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.gnupg/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -393,7 +441,11 @@ function restore_procmail {
|
|||
temp_restore_dir=/root/tempprocmail
|
||||
restore_directory_from_usb $temp_restore_dir procmail/$USERNAME
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.procmailrc /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.procmailrc /home/$USERNAME/
|
||||
else
|
||||
cp -f $temp_restore_dir/.procmailrc /home/$USERNAME/.procmailrc
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -424,7 +476,11 @@ function restore_spamassassin {
|
|||
echo $"Restoring spamassassin settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempspamassassin
|
||||
restore_directory_from_usb $temp_restore_dir spamassassin/$USERNAME
|
||||
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME ]; then
|
||||
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
|
||||
else
|
||||
cp -rf $temp_restore_dir/* /home/$USERNAME/.spamassassin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -457,7 +513,11 @@ function restore_admin_readme {
|
|||
|
||||
temp_restore_dir=/root/tempreadme
|
||||
restore_directory_from_usb $temp_restore_dir readme
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/README /home/$ADMIN_USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/README /home/$ADMIN_USERNAME/
|
||||
else
|
||||
cp -f $temp_restore_dir/README /home/$ADMIN_USERNAME/README
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -484,7 +544,11 @@ function restore_user_ssh_keys {
|
|||
echo $"Restoring ssh keys for $USERNAME"
|
||||
temp_restore_dir=/root/tempssh
|
||||
restore_directory_from_usb $temp_restore_dir ssh/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.ssh ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.ssh/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -513,7 +577,11 @@ function restore_user_config {
|
|||
echo $"Restoring config files for $USERNAME"
|
||||
temp_restore_dir=/root/tempconfig
|
||||
restore_directory_from_usb $temp_restore_dir config/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.config /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.config ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.config /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.config/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -542,7 +610,11 @@ function restore_user_monkeysphere {
|
|||
echo $"Restoring monkeysphere ids for $USERNAME"
|
||||
temp_restore_dir=/root/tempmonkeysphere
|
||||
restore_directory_from_usb $temp_restore_dir monkeysphere/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.monkeysphere ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.monkeysphere
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -579,7 +651,11 @@ function restore_user_fin {
|
|||
echo $"Restoring fin files for $USERNAME"
|
||||
temp_restore_dir=/root/tempfin
|
||||
restore_directory_from_usb $temp_restore_dir fin/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.fin ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.fin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -608,7 +684,11 @@ function restore_user_local {
|
|||
echo $"Restoring local files for $USERNAME"
|
||||
temp_restore_dir=/root/templocal
|
||||
restore_directory_from_usb $temp_restore_dir local/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.local ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.local/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
set_user_permissions
|
||||
|
@ -631,7 +711,11 @@ function restore_certs {
|
|||
echo $"Restoring certificates"
|
||||
mkdir /root/tempssl
|
||||
restore_directory_from_usb /root/tempssl ssl
|
||||
cp -r /root/tempssl/etc/ssl/* /etc/ssl
|
||||
if [ -d /root/tempssl/etc/ssl ]; then
|
||||
cp -r /root/tempssl/etc/ssl/* /etc/ssl
|
||||
else
|
||||
cp -r /root/tempssl/* /etc/ssl/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -686,7 +770,11 @@ function restore_personal_settings {
|
|||
if [ -d /home/$USERNAME/personal ]; then
|
||||
rm -rf /home/$USERNAME/personal
|
||||
fi
|
||||
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/personal ]; then
|
||||
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/personal/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -709,7 +797,11 @@ function restore_mailing_list {
|
|||
echo $"Restoring public mailing list"
|
||||
temp_restore_dir=/root/tempmailinglist
|
||||
restore_directory_from_usb $temp_restore_dir mailinglist
|
||||
cp -r $temp_restore_dir/root/spool/mlmmj/* /var/spool/mlmmj
|
||||
if [ -d $temp_restore_dir/root/spool/mlmmj ]; then
|
||||
cp -r $temp_restore_dir/root/spool/mlmmj/* /var/spool/mlmmj
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/spool/mlmmj/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
@ -738,11 +830,15 @@ function restore_email {
|
|||
if [ ! -d /home/$USERNAME/Maildir ]; then
|
||||
mkdir /home/$USERNAME/Maildir
|
||||
fi
|
||||
tar -xzvf $temp_restore_dir/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
||||
if [ -d $temp_restore_dir/root/tempbackupemail/$USERNAME ]; then
|
||||
tar -xzvf $temp_restore_dir/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
||||
else
|
||||
tar -xzvf $temp_restore_dir/maildir.tar.gz -C /
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 927
|
||||
exit 9276382
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
|
|
@ -113,10 +113,11 @@ function restore_blocklist {
|
|||
echo $"Restoring blocklist"
|
||||
temp_restore_dir=/root/tempblocklist
|
||||
restore_directory_from_friend $temp_restore_dir blocklist
|
||||
restore_directory_from_usb $temp_restore_dir blocklist
|
||||
|
||||
if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
|
||||
if [ -d $temp_restore_dir/root/tempbackupblocklist ]; then
|
||||
cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||
else
|
||||
cp -f $temp_restore_dir/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
|
||||
fi
|
||||
|
||||
rm -rf $temp_restore_dir
|
||||
|
@ -136,13 +137,25 @@ function restore_configfiles {
|
|||
temp_restore_dir=/root/tempconfigfiles
|
||||
restore_directory_from_friend $temp_restore_dir configfiles
|
||||
|
||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
if [ -d $temp_restore_dir/root ]; then
|
||||
if [ -f $temp_restore_dir/root/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
if [ -f $temp_restore_dir/.nostore ]; then
|
||||
if [ ! -f /root/.nostore ]; then
|
||||
touch /root/.nostore
|
||||
fi
|
||||
else
|
||||
if [ -f /root/.nostore ]; then
|
||||
rm /root/.nostore
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -214,11 +227,19 @@ function restore_mariadb {
|
|||
db_pass=$(cat /root/.mariadboriginal)
|
||||
if [ ${#db_pass} -gt 0 ]; then
|
||||
echo $"Restore the MariaDB user table"
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
if [ -d ${temp_restore_dir}${temp_restore_dir} ]; then
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
else
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}/mysql.sql)
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $"Try again using the password obtained from backup"
|
||||
db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
if [ -d ${temp_restore_dir}${temp_restore_dir} ]; then
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
|
||||
else
|
||||
mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}/mysql.sql)
|
||||
fi
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "$mysqlsuccess"
|
||||
|
@ -242,7 +263,7 @@ function restore_letsencrypt {
|
|||
fi
|
||||
if [ -d $SERVER_DIRECTORY/backup/letsencrypt ]; then
|
||||
echo $"Restoring Lets Encrypt settings"
|
||||
restore_directory_from_friend / letsencrypt
|
||||
restore_directory_from_friend /etc/letsencrypt letsencrypt
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -255,7 +276,7 @@ function restore_passwordstore {
|
|||
if [ -d $SERVER_DIRECTORY/backup/passwordstore ]; then
|
||||
store_original_mariadb_password
|
||||
echo $"Restoring password store"
|
||||
restore_directory_from_friend / passwordstore
|
||||
restore_directory_from_friend /root/.passwords passwordstore
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -267,7 +288,7 @@ function restore_tor {
|
|||
fi
|
||||
if [ -d $SERVER_DIRECTORY/backup/tor ]; then
|
||||
echo $"Restoring Tor settings"
|
||||
restore_directory_from_friend / tor
|
||||
restore_directory_from_friend /var/lib/tor tor
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -287,15 +308,28 @@ function restore_mutt_settings {
|
|||
echo $"Restoring Mutt settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempmutt
|
||||
restore_directory_from_friend ${temp_restore_dir} mutt/$USERNAME
|
||||
if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
if [ -d ${temp_restore_dir}/home/$USERNAME/tempbackup ]; then
|
||||
if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
fi
|
||||
else
|
||||
if [ -f ${temp_restore_dir}/.muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/.muttrc /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
|
||||
sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
|
||||
fi
|
||||
if [ -f ${temp_restore_dir}/Muttrc ]; then
|
||||
cp -f ${temp_restore_dir}/Muttrc /etc/Muttrc
|
||||
sed -i '/set sidebar_delim/d' /etc/Muttrc
|
||||
sed -i '/set sidebar_sort/d' /etc/Muttrc
|
||||
fi
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf ${temp_restore_dir}
|
||||
|
@ -322,7 +356,11 @@ function restore_gpg {
|
|||
echo $"Restoring gnupg settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempgnupg
|
||||
restore_directory_from_friend ${temp_restore_dir} gnupg/$USERNAME
|
||||
cp -r ${temp_restore_dir}/home/$USERNAME/.gnupg /home/$USERNAME/
|
||||
if [ -d ${temp_restore_dir}/home/$USERNAME/.gnupg ]; then
|
||||
cp -r ${temp_restore_dir}/home/$USERNAME/.gnupg /home/$USERNAME/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/$USERNAME/.gnupg/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf ${temp_restore_dir}
|
||||
exit 276
|
||||
|
@ -356,7 +394,11 @@ function restore_procmail {
|
|||
echo $"Restoring procmail settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempprocmail
|
||||
restore_directory_from_friend ${temp_restore_dir} procmail/$USERNAME
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.procmailrc /home/$USERNAME/
|
||||
if [ -d ${temp_restore_dir}/home/$USERNAME/tempbackup ]; then
|
||||
cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.procmailrc /home/$USERNAME/
|
||||
else
|
||||
cp -f ${temp_restore_dir}/.procmailrc /home/$USERNAME/.procmailrc
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf ${temp_restore_dir}
|
||||
exit 276
|
||||
|
@ -383,7 +425,11 @@ function restore_spamassassin {
|
|||
echo $"Restoring spamassassin settings for $USERNAME"
|
||||
temp_restore_dir=/root/tempspamassassin
|
||||
restore_directory_from_friend $temp_restore_dir spamassassin/$USERNAME
|
||||
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME ]; then
|
||||
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
|
||||
else
|
||||
cp -rf $temp_restore_dir/* /home/$USERNAME/.spamassassin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 276
|
||||
|
@ -404,7 +450,11 @@ function restore_admin_readme {
|
|||
echo $"Restoring README"
|
||||
temp_restore_dir=/root/tempreadme
|
||||
restore_directory_from_friend $temp_restore_dir readme
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/README /home/$ADMIN_USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/README /home/$ADMIN_USERNAME/
|
||||
else
|
||||
cp -f $temp_restore_dir/README /home/$ADMIN_USERNAME/README
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 276
|
||||
|
@ -429,7 +479,11 @@ function restore_ssh_keys {
|
|||
echo $"Restoring ssh keys for $USERNAME"
|
||||
temp_restore_dir=/root/tempssh
|
||||
restore_directory_from_friend $temp_restore_dir ssh/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.ssh ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.ssh/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 664
|
||||
|
@ -456,7 +510,11 @@ function restore_user_config {
|
|||
echo $"Restoring config files for $USERNAME"
|
||||
temp_restore_dir=/root/tempconfig
|
||||
restore_directory_from_friend $temp_restore_dir config/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.config /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.config /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.config/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 664
|
||||
|
@ -483,7 +541,11 @@ function restore_user_monkeysphere {
|
|||
echo $"Restoring monkeysphere ids for $USERNAME"
|
||||
temp_restore_dir=/root/tempmonkeysphere
|
||||
restore_directory_from_friend $temp_restore_dir monkeysphere/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.monkeysphere ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.monkeysphere/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 664
|
||||
|
@ -518,7 +580,11 @@ function restore_user_fin {
|
|||
echo $"Restoring fin files for $USERNAME"
|
||||
temp_restore_dir=/root/tempfin
|
||||
restore_directory_from_friend $temp_restore_dir fin/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.fin ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.fin/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 664
|
||||
|
@ -545,7 +611,11 @@ function restore_user_local {
|
|||
echo $"Restoring local files for $USERNAME"
|
||||
temp_restore_dir=/root/templocal
|
||||
restore_directory_from_friend $temp_restore_dir local/$USERNAME
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/.local ]; then
|
||||
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/.local/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -rf $temp_restore_dir
|
||||
exit 664
|
||||
|
@ -565,7 +635,11 @@ function restore_certs {
|
|||
if [ -d $SERVER_DIRECTORY/backup/ssl ]; then
|
||||
echo $"Restoring certificates"
|
||||
restore_directory_from_friend /root/tempssl ssl
|
||||
cp -r /root/tempssl/etc/ssl/* /etc/ssl
|
||||
if [ -d /root/tempssl/etc/ssl ]; then
|
||||
cp -r /root/tempssl/etc/ssl/* /etc/ssl
|
||||
else
|
||||
cp -r /root/tempssl/* /etc/ssl/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 276
|
||||
fi
|
||||
|
@ -614,12 +688,16 @@ function restore_personal_settings {
|
|||
echo $"Restoring personal settings for $USERNAME"
|
||||
temp_restore_dir=/root/temppersonal
|
||||
restore_directory_from_friend $temp_restore_dir personal/$USERNAME
|
||||
if [ -d /home/$USERNAME/personal ]; then
|
||||
rm -rf /home/$USERNAME/personal
|
||||
if [ -d $temp_restore_dir/home/$USERNAME/personal ]; then
|
||||
if [ -d /home/$USERNAME/personal ]; then
|
||||
rm -rf /home/$USERNAME/personal
|
||||
fi
|
||||
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
|
||||
else
|
||||
cp -r $temp_restore_dir/* /home/$USERNAME/personal/
|
||||
fi
|
||||
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 184
|
||||
exit 18437643
|
||||
fi
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
@ -637,7 +715,11 @@ function restore_mailing_list {
|
|||
echo $"Restoring public mailing list"
|
||||
temp_restore_dir=/root/tempmailinglist
|
||||
restore_directory_from_friend $temp_restore_dir mailinglist
|
||||
cp -r $temp_restore_dir/root/spool/mlmmj/* /var/spool/mlmmj
|
||||
if [ -d $temp_restore_dir/root/spool/mlmmj ]; then
|
||||
cp -r $temp_restore_dir/root/spool/mlmmj/* /var/spool/mlmmj
|
||||
else
|
||||
cp -r $temp_restore_dir/* /var/spool/mlmmj/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 526
|
||||
fi
|
||||
|
@ -664,7 +746,11 @@ function restore_email {
|
|||
if [ ! -d /home/$USERNAME/Maildir ]; then
|
||||
mkdir /home/$USERNAME/Maildir
|
||||
fi
|
||||
tar -xzvf $temp_restore_dir/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
||||
if [ -d $temp_restore_dir/root/tempbackupemail/$USERNAME ]; then
|
||||
tar -xzvf $temp_restore_dir/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
|
||||
else
|
||||
tar -xzvf $temp_restore_dir/maildir.tar.gz -C /
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 927
|
||||
fi
|
||||
|
|
|
@ -628,7 +628,11 @@ function restore_database_from_friend {
|
|||
echo $"Restoring ${1} database"
|
||||
local_database_dir=/root/temp${1}data
|
||||
restore_directory_from_friend ${local_database_dir} ${1}data
|
||||
if [ ! -f ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/${1}.sql ]; then
|
||||
database_file=${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data/${restore_app_name}.sql
|
||||
if [ ! -f $database_file ]; then
|
||||
database_file=${local_database_dir}/${restore_app_name}.sql
|
||||
fi
|
||||
if [ ! -f $database_file ]; then
|
||||
echo $"Unable to restore ${1} database"
|
||||
rm -rf ${local_database_dir}
|
||||
exit 503
|
||||
|
@ -639,21 +643,35 @@ function restore_database_from_friend {
|
|||
echo "$mysqlsuccess"
|
||||
exit 964
|
||||
fi
|
||||
shred -zu ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
if [ -d ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data ]; then
|
||||
shred -zu ${local_database_dir}/${RESTORE_SUBDIR}/temp${1}data/*
|
||||
else
|
||||
shred -zu ${local_database_dir}/*.sql
|
||||
fi
|
||||
rm -rf ${local_database_dir}
|
||||
echo $"Restoring ${1} installation"
|
||||
restore_directory_from_friend /root/temp${1} ${1}
|
||||
RESTORE_SUBDIR="var"
|
||||
if [ ${1} ]; then
|
||||
# create directory to restore to
|
||||
if [ ! -d /var/www/${2}/htdocs ]; then
|
||||
mkdir -p /var/www/${2}/htdocs
|
||||
chown www-data:www-data /var/www/${2}/htdocs
|
||||
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
|
||||
mv /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs /var/www/${2}/
|
||||
restore_from_dir=/root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs
|
||||
if [ ! -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then
|
||||
restore_from_dir=/root/temp${1}
|
||||
fi
|
||||
|
||||
if [ -d $restore_from_dir ]; then
|
||||
if [ -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then
|
||||
rm -rf /var/www/${2}/htdocs
|
||||
mv $restore_from_dir /var/www/${2}/
|
||||
else
|
||||
cp -r $restore_from_dir/* /var/www/${2}/htdocs/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 683
|
||||
fi
|
||||
|
@ -685,7 +703,11 @@ function restore_database {
|
|||
fi
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb "${local_database_dir}" "${restore_app_name}data"
|
||||
if [ ! -f /root/temp${restore_app_name}data/${RESTORE_SUBDIR}/temp${restore_app_name}data/${restore_app_name}.sql ]; then
|
||||
database_file=${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data/${restore_app_name}.sql
|
||||
if [ ! -f $database_file ]; then
|
||||
database_file=${local_database_dir}/${restore_app_name}.sql
|
||||
fi
|
||||
if [ ! -f $database_file ]; then
|
||||
echo $"Unable to restore ${restore_app_name} database"
|
||||
rm -rf ${local_database_dir}
|
||||
function_check set_user_permissions
|
||||
|
@ -695,7 +717,7 @@ function restore_database {
|
|||
exit 503
|
||||
fi
|
||||
keep_database_running
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${restore_app_name} -o < ${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data/${restore_app_name}.sql)
|
||||
mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" ${restore_app_name} -o < $database_file)
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "$mysqlsuccess"
|
||||
function_check set_user_permissions
|
||||
|
@ -704,7 +726,12 @@ function restore_database {
|
|||
backup_unmount_drive
|
||||
exit 964
|
||||
fi
|
||||
shred -zu ${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data/*
|
||||
if [ -d ${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data ]; then
|
||||
shred -zu ${local_database_dir}/${RESTORE_SUBDIR}/temp${restore_app_name}data/*
|
||||
else
|
||||
shred -zu ${local_database_dir}/*.sql
|
||||
fi
|
||||
|
||||
rm -rf ${local_database_dir}
|
||||
echo $"Restoring ${restore_app_name} installation"
|
||||
if [ ! -d /root/temp${restore_app_name} ]; then
|
||||
|
@ -714,14 +741,24 @@ function restore_database {
|
|||
restore_directory_from_usb "/root/temp${restore_app_name}" "${restore_app_name}"
|
||||
RESTORE_SUBDIR="var"
|
||||
if [ ${restore_app_domain} ]; then
|
||||
# create directory to restore to
|
||||
if [ ! -d /var/www/${restore_app_domain}/htdocs ]; then
|
||||
mkdir -p /var/www/${restore_app_domain}/htdocs
|
||||
chown www-data:www-data /var/www/${restore_app_domain}/htdocs
|
||||
fi
|
||||
|
||||
if [ -d /var/www/${restore_app_domain}/htdocs ]; then
|
||||
if [ -d /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs ]; then
|
||||
rm -rf /var/www/${restore_app_domain}/htdocs
|
||||
mv /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs /var/www/${restore_app_domain}/
|
||||
restore_from_dir=/root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs
|
||||
if [ ! -d $restore_from_dir ]; then
|
||||
restore_from_dir=/root/temp${restore_app_name}
|
||||
fi
|
||||
if [ -d $restore_from_dir ]; then
|
||||
if [ -d /root/temp${restore_app_name}/${RESTORE_SUBDIR}/www/${restore_app_domain}/htdocs ]; then
|
||||
rm -rf /var/www/${restore_app_domain}/htdocs
|
||||
mv $restore_from_dir /var/www/${restore_app_domain}/
|
||||
else
|
||||
cp -r $restore_from_dir/* /var/www/${restore_app_domain}/htdocs/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
|
|
Loading…
Reference in New Issue