浏览代码

Check hash on ghost download

Bob Mottram 8 年前
父节点
当前提交
a6886262fa
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17
    0
      src/freedombone-app-ghost

+ 17
- 0
src/freedombone-app-ghost 查看文件

38
 GHOST_ONION_PORT=8104
38
 GHOST_ONION_PORT=8104
39
 GHOST_PORT=2368
39
 GHOST_PORT=2368
40
 GHOST_VERSION='0.11.8'
40
 GHOST_VERSION='0.11.8'
41
+GHOST_HASH='244faad0b16eb1b90c8095f1e536db65299a3a2d85a20af76342be3707522b38'
41
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
42
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
42
 
43
 
43
 ghost_variables=(GHOST_VERSION
44
 ghost_variables=(GHOST_VERSION
172
         rm -rf /var/www/$GHOST_DOMAIN_NAME
173
         rm -rf /var/www/$GHOST_DOMAIN_NAME
173
         exit 367245
174
         exit 367245
174
     fi
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
     unzip ghost-${GHOST_VERSION}.zip
184
     unzip ghost-${GHOST_VERSION}.zip
176
     if [ ! -f $GHOST_PATH/index.js ]; then
185
     if [ ! -f $GHOST_PATH/index.js ]; then
177
         echo $'ghost failed to unzip'
186
         echo $'ghost failed to unzip'
373
         rm -rf /var/www/$GHOST_DOMAIN_NAME
382
         rm -rf /var/www/$GHOST_DOMAIN_NAME
374
         exit 63892
383
         exit 63892
375
     fi
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
     unzip ghost-${GHOST_VERSION}.zip
393
     unzip ghost-${GHOST_VERSION}.zip
377
     if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then
394
     if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then
378
         echo $'ghost failed to unzip'
395
         echo $'ghost failed to unzip'