2017-09-28 12:47:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
|
2017-09-28 12:47:55 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2017-09-28 12:47:55 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_script_progression --message="Downloading and installing $app package..." --weight=1
|
2021-12-20 10:42:16 +01:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
_install_tvheadend_package
|
2019-10-23 10:16:15 +02:00
|
|
|
# The deb install automatically create the hts system user
|
|
|
|
|
2019-10-15 15:56:27 +02:00
|
|
|
# Tvheadend automatically start after install
|
2019-10-15 17:33:46 +02:00
|
|
|
# we stop it before the configuration
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-10-15 17:33:46 +02:00
|
|
|
# MODIFY TVHEADEND CONFIG FILES
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2021-09-30 14:53:52 +02:00
|
|
|
ynh_script_progression --message="Update configuration files..." --weight=1
|
|
|
|
|
2019-10-15 17:33:46 +02:00
|
|
|
# Copy and modify /etc/default/tvheadend
|
2024-01-14 21:36:05 +01:00
|
|
|
conf_dir=$install_dir/.hts/tvheadend
|
|
|
|
ynh_app_setting_set --app="$app" --key=conf_dir --value="$conf_dir"
|
|
|
|
if [ "$path" = "/" ]; then
|
|
|
|
ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
2021-09-30 18:19:45 +02:00
|
|
|
else
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
2021-12-15 21:02:36 +01:00
|
|
|
fi
|
2021-09-30 18:19:45 +02:00
|
|
|
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2019-10-20 18:28:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2019-10-20 18:28:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2022-03-08 23:09:32 +01:00
|
|
|
|
2024-01-14 22:43:33 +01:00
|
|
|
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2022-03-08 23:09:32 +01:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
|
|
|
# Start a systemd service
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="start"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
|
2024-01-14 22:43:33 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed, HTSP port is $port_stream" --last
|