2021-05-21 14:13:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2023-04-07 14:32:57 +02:00
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
password=$YNH_APP_ARG_PASSWORD
|
|
|
|
ynh_app_setting_set --app=$app --key=password --value=$password
|
|
|
|
|
2021-05-21 14:13:08 +02:00
|
|
|
#=================================================
|
|
|
|
# CREATE A POSTGRESQL DATABASE
|
|
|
|
#=================================================
|
2023-04-07 13:30:21 +02:00
|
|
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
2021-05-21 14:13:08 +02:00
|
|
|
|
|
|
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION hstore;" --database=$db_name
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
|
2023-04-07 13:30:21 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2021-05-21 14:13:08 +02:00
|
|
|
|
2023-04-07 13:22:55 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2023-12-09 22:13:31 +01:00
|
|
|
chmod +x "$install_dir/miniflux"
|
2021-05-21 14:13:08 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
|
2023-12-09 22:13:31 +01:00
|
|
|
ynh_add_config --template="miniflux.conf" --destination="$install_dir/$app.conf"
|
2022-07-02 08:46:52 +02:00
|
|
|
|
2023-04-07 13:22:55 +02:00
|
|
|
chmod 600 "$install_dir/$app.conf"
|
|
|
|
chown $app "$install_dir/$app.conf"
|
2021-05-21 14:13:08 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-08-21 09:17:20 +02:00
|
|
|
# SYSTEM CONFIGURATION
|
2021-05-21 14:13:08 +02:00
|
|
|
#=================================================
|
2023-08-21 09:17:20 +02:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2021-05-21 14:13:08 +02:00
|
|
|
|
2023-08-21 09:17:20 +02:00
|
|
|
ynh_add_nginx_config
|
2021-05-21 14:13:08 +02:00
|
|
|
|
2023-08-21 09:17:20 +02:00
|
|
|
ynh_add_systemd_config
|
2021-11-16 20:34:36 +01:00
|
|
|
|
|
|
|
ynh_use_logrotate
|
|
|
|
|
2021-05-21 14:13:08 +02:00
|
|
|
yunohost service add $app --description="Minimalist feed reader" --log="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
|
2023-11-12 21:23:47 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
2021-05-21 14:13:08 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|