28 lines
972 B
Bash
Executable File
28 lines
972 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
local_host="$HOSTNAME"
|
|
local_project="$(cat currentProject)"
|
|
remote_host="$(ssh "$(project-sshn)" "cat "~/project-manager/host"")"
|
|
remote_project="$(ssh "$(project-sshn)" "cat "~/project-manager/project"")"
|
|
|
|
if [ "$remote_host" != "" ] && [ "$local_host" != "$remote_host" ]; then
|
|
echo "ERROR: $remote_host is currently maintaining $remote_project. Push from it first."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$local_project" == "" ]; then
|
|
echo "ERROR: You are not maintaining a project."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$remote_project" != "" ] && [ "$local_project" != "$remote_project" ]; then
|
|
echo "ERROR: You are currently maintaining $local_project on this machine, push that first."
|
|
exit 1
|
|
fi
|
|
|
|
set -e
|
|
rsync --progress --delete -a "project/." "$(project-sshn):~/project-manager/projects/$local_project"
|
|
echo "" | ssh "$(project-sshn)" "cat > "~/project-manager/host""
|
|
echo "" | ssh "$(project-sshn)" "cat > "~/project-manager/project""
|
|
echo "" > "currentProject"
|
|
rm -rf "project" |