mirror of
https://github.com/YunoHost-Apps/sogo_ynh.git
synced 2024-09-03 20:26:07 +02:00
66 lines
2.3 KiB
Bash
Executable file
66 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Set variable
|
|
path="/SOGo"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring application..." --weight=3
|
|
|
|
mkdir -p "/etc/$app"
|
|
ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf"
|
|
chown -R "$app:$app" "/etc/$app"
|
|
chmod -R 750 "/etc/$app"
|
|
|
|
# Configure stunnel
|
|
# To fix the issue https://sogo.nu/bugs/view.php?id=31 we need stunnel to be able to connect correctly to the smtp server
|
|
ynh_add_config --template="stunnel.conf" --destination="/etc/stunnel/$app.conf"
|
|
|
|
# Enable stunnel at startup
|
|
ynh_replace_string --match_string="ENABLED=0" --replace_string="ENABLED=1" --target_file="/etc/default/stunnel4"
|
|
|
|
#=================================================
|
|
# SETUP A CRON
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up a cron..." --weight=1
|
|
|
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
|
chown root: "/etc/cron.d/$app"
|
|
chmod 644 "/etc/cron.d/$app"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
config_nginx
|
|
|
|
yunohost service add "sogo" --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log"
|
|
|
|
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
|
chown -R "$app:$app" "/var/log/$app"
|
|
chmod -R 750 "/var/log/$app"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
|
ynh_systemd_action --service_name="stunnel4" --action="restart" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|