#!/bin/bash source _common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= allow_anonymous=false allow_anonymous_edits=false allow_email_registration=false allow_free_url=false require_free_url_authentication=false #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_app_setting_set --key=allow_anonymous --value=$allow_anonymous ynh_app_setting_set --key=allow_email_registration --value=$allow_email_registration ynh_app_setting_set --key=allow_free_url --value=$allow_free_url ynh_app_setting_set --key=require_free_url_authentication --value=$require_free_url_authentication ynh_app_setting_set --key=allow_anonymous_edits --value=$allow_anonymous_edits #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression "Installing dependencies..." ynh_nodejs_install #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir=$install_dir #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." ynh_config_add_nginx ynh_config_add_systemd yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC SETUP #============================================== # INSTALL HEDGEDOC #============================================== ynh_script_progression "Building $app... (this will take some time and resources!)" pushd "$install_dir" ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production ynh_hide_warnings ynh_exec_as_app yarn cache clean popd #================================================= # MODIFY A CONFIG FILE #================================================= ynh_script_progression "Updating configuration..." url_path=${path#/} ynh_config_add --template="config.json.example" --destination="$install_dir/config.json" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression "Starting $app's systemd service..." ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening" #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Installation of $app completed"