|
@@ -32,7 +32,7 @@ function git_clone {
|
32
|
32
|
repo_url="$1"
|
33
|
33
|
destination_dir="$2"
|
34
|
34
|
|
35
|
|
- if [[ "$repo_url" == "ssh:"* ]]; then
|
|
35
|
+ if [[ "$repo_url" == 'ssh:'* ]]; then
|
36
|
36
|
retval=$(get_friends_servers)
|
37
|
37
|
if [[ $retval == "0" ]]; then
|
38
|
38
|
if [ "${FRIENDS_MIRRORS_SERVER}" ]; then
|
|
@@ -88,84 +88,57 @@ function git_pull {
|
88
|
88
|
fi
|
89
|
89
|
}
|
90
|
90
|
|
91
|
|
-# This ensures that a given repo is on a given commit
|
92
|
|
-# If it isn't then it attempts to upgrade
|
93
|
|
-function set_repo_commit {
|
|
91
|
+function commit_has_changed {
|
94
|
92
|
repo_dir=$1
|
95
|
93
|
repo_commit_name=$2
|
96
|
94
|
repo_commit=$3
|
97
|
|
- repo_url=$4
|
98
|
95
|
if [ -d $repo_dir ]; then
|
99
|
96
|
if grep -q "$repo_commit_name" $COMPLETION_FILE; then
|
100
|
97
|
CURRENT_REPO_COMMIT=$(grep "$repo_commit_name" $COMPLETION_FILE | awk -F ':' '{print $2}')
|
101
|
98
|
if [[ "$CURRENT_REPO_COMMIT" != "$repo_commit" ]]; then
|
102
|
|
- cd $repo_dir
|
103
|
|
- git_pull $repo_url $repo_commit
|
|
99
|
+ echo "1"
|
|
100
|
+ fi
|
|
101
|
+ fi
|
|
102
|
+ fi
|
|
103
|
+ echo "0"
|
|
104
|
+}
|
104
|
105
|
|
105
|
|
- # application specific stuff after updating the repo
|
106
|
|
- if [[ $repo_dir == *"www"* ]]; then
|
107
|
|
- chown -R www-data:www-data $repo_dir
|
108
|
|
- fi
|
109
|
|
- if [[ $repo_dir == *"cjdns" ]]; then
|
110
|
|
- ./do
|
111
|
|
- fi
|
112
|
|
- if [[ $repo_dir == *"gpgit" ]]; then
|
113
|
|
- cp gpgit.pl /usr/bin/gpgit.pl
|
114
|
|
- fi
|
115
|
|
- if [[ $repo_dir == *"cleanup-maildir" ]]; then
|
116
|
|
- cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
|
117
|
|
- fi
|
118
|
|
- if [[ $repo_dir == *"nginx_ensite" ]]; then
|
119
|
|
- make install
|
120
|
|
- fi
|
121
|
|
- if [[ $repo_dir == *"gogs" ]]; then
|
122
|
|
- git checkout master
|
123
|
|
- go get -u ./...
|
124
|
|
- if [ ! "$?" = "0" ]; then
|
125
|
|
- echo $'Failed to get gogs'
|
126
|
|
- exit 52792
|
127
|
|
- fi
|
128
|
|
- git checkout $repo_commit
|
129
|
|
- go build
|
130
|
|
- if [ ! "$?" = "0" ]; then
|
131
|
|
- echo $'Failed to build gogs'
|
132
|
|
- exit 36226
|
133
|
|
- fi
|
134
|
|
- systemctl restart gogs
|
135
|
|
- fi
|
136
|
|
- if [[ $repo_dir == *"toxcore" ]]; then
|
137
|
|
- sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
|
138
|
|
- autoreconf -i
|
139
|
|
- ./configure --enable-daemon
|
140
|
|
- make
|
141
|
|
- make install
|
142
|
|
- systemctl daemon-reload
|
143
|
|
- systemctl restart tox-bootstrapd.service
|
144
|
|
- fi
|
145
|
|
- if [[ $repo_dir == *"toxic" ]]; then
|
146
|
|
- make
|
147
|
|
- make install
|
148
|
|
- fi
|
149
|
|
- if [[ $repo_dir == $RSS_READER_PATH ]]; then
|
150
|
|
- function_check rss_reader_modifications
|
151
|
|
- rss_reader_modifications
|
152
|
|
- fi
|
153
|
|
- if [[ $repo_dir == *"inadyn" ]]; then
|
154
|
|
- ./configure
|
155
|
|
- USE_OPENSSL=1 make
|
156
|
|
- make install
|
157
|
|
- systemctl restart inadyn
|
158
|
|
- fi
|
159
|
|
- if [[ $repo_dir == *"ipfs" ]]; then
|
160
|
|
- chown -R git:git /home/git
|
161
|
|
- systemctl restart ipfs
|
162
|
|
- systemctl daemon-reload
|
163
|
|
- fi
|
|
106
|
+# This ensures that a given repo is on a given commit
|
|
107
|
+# If it isn't then it attempts to upgrade
|
|
108
|
+function set_repo_commit {
|
|
109
|
+ repo_dir=$1
|
|
110
|
+ repo_commit_name=$2
|
|
111
|
+ repo_commit=$3
|
|
112
|
+ repo_url=$4
|
164
|
113
|
|
165
|
|
- sed -i "s/${repo_commit_name}.*/${repo_commit_name}:$repo_commit/g" $COMPLETION_FILE
|
166
|
|
- fi
|
167
|
|
- else
|
|
114
|
+ if [[ $(commit_has_changed $repo_dir $repo_commit_name $repo_commit) == "1" ]]; then
|
|
115
|
+ cd $repo_dir
|
|
116
|
+ git_pull $repo_url $repo_commit
|
|
117
|
+
|
|
118
|
+ # application specific stuff after updating the repo
|
|
119
|
+ if [[ $repo_dir == *"www"* ]]; then
|
|
120
|
+ chown -R www-data:www-data $repo_dir
|
|
121
|
+ fi
|
|
122
|
+ if [[ $repo_dir == *"gpgit" ]]; then
|
|
123
|
+ cp gpgit.pl /usr/bin/gpgit.pl
|
|
124
|
+ fi
|
|
125
|
+ if [[ $repo_dir == *"cleanup-maildir" ]]; then
|
|
126
|
+ cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
|
|
127
|
+ fi
|
|
128
|
+ if [[ $repo_dir == *"nginx_ensite" ]]; then
|
|
129
|
+ make install
|
|
130
|
+ fi
|
|
131
|
+ if [[ $repo_dir == *"inadyn" ]]; then
|
|
132
|
+ ./configure
|
|
133
|
+ USE_OPENSSL=1 make
|
|
134
|
+ make install
|
|
135
|
+ systemctl restart inadyn
|
|
136
|
+ fi
|
|
137
|
+
|
|
138
|
+ if ! grep -q "${repo_commit_name}:" $COMPLETION_FILE; then
|
168
|
139
|
echo "${repo_commit_name}:${repo_commit}" >> $COMPLETION_FILE
|
|
140
|
+ else
|
|
141
|
+ sed -i "s/${repo_commit_name}.*/${repo_commit_name}:$repo_commit/g" $COMPLETION_FILE
|
169
|
142
|
fi
|
170
|
143
|
fi
|
171
|
144
|
}
|