-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_update.sh
112 lines (82 loc) · 1.8 KB
/
s_update.sh
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
WIZARD=$1
trap bashtrap INT
bashtrap()
{
bash ~/setup/setup.sh
}
cd ~/setup/
function startfn {
php_output=`php ~/setup/cfg.php`
IFS=":"
while read -r key val; do
eval ${key}="${val}"
done <<< "$php_output"
sudo chown -R www-data:www-data /media/data/web
if [ -d /media/data/wip ]; then
sudo chown -R www-data:www-data /media/data/wip
fi
cd /media/data/web
# echo "path: $git_path"
echo "$git_branch"
echo ""
if [ -n "$git_path" ]; then
git reset --hard HEAD
git pull https://$git_username:$git_password@$git_path $git_branch
wget --quiet --output-document=/dev/null http://localhost/update/index.php
else
echo ""
echo "CANT READ CONFIG FILE. EXITING NOW"
echo ""
fi
echo ""
if [ -d /media/data/wip ]; then
php_output=`php ~/setup/cfg_wip.php`
IFS=":"
while read -r key val; do
eval ${key}="${val}"
done <<< "$php_output"
cd /media/data/wip
# echo "path: $git_path"
echo ""
echo ""
echo ""
echo ""
echo "$git_branch"
echo ""
if [ -n "$git_path" ]; then
git reset --hard HEAD
git pull https://$git_username:$git_password@$git_path $git_branch
wget --quiet --output-document=/dev/null http://localhost:81/update/index.php
else
echo ""
echo "CANT READ CONFIG FILE. EXITING NOW"
echo ""
fi
fi
cd ~/setup/
finish
}
function finish {
sudo chown -R www-data:www-data /media/data/web
if [ -d /media/data/wip ]; then
sudo chown -R www-data:www-data /media/data/wip
fi
echo "--- Done ---"
endfn
}
function endfn {
echo ""
echo ""
read -p "Press [Enter] key to continue..."
if [ -z "$WIZARD" ]; then
bash ./setup.sh " - Impreshin Update Done"
else
bash ./setup.sh " - Wizard Complete"
fi
}
clear
echo "Impreshin Update"
echo "-----------------------------------------------"
echo ""
startfn