aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/backup-restore-svn
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydractl/backup-restore-svn')
-rwxr-xr-xshare/hydractl/backup-restore-svn37
1 files changed, 10 insertions, 27 deletions
diff --git a/share/hydractl/backup-restore-svn b/share/hydractl/backup-restore-svn
index 1425fdf..a4c90a5 100755
--- a/share/hydractl/backup-restore-svn
+++ b/share/hydractl/backup-restore-svn
@@ -22,40 +22,23 @@ hydra_config_load
# Parameters.
DATE="`date +%Y%m%d`"
+HOST="$1"
+SERVICE="svn"
+SERVICE_DIR="/var/svn"
+SERVICE_USER="svn"
+SERVICE_GROUP="svn"
-# Check restore strategy.
-if [ "$1" == "localhost" ] || [ "$1" == "`facter hostname`" ]; then
- hydra_backup_environment_local
-else
- hydra_backup_environment_remote $1 restore
-fi
-
-# Check if folder exist on the backup.
-if [ -d "$RESTOREDIR/var/svn" ]; then
- echo "SVN folder does not exist: $RESTOREDIR/var/svn"
- exit 1
-fi
+# Set restore environment.
+hydra_backup_environment_service
# Backup it.
+# TODO: directly at hydra_backup_environment_service
hydractl backup-site svn
-# Set svn user.
-if hydra_check_user svn; then
- SVN_USER="svn"
-else
- SVN_USER="root"
-fi
-
-# Set svn group.
-if hydra_check_group svn; then
- SVN_GROUP="svn"
-else
- SVN_GROUP="root"
-fi
-
# Copy site folder from backup.
cp -a $RESTOREDIR/var/svn /var/svn
# Fix permissions.
chown root.root /var/svn
-chown -R $SVN_USER.$SVN_GROUP /var/svn/*
+chown -R $SERVICE_USER.$SERVICE_GROUP /var/svn/*
+