mirror of
https://github.com/YunoHost-Apps/tvheadend_ynh.git
synced 2024-10-01 13:34:50 +02:00
69 lines
2.4 KiB
Bash
69 lines
2.4 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# INITIALIZE AND STORE SETTINGS
|
|
#=================================================
|
|
|
|
# Passwords are not saved by default.
|
|
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Downloading and installing $app package..." --weight=1
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
_install_tvheadend_package
|
|
# The deb install automatically create the hts system user
|
|
|
|
# Tvheadend automatically start after install
|
|
# we stop it before the configuration
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
|
|
|
#=================================================
|
|
# MODIFY TVHEADEND CONFIG FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Update configuration files..." --weight=1
|
|
|
|
# Copy and modify /etc/default/tvheadend
|
|
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"
|
|
else
|
|
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
|
fi
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name="$app" --action="start"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed, HTSP port is $port_stream" --last
|