Ver código fonte

ghost upgrades

Bob Mottram 8 anos atrás
pai
commit
4638122109
1 arquivos alterados com 33 adições e 3 exclusões
  1. 33
    3
      src/freedombone-app-ghost

+ 33
- 3
src/freedombone-app-ghost Ver arquivo

36
 GHOST_DOMAIN_NAME=
36
 GHOST_DOMAIN_NAME=
37
 GHOST_CODE=
37
 GHOST_CODE=
38
 GHOST_ONION_PORT=8104
38
 GHOST_ONION_PORT=8104
39
-GHOST_VERSION='0.11.3'
39
+GHOST_VERSION='0.11.8'
40
 GHOST_PORT=2368
40
 GHOST_PORT=2368
41
 
41
 
42
 ghost_variables=(GHOST_VERSION
42
 ghost_variables=(GHOST_VERSION
150
 }
150
 }
151
 
151
 
152
 function upgrade_ghost {
152
 function upgrade_ghost {
153
+    if ! grep -q "ghost version:" $COMPLETION_FILE; then
154
+        return
155
+    fi
156
+
157
+    CURR_GHOST_VERSION=$(get_completion_param "ghost version")
158
+    if [[ "$GHOST_VERSION" == "$CURR_GHOST_VERSION" ]]; then
159
+        return
160
+    fi
161
+
153
     read_config_param "GHOST_DOMAIN_NAME"
162
     read_config_param "GHOST_DOMAIN_NAME"
154
 
163
 
155
     GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
164
     GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
156
 
165
 
157
-    function_check set_repo_commit
158
-    set_repo_commit $GHOST_PATH "ghost commit" "$GHOST_COMMIT" $GHOST_REPO
166
+    cd $GHOST_PATH
167
+    wget https://ghost.org/zip/ghost-${GHOST_VERSION}.zip
168
+    if [ ! -f ghost-${GHOST_VERSION}.zip ]; then
169
+        echo $'Unable to download ghost'
170
+        rm -rf /var/www/$GHOST_DOMAIN_NAME
171
+        exit 367245
172
+    fi
173
+    unzip ghost-${GHOST_VERSION}.zip
174
+    if [ ! -f $GHOST_PATH/index.js ]; then
175
+        echo $'ghost failed to unzip'
176
+        rm -rf /var/www/$GHOST_DOMAIN_NAME
177
+        exit 63835
178
+    fi
179
+
180
+    sed -i "/sqlite/d" $GHOST_PATH/package.json
181
+    npm install --production
159
 
182
 
183
+    chown -R ghost: $GHOST_PATH/
160
     ghost_replace_services
184
     ghost_replace_services
161
     chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
185
     chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
162
 
186
 
163
     ghost_remove_offsite_links
187
     ghost_remove_offsite_links
188
+    sed -i "s|ghost version.*|ghost version:${GHOST_VERSION}|g" ${COMPLETION_FILE}
164
     systemctl restart ghost
189
     systemctl restart ghost
165
 }
190
 }
166
 
191
 
495
     add_ddns_domain $GHOST_DOMAIN_NAME
520
     add_ddns_domain $GHOST_DOMAIN_NAME
496
 
521
 
497
     set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
522
     set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
523
+    if ! grep -q "ghost version:" ${COMPLETION_FILE}; then
524
+        echo "ghost version:${GHOST_VERSION}" >> ${COMPLETION_FILE}
525
+    else
526
+        sed -i "s|ghost version.*|ghost version:${GHOST_VERSION}|g" ${COMPLETION_FILE}
527
+    fi
498
     APP_INSTALLED=1
528
     APP_INSTALLED=1
499
 }
529
 }
500
 
530