diff -r 1539711d8657 -r 5e5d4c937739 vcs-backup.sh --- a/vcs-backup.sh Fri Apr 19 18:56:46 2019 +0200 +++ b/vcs-backup.sh Fri Apr 19 23:25:19 2019 +0200 @@ -24,7 +24,7 @@ VCS_BACKUP_CONFIG_DIR="$VCS_BACKUP_DATA_DIR/config"; VCS_BACKUP_SNAPSHOT_DIR="$VCS_BACKUP_DATA_DIR/snapshot"; VCS_BACKUP_SUBVOLUME_SOCKET="/run/vcs-backup-subvolume"; -VCS_BACKUP_CLONE_SOCKET="/run/vcs-backup-clone"; +VCS_BACKUP_CLONE_SOCKET="/run/vcs-backup-clone/socket"; VCS_BACKUP_CLONE_CALLBACK_SOCKET="clone-callback"; VCS_BACKUP_USER="vcs-backup"; VCS_BACKUP_MANAGER="vcs-backup-manager"; @@ -39,7 +39,9 @@ mkdir "$VCS_BACKUP_CURRENT_DIR"; mkdir "$VCS_BACKUP_CONFIG_DIR"; mkdir "$VCS_BACKUP_SNAPSHOT_DIR"; +mkdir "$(dirname VCS_BACKUP_CLONE_SOCKET)" +chown "${VCS_BACKUP_USER}:${VCS_BACKUP_USER}" "$(dirname VCS_BACKUP_CLONE_SOCKET)" chown "${VCS_BACKUP_USER}:${VCS_BACKUP_USER}" "$VCS_BACKUP_CURRENT_DIR" chown "${VCS_BACKUP_MANAGER}:${VCS_BACKUP_MANAGER}" "$VCS_BACKUP_CONFIG_DIR" } @@ -54,7 +56,7 @@ # Environment: all # $1 = path to the config file -loadConfigFile() { if [ -f "$1" ]; then . "$1"; else echo "Missing config file: $1" >&2; exit 1; fi } +loadConfigFile() { if [ -f "$1" ]; then . "$1"; fi } # Environment: server # $1 = URL @@ -83,6 +85,7 @@ } # Environment: server +# User: $VCS_BACKUP_MANAGER # has same parameters as clientSubmitBackupRequest (see above) vcs_backup_public_serverSubmitBackupRequest() { if isValidTypeAndURL "$1" "$2"; then @@ -113,6 +116,7 @@ } # Environment: server +# User: root # Should be started as a systemd/init service. # - reads messages from from the subvolume socket – message contains the relative directory path # - creates a subvolume for given repository + necesary parent directories @@ -128,6 +132,7 @@ } # Environment: server +# User: $VCS_BACKUP_USER # should be started as a systemd/init service vcs_backup_public_serverStartCloneService() { socat -u "unix-recv:${VCS_BACKUP_CLONE_SOCKET},mode=700" - | while read d; do