-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysspak
executable file
·63 lines (61 loc) · 2.62 KB
/
mysspak
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
#!/bin/bash
server_test=$(grep -Po '"'"server_test"'"\s*:\s*"\K([^"]*)' /vagrant/config.json)
server_prod=$(grep -Po '"'"server_prod"'"\s*:\s*"\K([^"]*)' /vagrant/config.json)
if [ "$1" != "" ]; then
if [ "$2" != "" ]; then
if [ "$1" == "load-to-local" ]; then
sspak load /vagrant/$2 /vagrant/public
mv /vagrant/$2 /vagrant/$2.used
chown vagrant:vagrant -R /vagrant/public/assets
chmod 777 -R /vagrant/public/assets
elif [ "$1" == "load-to-test" ]; then
if [ "$server_test" != "" ]; then
echo "Are you sure? You will upload local db and assets to remote TEST server."
echo "Recommendation: backup before pressing y! It's easy: mysspak save-test test.sspak"
read sure
if [ "$sure" == "y" ]; then
echo "Uplading to test server. Please wait."
sspak load /vagrant/$2 $server_test
else
echo "Cancelled."
fi
else
echo "WARNING: no test server defined in config.json!"
fi
elif [ "$1" == "load-to-prod" ]; then
if [ "$server_prod" != "" ]; then
echo "Are you sure? You will upload local db and assets to remote PRODUCTION server."
echo "Recommendation: backup before pressing y! It's easy: mysspak save-prod prod.sspak"
read sure
if [ "$sure" == "y" ]; then
echo "Uplading to production server. Please wait."
sspak load /vagrant/$2 $server_prod
else
echo "Cancelled."
fi
else
echo "WARNING: no test server defined in config.json!"
fi
elif [ "$1" == "save-local" ]; then
sspak save /vagrant/public/ /vagrant/$2
elif [ "$1" == "save-test" ]; then
if [ "$server_test" != "" ]; then
sspak save $server_test /vagrant/$2
else
echo "WARNING: no test server defined in config.json!"
fi
elif [ "$1" == "save-prod" ]; then
if [ "$server_prod" != "" ]; then
sspak save $server_prod /vagrant/$2
else
echo "WARNING: no production server defined in config.json!"
fi
else
sspak "$@"
fi
else
echo "no valid action defined, use load-to-local, save-local or any other valid sspak action"
fi
else
echo "no valid action defined, use load-to-local, save-local or any other valid sspak action"
fi