Sfoglia il codice sorgente

Check hash on ghost download

Bob Mottram 8 anni fa
parent
commit
a6886262fa
1 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 17
    0
      src/freedombone-app-ghost

+ 17
- 0
src/freedombone-app-ghost Vedi File

@@ -38,6 +38,7 @@ GHOST_CODE=
38 38
 GHOST_ONION_PORT=8104
39 39
 GHOST_PORT=2368
40 40
 GHOST_VERSION='0.11.8'
41
+GHOST_HASH='244faad0b16eb1b90c8095f1e536db65299a3a2d85a20af76342be3707522b38'
41 42
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
42 43
 
43 44
 ghost_variables=(GHOST_VERSION
@@ -172,6 +173,14 @@ function upgrade_ghost {
172 173
         rm -rf /var/www/$GHOST_DOMAIN_NAME
173 174
         exit 367245
174 175
     fi
176
+
177
+    # check the hash
178
+    hash=$(sha256sum Ghost-${GHOST_VERSION}.zip | awk -F ' ' '{print $1}')
179
+    if [[ "$hash" != "$GHOST_HASH" ]]; then
180
+        echo $'ghost hash does not match'
181
+        exit 729856
182
+    fi
183
+
175 184
     unzip ghost-${GHOST_VERSION}.zip
176 185
     if [ ! -f $GHOST_PATH/index.js ]; then
177 186
         echo $'ghost failed to unzip'
@@ -373,6 +382,14 @@ function install_ghost {
373 382
         rm -rf /var/www/$GHOST_DOMAIN_NAME
374 383
         exit 63892
375 384
     fi
385
+
386
+    # check the hash
387
+    hash=$(sha256sum Ghost-${GHOST_VERSION}.zip | awk -F ' ' '{print $1}')
388
+    if [[ "$hash" != "$GHOST_HASH" ]]; then
389
+        echo $'ghost hash does not match'
390
+        exit 729856
391
+    fi
392
+
376 393
     unzip ghost-${GHOST_VERSION}.zip
377 394
     if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then
378 395
         echo $'ghost failed to unzip'