#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INSTALL NODEJS #================================================= ynh_script_progression --message="Installing NodeJS..." --weight=1 ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" #================================================= # ENABLE MANDATORY FRENCH LOCALE #================================================= ynh_script_progression --message="Enabling french system locale..." --weight=1 sed -i 's|^#\? \?\(fr_FR.UTF-8 \?.*\)$|\1|' /etc/locale.gen locale-gen #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir/caerp" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SETUP APPLICATION #================================================= ynh_script_progression --message="Building $app..." --weight=1 _ynh_caerp_build_ui _ynh_caerp_build_python #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding $app's configuration file..." --weight=1 redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" ynh_add_config --template="caerp.ini" --destination="$install_dir/caerp.ini" chmod 500 "$install_dir/caerp.ini" chown "$app:$app" "$install_dir/caerp.ini" #================================================= # CREATE LOG DIRECTORY #================================================= mkdir -p "/var/log/$app" chown -R "$app:$app" "/var/log/$app" chmod 750 "/var/log/$app" #================================================= # SETUP APPLICATION #================================================= ynh_script_progression --message="Configuring $app..." --weight=1 _ynh_caerp_migratedb _ynh_caerp_add_admin #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_add_nginx_config ynh_add_systemd_config yunohost service add "$app" --description="CAERP, logiciel de comptabilité pour CAE" --log="/var/log/$app/logfile.log" ynh_use_logrotate --logfile="/var/log/$app/logfile.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting $app's systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/logfile.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last