Add hypercored

This commit is contained in:
Bob Mottram 2018-04-09 13:58:30 +01:00
parent dace6d3f48
commit 8ef9be1a6e
1 changed files with 21 additions and 5 deletions

View File

@ -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