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

110 lines
3.7 KiB
Text
Raw Normal View History

2020-03-11 00:07:10 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
2020-03-11 00:07:10 +01:00
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
2020-03-11 00:07:10 +01:00
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
2020-03-11 00:07:10 +01:00
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
Upgrade to version 14.4.4 (#15) * Upgrade to version 14.4.0 (#13) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) * Upgrade to upstream 13.2.5 * V.14.1.1 (#10) * Testing (#8) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * Upgrade to upstream version Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> * Upgrade to upstream v14.4.0 (#12) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * [fix] migrate to new permission system * [enh] add CI test for new permission system * Upgrade to version 14.4.4 * Cleaning up Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com>
2021-04-18 16:14:40 +02:00
ynh_script_progression --message="Configuring NGINX web server..." --weight=15
2020-03-11 00:07:10 +01:00
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# REMOVE CALLS TO THIRD PARTY WEBSITES
#=================================================
# Add "offline" parameter in index.html
# See https://desk.draw.io/support/solutions/articles/16000042546-what-url-parameters-are-supported-
# and https://shelter.moe/@Neil/103928506546498078 [French]
2020-04-05 12:32:37 +02:00
sed_pattern="s/var params = window.location.search.slice(1).split('&');/&\n\t\t\tparams.push(\"offline=1\");/g"
sed -i "$sed_pattern" "$final_path/src/main/webapp/index.html"
2020-03-11 00:07:10 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
Upgrade to version 14.4.4 (#15) * Upgrade to version 14.4.0 (#13) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) * Upgrade to upstream 13.2.5 * V.14.1.1 (#10) * Testing (#8) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * Upgrade to upstream version Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> * Upgrade to upstream v14.4.0 (#12) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * [fix] migrate to new permission system * [enh] add CI test for new permission system * Upgrade to version 14.4.4 * Cleaning up Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com>
2021-04-18 16:14:40 +02:00
ynh_script_progression --message="Configuring permissions..." --weight=3
2020-03-11 00:07:10 +01:00
# Make app public if necessary
if [ $is_public -eq 1 ]
then
Upgrade to version 14.4.4 (#15) * Upgrade to version 14.4.0 (#13) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) * Upgrade to upstream 13.2.5 * V.14.1.1 (#10) * Testing (#8) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * Upgrade to upstream version Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> * Upgrade to upstream v14.4.0 (#12) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * [fix] migrate to new permission system * [enh] add CI test for new permission system * Upgrade to version 14.4.4 * Cleaning up Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com>
2021-04-18 16:14:40 +02:00
ynh_permission_update --permission="main" --add="visitors"
2020-03-11 00:07:10 +01:00
fi
#=================================================
# RELOAD NGINX
#=================================================
Upgrade to version 14.4.4 (#15) * Upgrade to version 14.4.0 (#13) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) * Upgrade to upstream 13.2.5 * V.14.1.1 (#10) * Testing (#8) * Upgrade to version 12.9.3 * Update README.md Small update on the link's demo. We don't know how long they gonna redirect draw.io to app.diagrams.net * Remove commented code unused * Force http parameter to disable 3rds parties * fix quotting * Documentation * Upgrade version to 12.9.7 * Update README.md (#9) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * Upgrade to upstream version Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> * Upgrade to upstream v14.4.0 (#12) Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> * [fix] migrate to new permission system * [enh] add CI test for new permission system * Upgrade to version 14.4.4 * Cleaning up Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com> Co-authored-by: quentin-abiterra <49190209+quentin-abiterra@users.noreply.github.com>
2021-04-18 16:14:40 +02:00
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
2020-03-11 00:07:10 +01:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last