1.1 --- a/vcs-backup.sh Fri Apr 19 18:56:46 2019 +0200
1.2 +++ b/vcs-backup.sh Fri Apr 19 23:25:19 2019 +0200
1.3 @@ -24,7 +24,7 @@
1.4 VCS_BACKUP_CONFIG_DIR="$VCS_BACKUP_DATA_DIR/config";
1.5 VCS_BACKUP_SNAPSHOT_DIR="$VCS_BACKUP_DATA_DIR/snapshot";
1.6 VCS_BACKUP_SUBVOLUME_SOCKET="/run/vcs-backup-subvolume";
1.7 -VCS_BACKUP_CLONE_SOCKET="/run/vcs-backup-clone";
1.8 +VCS_BACKUP_CLONE_SOCKET="/run/vcs-backup-clone/socket";
1.9 VCS_BACKUP_CLONE_CALLBACK_SOCKET="clone-callback";
1.10 VCS_BACKUP_USER="vcs-backup";
1.11 VCS_BACKUP_MANAGER="vcs-backup-manager";
1.12 @@ -39,7 +39,9 @@
1.13 mkdir "$VCS_BACKUP_CURRENT_DIR";
1.14 mkdir "$VCS_BACKUP_CONFIG_DIR";
1.15 mkdir "$VCS_BACKUP_SNAPSHOT_DIR";
1.16 +mkdir "$(dirname VCS_BACKUP_CLONE_SOCKET)"
1.17
1.18 +chown "${VCS_BACKUP_USER}:${VCS_BACKUP_USER}" "$(dirname VCS_BACKUP_CLONE_SOCKET)"
1.19 chown "${VCS_BACKUP_USER}:${VCS_BACKUP_USER}" "$VCS_BACKUP_CURRENT_DIR"
1.20 chown "${VCS_BACKUP_MANAGER}:${VCS_BACKUP_MANAGER}" "$VCS_BACKUP_CONFIG_DIR"
1.21 }
1.22 @@ -54,7 +56,7 @@
1.23
1.24 # Environment: all
1.25 # $1 = path to the config file
1.26 -loadConfigFile() { if [ -f "$1" ]; then . "$1"; else echo "Missing config file: $1" >&2; exit 1; fi }
1.27 +loadConfigFile() { if [ -f "$1" ]; then . "$1"; fi }
1.28
1.29 # Environment: server
1.30 # $1 = URL
1.31 @@ -83,6 +85,7 @@
1.32 }
1.33
1.34 # Environment: server
1.35 +# User: $VCS_BACKUP_MANAGER
1.36 # has same parameters as clientSubmitBackupRequest (see above)
1.37 vcs_backup_public_serverSubmitBackupRequest() {
1.38 if isValidTypeAndURL "$1" "$2"; then
1.39 @@ -113,6 +116,7 @@
1.40 }
1.41
1.42 # Environment: server
1.43 +# User: root
1.44 # Should be started as a systemd/init service.
1.45 # - reads messages from from the subvolume socket – message contains the relative directory path
1.46 # - creates a subvolume for given repository + necesary parent directories
1.47 @@ -128,6 +132,7 @@
1.48 }
1.49
1.50 # Environment: server
1.51 +# User: $VCS_BACKUP_USER
1.52 # should be started as a systemd/init service
1.53 vcs_backup_public_serverStartCloneService() {
1.54 socat -u "unix-recv:${VCS_BACKUP_CLONE_SOCKET},mode=700" - | while read d; do