From 5db39cb66e2914ea90ae324468123d7308a07621 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 17 Aug 2017 19:24:49 +0100 Subject: [PATCH] Keep track of ghost version So that we're not upgrading every time --- src/freedombone-app-ghost | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/freedombone-app-ghost b/src/freedombone-app-ghost index 46c0a8fd..a98a94df 100755 --- a/src/freedombone-app-ghost +++ b/src/freedombone-app-ghost @@ -34,6 +34,7 @@ VARIANTS="full full-vim writer" IN_DEFAULT_INSTALL=0 SHOW_ON_ABOUT=1 +GHOST_VERSION=1.0.2 GHOST_DOMAIN_NAME= GHOST_CODE= GHOST_ONION_PORT=8104 @@ -53,6 +54,9 @@ function ghost_bust { kill_pid=$(ps aux | grep "ghost" | awk -F ' ' '{print $2}' | head -n 1) kill -9 $kill_pid + + kill_pid=$(ps aux | grep "ghost" | awk -F ' ' '{print $2}' | head -n 1) + kill -9 $kill_pid } function logging_on_ghost { @@ -188,6 +192,11 @@ function reconfigure_ghost { } function upgrade_ghost { + CURR_GHOST_VERSION=$(get_completion_param "ghost version") + if [[ "${CURR_GHOST_VERSION}" == "${GHOST_VERSION}" ]]; then + return + fi + read_config_param GHOST_DOMAIN_NAME if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs ]; then @@ -195,6 +204,7 @@ function upgrade_ghost { fi systemctl stop ghost + ghost_bust cd /var/www/$GHOST_DOMAIN_NAME/htdocs @@ -209,6 +219,7 @@ function upgrade_ghost { chown -R root:root /usr/local/lib chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs systemctl restart ghost + sed -i "s|ghost version.*|ghost version:${GHOST_VERSION}|g" ${COMPLETION_FILE} } function backup_local_ghost {