소스 검색

Improving ghost install

Bob Mottram 7 년 전
부모
커밋
61341e106a
1개의 변경된 파일19개의 추가작업 그리고 6개의 파일을 삭제
  1. 19
    6
      src/freedombone-app-ghost

+ 19
- 6
src/freedombone-app-ghost 파일 보기

@@ -372,7 +372,7 @@ function install_ghost {
372 372
     install_nodejs ghost
373 373
 
374 374
     # now install ghost itself
375
-    npm install -g ghost-cli@1.4.1
375
+    npm install -g ghost-cli@latest
376 376
     if [ ! -f /usr/local/bin/ghost ]; then
377 377
         echo $'ghost was not installed'
378 378
         exit 738539
@@ -380,14 +380,30 @@ function install_ghost {
380 380
 
381 381
     GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
382 382
 
383
-    rm -rf /var/www/$GHOST_DOMAIN_NAME/htdocs/*
384 383
     npm install -g yarn
385 384
     yarn install --no-emoji --no-progress
386 385
     yarn cache clean
387
-    printf 'y' | ghost install ${GHOST_VERSION} --user ghost --db=sqlite3 --port ${GHOST_PORT} --verbose
388 386
     adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
387
+    rm -rf /var/www/$GHOST_DOMAIN_NAME/htdocs/*
388
+    printf 'y' | ghost install ${GHOST_VERSION} --user ghost --db=sqlite3 --port ${GHOST_PORT} --verbose
389
+
390
+    if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/versions ]; then
391
+        echo $'versions directory was not found'
392
+        exit 782523462
393
+    fi
394
+    if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/content ]; then
395
+        echo $'content directory was not found'
396
+        exit 68352682
397
+    fi
389 398
 
390 399
     npm install -g knex-migrator
400
+    if [ ! -f /var/www/$GHOST_DOMAIN_NAME/htdocs/versions/${GHOST_VERSION}/MigratorConfig.js ]; then
401
+        echo $'MigratorConfig.js was not found'
402
+        exit 62783538
403
+    fi
404
+    cp /var/www/$GHOST_DOMAIN_NAME/htdocs/versions/${GHOST_VERSION}/MigratorConfig.js /var/www/$GHOST_DOMAIN_NAME/htdocs
405
+    chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs
406
+    cd /var/www/$GHOST_DOMAIN_NAME/htdocs/current
391 407
     knex-migrator init
392 408
 
393 409
     ghost_bust
@@ -419,9 +435,6 @@ function install_ghost {
419 435
 
420 436
     chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
421 437
 
422
-    n ${NODEJS_VERSION}
423
-    npm upgrade -g npm@${NPM_VERSION} --save
424
-
425 438
     systemctl enable ghost
426 439
     systemctl daemon-reload
427 440
     systemctl start ghost