mirror of
https://github.com/YunoHost-Apps/jitsi_ynh.git
synced 2024-09-03 19:35:57 +02:00
100 lines
4 KiB
Bash
100 lines
4 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STANDARD RESTORATION STEPS
|
|
#=================================================
|
|
# RECREATE THE DEDICATED USER
|
|
#=================================================
|
|
ynh_script_progression --message="Reconfiguring the dedicated system user..." --weight=1
|
|
|
|
gpasswd --add prosody "$app"
|
|
gpasswd --add www-data "$app"
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
|
|
|
chmod 750 "$install_dir"
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:$app" "$install_dir"
|
|
|
|
#=================================================
|
|
# CONFIGURE PROSODY
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring prosody..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="/etc/prosody/conf.avail/$domain.cfg.lua"
|
|
chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua"
|
|
ln -s "/etc/prosody/conf.avail/$domain.cfg.lua" "/etc/prosody/conf.d/$domain.cfg.lua"
|
|
|
|
echo | prosodyctl cert generate "$domain"
|
|
ln -sf "/var/lib/prosody/$domain.key" "/etc/prosody/certs/$domain.key"
|
|
ln -sf "/var/lib/prosody/$domain.crt" "/etc/prosody/certs/$domain.crt"
|
|
|
|
echo | prosodyctl cert generate "auth.$domain"
|
|
ln -sf "/var/lib/prosody/auth.$domain.key" "/etc/prosody/certs/auth.$domain.key"
|
|
ln -sf "/var/lib/prosody/auth.$domain.crt" "/etc/prosody/certs/auth.$domain.crt"
|
|
ln -sf "/var/lib/prosody/auth.$domain.crt" "/usr/local/share/ca-certificates/auth.$domain.crt"
|
|
|
|
update-ca-certificates -f
|
|
|
|
ynh_systemd_action --service_name="prosody" --action="restart"
|
|
|
|
prosodyctl register "$focus_user" "auth.$domain" "$focus_password"
|
|
prosodyctl register "$videobridge_user" "auth.$domain" "$videobridge_secret"
|
|
prosodyctl mod_roster_command subscribe "$focus_user.$domain" "$focus_user@auth.$domain"
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app-videobridge.service"
|
|
systemctl enable "$app-videobridge.service" --quiet
|
|
yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports $port $port_videobridge
|
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service"
|
|
systemctl enable "$app-jicofo.service" --quiet
|
|
yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
|
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
|
|
#=================================================
|
|
# RESTORE VARIOUS FILES
|
|
#=================================================
|
|
|
|
ynh_restore_file --origin_path="/etc/$app/"
|
|
chmod 644 "/etc/$app/meet/$domain-config.js"
|
|
|
|
ynh_restore_file --origin_path="/var/log/$app/"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app-jicofo" --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
|
ynh_systemd_action --service_name="$app-videobridge" --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|