From dd43031028a9399e5cfa06d47aab90ee679cc446 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Dec 2017 14:07:10 +0000 Subject: [PATCH] Generate cryptpad api config file after upgrades --- src/freedombone-app-cryptpad | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/freedombone-app-cryptpad b/src/freedombone-app-cryptpad index b72efcdd..669aea2c 100755 --- a/src/freedombone-app-cryptpad +++ b/src/freedombone-app-cryptpad @@ -76,6 +76,18 @@ function reconfigure_cryptpad { fi } +function cryptpad_generate_api_config { + if [ ! -d $CRYPTPAD_DIR/customize/api ]; then + mkdir -p $CRYPTPAD_DIR/customize/api + fi + wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config + if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then + echo $'Unable to wget api/config' + exit 89252 + fi + chown -R cryptpad:cryptpad $CRYPTPAD_DIR +} + function upgrade_cryptpad { CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit") if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then @@ -90,7 +102,7 @@ function upgrade_cryptpad { cd $CRYPTPAD_DIR npm install - chown -R cryptpad:cryptpad $CRYPTPAD_DIR + cryptpad_generate_api_config su -c 'bower install' - cryptpad systemctl start cryptpad @@ -544,15 +556,7 @@ function install_cryptpad { sleep 6 - if [ ! -d $CRYPTPAD_DIR/customize/api ]; then - mkdir -p $CRYPTPAD_DIR/customize/api - fi - wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config - if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then - echo $'Unable to wget api/config' - exit 89252 - fi - chown -R cryptpad:cryptpad $CRYPTPAD_DIR + cryptpad_generate_api_config # install again cd $CRYPTPAD_DIR