1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cryptpad_ynh.git synced 2024-09-03 18:26:14 +02:00

Fix install upgrade inconsistencies (#39)

* [scripts][install] remove duplicate installation script

* [scripts][upgrade] make server.js configuration consistent with install

* [scripts][upgrade] move cryptpad installation after configuration

to maintain consistency with install script

* [scripts] use consistent paths for configuration
This commit is contained in:
shine 2019-10-03 14:38:31 +05:30 committed by frju365
parent 24c98ce447
commit ed7ac956ff
2 changed files with 24 additions and 34 deletions

View file

@ -131,7 +131,7 @@ ynh_replace_string "__PORT__" "$port" "$final_path/config/config.js"
ynh_replace_string "__PORTI__" "$porti" "$final_path/config/config.js"
# Tune CSP to allow for YunoHost tile
#ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js"
#ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config/config.js"
# Remove donate button
ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config/config.js"
# Disable analytics unsolicited communications
@ -150,17 +150,6 @@ npm install -g bower --allow-root
bower install --allow-root
popd
#=================================================
# INSTALL CRYPTPAD
#=================================================
script_dir="$PWD"
pushd "$final_path"
npm install --allow-root
npm install -g bower --allow-root
bower install --allow-root
popd
#=================================================
# Set some permissions
#=================================================

View file

@ -91,6 +91,29 @@ ynh_replace_string "__NODEJS__" "$nodejs_version" "../conf/systemd.service"
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
ynh_add_systemd_config
#=================================================
# CONFIGURE SERVER.JS
#=================================================
# Backup configuration file if changed
ynh_backup_if_checksum_is_different "$final_path/config.js"
ynh_backup_if_checksum_is_different "$final_path/config/config.js"
# Copy default configuration file
mv "../conf/config.js" "$final_path/config/config.js"
# Set service port
ynh_replace_string "__PORT__" "$port" "$final_path/config/config.js"
ynh_replace_string "__PORTI__" "$porti" "$final_path/config/config.js"
# Tune CSP to allow for YunoHost tile
ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config/config.js"
# Remove donate button
ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config/config.js"
# Disable analytics unsolicited communications
ynh_replace_string "__ADMIN_EMAIL_" "$admin_email" "$final_path/config/config.js"
# Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config/config.js"
#=================================================
# INSTALL CRYPTPAD
@ -104,28 +127,6 @@ npm install -g bower
exec_login_as $app cd $final_path && env PATH=$PATH bower install
popd
#=================================================
# CONFIGURE SERVER.JS
#=================================================
# Backup configuration file if changed
ynh_backup_if_checksum_is_different "$final_path/config.js"
# Copy default configuration file
sudo mv "$final_path/config.example.js" "$final_path/config.js"
# Set service port
ynh_replace_string "httpPort: 3000" "httpPort: $port" "$final_path/config.js"
# Tune CSP to allow for YunoHost tile
ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js"
# Remove donate button
ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config.js"
# Disable analytics unsolicited communications
ynh_replace_string "adminEmail: 'i.did.not.read.my.config@cryptpad.fr'" "adminEmail: false" "$final_path/config.js"
# Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config.js"
#=================================================
# SET FILES OWNERSHIP
#=================================================