mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
0a33aa157e
* v2 * Auto-update README * v2 * Auto-update README * fix * Update install * Update systemd.service * fix * fix * fix * fix * Update manifest.toml * cleaning * Update config_panel.toml --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
94 lines
2.9 KiB
Bash
94 lines
2.9 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
secret=$(ynh_string_random --length=24)
|
|
max_file_size=100
|
|
use_ldap=$YNH_APP_ARG_USE_LDAP
|
|
|
|
#=================================================
|
|
# STORE SETTINGS FROM MANIFEST
|
|
#=================================================
|
|
|
|
ynh_app_setting_set --app=$app --key=use_ldap --value=$use_ldap
|
|
ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size
|
|
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_use_logrotate
|
|
|
|
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
|
|
|
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
|
chmod +x $install_dir/script/lufi
|
|
|
|
#=================================================
|
|
# CONFIGURE LUFI
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring $app..."
|
|
|
|
ldap="#"
|
|
if [ $use_ldap -eq 1 ];
|
|
then
|
|
ldap=""
|
|
fi
|
|
|
|
ynh_add_config --template="../conf/lufi.conf" --destination="$install_dir/lufi.conf"
|
|
|
|
chmod 600 $install_dir/lufi.conf
|
|
chown $app:$app $install_dir/lufi.conf
|
|
|
|
#=================================================
|
|
# INSTALL LUFI
|
|
#=================================================
|
|
ynh_script_progression --message="Installing $app..."
|
|
|
|
pushd $install_dir
|
|
carton install --deployment --without=sqlite --without=mysql --without=htpasswd --without=test
|
|
popd
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --line_match="Creating process id file" --log_path="$install_dir/log/production.log"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|