mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
4311a7ac2d
* Small fixs * Auto-update README * Version 2 (#79) * 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> * Delete check_process --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
109 lines
3.3 KiB
Bash
109 lines
3.3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="$install_dir/log/production.log"
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
|
|
|
if [ -z "${max_file_size:-}" ]; then
|
|
max_file_size=100 # 100 Mo
|
|
ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size
|
|
fi
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
then
|
|
ynh_script_progression --message="Upgrading source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
fi
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# SPECIFIC UPGRADE
|
|
#=================================================
|
|
# SETUP LUFI
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Lufi..."
|
|
|
|
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
|
|
|
|
#=================================================
|
|
# BUILD LUFI
|
|
#=================================================
|
|
ynh_script_progression --message="Building Lufi..."
|
|
|
|
pushd $install_dir
|
|
carton install --deployment --without=sqlite --without=mysql --without=htpasswd --without=test
|
|
popd
|
|
|
|
#=================================================
|
|
# SETUP CRON
|
|
#=================================================
|
|
ynh_script_progression --message="Setuping cron..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
|
chmod +x $install_dir/script/lufi
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
ynh_use_logrotate --non-append
|
|
|
|
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="$install_dir/log/production.log" --line_match="Creating process id file"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed"
|