Generate cryptpad api config file after upgrades

This commit is contained in:
Bob Mottram 2017-12-19 14:07:10 +00:00
parent 3564dd7e06
commit dd43031028
1 changed files with 14 additions and 10 deletions

View File

@ -76,6 +76,18 @@ function reconfigure_cryptpad {
fi 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 { function upgrade_cryptpad {
CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit") CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit")
if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then
@ -90,7 +102,7 @@ function upgrade_cryptpad {
cd $CRYPTPAD_DIR cd $CRYPTPAD_DIR
npm install npm install
chown -R cryptpad:cryptpad $CRYPTPAD_DIR cryptpad_generate_api_config
su -c 'bower install' - cryptpad su -c 'bower install' - cryptpad
systemctl start cryptpad systemctl start cryptpad
@ -544,15 +556,7 @@ function install_cryptpad {
sleep 6 sleep 6
if [ ! -d $CRYPTPAD_DIR/customize/api ]; then cryptpad_generate_api_config
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
# install again # install again
cd $CRYPTPAD_DIR cd $CRYPTPAD_DIR