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