-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdeploy
executable file
·71 lines (57 loc) · 1.78 KB
/
deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Script lifted from:
# https://coderwall.com/p/moabdw
# Better if run in two steps:
#
# ./deploy local # dry-run
# ./deploy local go # copy from source to destination locally
#
# ./deploy live [SF username] # dry-run
# ./deploy live go [SF username] # Password is requested, rsynch over SSH from local to SourceForge webspace
ERRORSTRING="Error. Please make sure you've indicated correct parameters"
if [ $# -eq 0 ]
then
echo $ERRORSTRING;
# To test rsync locally
# Rsync to a local directory, ex. ~/qucs-website
elif [ $1 == "local" ]
then
if [[ -z $2 ]]
then
echo "Running dry-run"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync_exclude.txt ./ ~/qucs-website
elif [ $2 == "go" ]
then
echo "Running actual deploy"
rsync -az --force --delete --progress --exclude-from=rsync_exclude.txt ./ ~/qucs-website
else
echo $ERRORSTRING;
fi
# Rsync to SourceForge over SSH
elif [ $1 == "live" ]
then
if [[ $2 != "go" ]]
then
if [ "$#" -ne 2 ]
then
echo "Usage: ./deploy live [username]"
exit 1
else
username=$2
echo "Running dry-run"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync_exclude.txt -e ssh ./ $username,[email protected]:htdocs/
fi
elif [[ $2 == "go" ]]
then
if [ "$#" -ne 3 ]
then
echo "Usage: ./deploy live go [username]"
exit 1
fi
username=$3
echo "Running actual deploy"
rsync -az --force --delete --progress --exclude-from=rsync_exclude.txt -e ssh ./ $username,[email protected]:htdocs/
else
echo $ERRORSTRING;
fi
fi