From 8ef9be1a6ea118451868ba8375758cfa58c78dfb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 9 Apr 2018 13:58:30 +0100 Subject: [PATCH] Add hypercored --- src/freedombone-app-datserver | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/freedombone-app-datserver b/src/freedombone-app-datserver index 3b760870..5b57a583 100755 --- a/src/freedombone-app-datserver +++ b/src/freedombone-app-datserver @@ -33,6 +33,7 @@ SHOW_ON_ABOUT=0 DATSERVER_DOMAIN_NAME= DATSERVER_CODE= DATSERVER_DAT_VERSION='13.10.0' +DATSERVER_HYPERCORED_VERSION='1.4.1' DATSERVER_DIRECTORY=/etc/datserver datserver_variables=(MY_USERNAME) @@ -158,14 +159,22 @@ function configure_interactive_datserver { function upgrade_datserver { CURR_DATSERVER_DAT_VERSION=$(get_completion_param "datserver version") - if [[ "$CURR_DATSERVER_DAT_VERSION" == "$DATSERVER_DAT_VERSION" ]]; then - return + if [[ "$CURR_DATSERVER_DAT_VERSION" != "$DATSERVER_DAT_VERSION" ]]; then + + if npm update -g dat@$DATSERVER_DAT_VERSION; then + set_completion_param "datserver version" "$DATSERVER_DAT_VERSION" + fi + chown -R datserver:datserver "$DATSERVER_DIRECTORY" fi - if npm update -g dat@$DATSERVER_DAT_VERSION; then - set_completion_param "datserver version" "$DATSERVER_DAT_VERSION" + CURR_DATSERVER_HYPERCORED_VERSION=$(get_completion_param "datserver hypercored version") + if [[ "$CURR_DATSERVER_HYPERCORED_VERSION" != "$DATSERVER_HYPERCORED_VERSION" ]]; then + + if npm update -g hypercored@$DATSERVER_HYPERCORED_VERSION; then + set_completion_param "datserver hypercored version" "$DATSERVER_HYPERCORED_VERSION" + fi + chown -R datserver:datserver "$DATSERVER_DIRECTORY" fi - chown -R datserver:datserver "$DATSERVER_DIRECTORY" } function backup_local_datserver { @@ -243,6 +252,7 @@ function remove_datserver { fi userdel -r datserver npm uninstall -g dat + npm uninstall -g hypercored remove_nodejs datserver @@ -270,7 +280,13 @@ function install_datserver { exit 156835 fi + if ! npm install -g hypercored@$DATSERVER_HYPERCORED_VERSION; then + echo $'hypercored was not installed' + exit 4635439 + fi + set_completion_param "datserver version" "$DATSERVER_DAT_VERSION" + set_completion_param "datserver hypercored version" "$DATSERVER_HYPERCORED_VERSION" if [ -d $DATSERVER_DIRECTORY ]; then rm -rf $DATSERVER_DIRECTORY