Kaynağa Gözat

Improve prosody upgrades

Bob Mottram 8 yıl önce
ebeveyn
işleme
383a4cc2a0
1 değiştirilmiş dosya ile 33 ekleme ve 5 silme
  1. 33
    5
      src/freedombone-app-xmpp

+ 33
- 5
src/freedombone-app-xmpp Dosyayı Görüntüle

@@ -44,6 +44,7 @@ prosody_latest_version='0.10'
44 44
 prosody_nightly=319
45 45
 prosody_nightly_hash='f1fdc8ce5b6f8bfa451d458616a0bbe5ed7c15881415e561586bab39bd705fa4'
46 46
 prosody_filename=prosody-${prosody_latest_version}-1nightly${prosody_nightly}
47
+prosody_nightly_url="https://prosody.im/nightly/${prosody_latest_version}/latest/${prosody_filename}.tar.gz"
47 48
 
48 49
 xmpp_variables=(ONION_ONLY
49 50
                 INSTALLED_WITHIN_DOCKER
@@ -153,6 +154,33 @@ function upgrade_xmpp {
153 154
         # by an operating system upgrade
154 155
         cd ${INSTALL_DIR}/${prosody_filename}
155 156
         make prefix=/usr install
157
+    else
158
+        cd $INSTALL_DIR
159
+        wget $prosody_nightly_url
160
+        if [ ! -f ${INSTALL_DIR}/${prosody_filename}.tar.gz ]; then
161
+            echo $"Failed to download prosody nightly $prosody_nightly_url"
162
+            exit 345782
163
+        fi
164
+
165
+        hash_value=$(sha256sum ${INSTALL_DIR}/${prosody_filename}.tar.gz | awk -F ' ' '{print $1}')
166
+        if [[ "$hash_value" != "$prosody_nightly_hash" ]]; then
167
+            rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
168
+            echo $'Unexpected hash value for prosody nightly download'
169
+            exit 6824283
170
+        fi
171
+
172
+        tar -xzvf ${INSTALL_DIR}/${prosody_filename}.tar.gz
173
+        cd ${INSTALL_DIR}/${prosody_filename}
174
+        ./configure --ostype=debian --prefix=/usr
175
+        make prefix=/usr
176
+        make prefix=/usr install
177
+        if [ -f /usr/local/bin/prosody ]; then
178
+            echo $'Failed to build prosody nightly to /usr/bin'
179
+            rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
180
+            rm -rf ${INSTALL_DIR}/${prosody_filename}
181
+            exit 3672345
182
+        fi
183
+        rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
156 184
     fi
157 185
     systemctl restart prosody
158 186
 }
@@ -425,14 +453,15 @@ function install_xmpp_nightly {
425 453
     fi
426 454
 
427 455
     cd $INSTALL_DIR
428
-    wget https://prosody.im/nightly/${prosody_latest_version}/latest/${prosody_filename}.tar.gz
429
-    if [ ! -f ${prosody_filename}.tar.gz ]; then
430
-        echo $"Failed to download prosody nightly https://prosody.im/nightly/${prosody_latest_version}/latest/${prosody_filename}.tar.gz"
456
+    wget $prosody_nightly_url
457
+    if [ ! -f ${INSTALL_DIR}/${prosody_filename}.tar.gz ]; then
458
+        echo $"Failed to download prosody nightly $prosody_nightly_url"
431 459
         exit 78352
432 460
     fi
433 461
 
434
-    hash_value=$(sha256sum ${prosody_filename}.tar.gz | awk -F ' ' '{print $1}')
462
+    hash_value=$(sha256sum ${INSTALL_DIR}/${prosody_filename}.tar.gz | awk -F ' ' '{print $1}')
435 463
     if [[ "$hash_value" != "$prosody_nightly_hash" ]]; then
464
+        rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
436 465
         echo $'Unexpected hash value for prosody nightly download'
437 466
         exit 68224283
438 467
     fi
@@ -449,7 +478,6 @@ function install_xmpp_nightly {
449 478
         exit 628732
450 479
     fi
451 480
     rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
452
-    rm -rf ${INSTALL_DIR}/${prosody_filename}
453 481
 }
454 482
 
455 483
 function install_xmpp_main {