2024-03-09 23:40:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# INITIALIZE AND STORE SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# APP INITIAL CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
|
|
|
|
2024-03-10 20:38:30 +01:00
|
|
|
ynh_add_config --template="default.env" --destination="$install_dir/default.env"
|
2024-03-09 23:40:16 +01:00
|
|
|
|
2024-03-10 20:38:30 +01:00
|
|
|
chmod 400 "$install_dir/default.env"
|
|
|
|
chown "$app:$app" "$install_dir/default.env"
|
2024-03-09 23:40:16 +01:00
|
|
|
|
2024-03-10 20:38:30 +01:00
|
|
|
ynh_add_config --template="custom.env" --destination="$data_dir/custom.env"
|
|
|
|
|
|
|
|
chmod 600 "$data_dir/custom.env"
|
|
|
|
chown "$app:$app" "$data_dir/custom.env"
|
|
|
|
|
2024-03-10 22:05:42 +01:00
|
|
|
#=================================================
|
|
|
|
# SET PERMISSION FOR THE USER
|
|
|
|
#=================================================
|
|
|
|
ynh_permission_update --permission="main" --add="$admin"
|
|
|
|
|
2024-03-09 23:40:16 +01:00
|
|
|
#=================================================
|
|
|
|
# SYSTEM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2024-03-10 20:38:30 +01:00
|
|
|
yunohost service add "$app" --description="The hacker's notebook"
|
2024-03-09 23:40:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
|
|
|
|
2024-03-10 20:38:30 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="start"
|
2024-03-09 23:40:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|