1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hedgedoc_ynh.git synced 2024-09-03 19:25:52 +02:00
hedgedoc_ynh/scripts/install
eric_G c0d176700d
Testing (#78)
* [autopatch] Automatic patch attempt for helpers 2.1 (#77)

* [autopatch] Automatic patch attempt for helpers 2.1

* cleaning

---------

Co-authored-by: Yunohost-Bot <>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>

* Auto-update READMEs

* Update manifest.toml

* Auto-update READMEs

---------

Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2024-09-01 17:40:32 +02:00

83 lines
2.8 KiB
Bash

#!/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"