mirror of
https://github.com/YunoHost-Apps/galene_ynh.git
synced 2024-09-03 18:36:31 +02:00
83 lines
3.3 KiB
Bash
Executable file
83 lines
3.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
# Add settings here as needed by your application
|
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
|
group_name=$(ynh_app_setting_get --app=$app --key=group_name)
|
|
port_ldap=$(ynh_app_setting_get --app=$app --key=ldap_port)
|
|
key=$(ynh_app_setting_get --app=$app --key=key)
|
|
|
|
#=================================================
|
|
# STANDARD MODIFICATIONS
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
|
ynh_systemd_action --service_name=${app}_ldap --action="stop" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# MODIFY URL IN NGINX CONF
|
|
#=================================================
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
|
|
|
ynh_change_url_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC MODIFICATIONS
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
|
|
|
domain="$new_domain"
|
|
# Configure Galene
|
|
ynh_add_config --template="../conf/config.json" --destination="$install_dir/live/data/config.json"
|
|
chmod 400 "$install_dir/live/data/config.json"
|
|
chown $app:$app "$install_dir/live/data/config.json"
|
|
|
|
# Configure Galene LDAP
|
|
ynh_add_config --template="../conf/galene-ldap.json" --destination="$install_dir/live_ldap/data/galene-ldap.json"
|
|
chmod 400 "$install_dir/live_ldap/data/galene-ldap.json"
|
|
chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json"
|
|
|
|
# Create a group name config
|
|
ynh_add_config --template="../conf/groupname.json" --destination="$data_dir/groups/$group_name.json"
|
|
chmod 400 "$data_dir/groups/$group_name.json"
|
|
chown $app:$app "$data_dir/groups/$group_name.json"
|
|
|
|
# Create a group name authenticated on LDAP
|
|
ynh_add_config --template="../conf/groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json"
|
|
chmod 400 "$data_dir/groups/YunoHost_Users.json"
|
|
chown $app:$app "$data_dir/groups/YunoHost_Users.json"
|
|
|
|
#=================================================
|
|
# GENERIC FINALISATION
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
ynh_systemd_action --service_name=${app}_ldap --action="start" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|