mirror of
https://github.com/YunoHost-Apps/tvheadend_ynh.git
synced 2024-10-01 13:34:50 +02:00
Update upstream version to 4.3.1979 and update scripts (#6)
This commit is contained in:
parent
66fc3efd20
commit
49e2aa4be9
8 changed files with 114 additions and 92 deletions
|
@ -1,7 +1,15 @@
|
||||||
#
|
#
|
||||||
# Default configuration for tvheadend
|
# Default configuration for tvheadend
|
||||||
#
|
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
# See tvheadend --help for more - default "-u hts -g video"
|
||||||
|
OPTIONS="-u hts -g video"
|
||||||
|
|
||||||
|
# sysvinit
|
||||||
|
#
|
||||||
|
# Editing the following variables has no effect when using systemd
|
||||||
|
# modify the OPTIONS variable (above) instead.
|
||||||
|
#
|
||||||
# TVH_ENABLED
|
# TVH_ENABLED
|
||||||
# set to 0 to disable upstart job
|
# set to 0 to disable upstart job
|
||||||
TVH_ENABLED=1
|
TVH_ENABLED=1
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "TV streaming server and recorder",
|
"en": "TV streaming server and recorder",
|
||||||
"fr": "Serveur de streaming et d'enregistrement TV"
|
"fr": "Serveur de streaming et d'enregistrement TV"
|
||||||
},
|
},
|
||||||
"version": "4.2.8-36~ynh5",
|
"version": "4.3.1979~ynh5",
|
||||||
"url": "https://tvheadend.org",
|
"url": "https://tvheadend.org",
|
||||||
"license": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies_x86="libavahi-client3 libavahi-common3 libc6 libdbus-1-3 libssl1.1 libstdc++6 liburiparser1 zlib1g dvb-apps bzip2"
|
pkg_dependencies_x86="libavahi-client3 libavahi-common3 libc6 libdbus-1-3 libdvbcsa1 libpcre3 libssl1.1 libstdc++6 liburiparser1 zlib1g bzip2"
|
||||||
pkg_dependencies_rb="libavahi-client3 libavahi-common3 libc6 libdbus-1-3 libssl1.1 liburiparser1 zlib1g dvb-apps bzip2"
|
pkg_dependencies_rb="libavahi-client3 libavahi-common3 libc6 libdbus-1-3 libdvbcsa1 libpcre2-8-0 libssl1.1 liburiparser1 zlib1g bzip2"
|
||||||
|
|
||||||
# deb package URLs
|
# deb package URLs
|
||||||
tvheadend_deb_x86_64="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.2.8-36/tvheadend_4.2.8-36%7Eg5bdcfd8ac%7Estretch_amd64.deb"
|
tvheadend_deb_x86="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.3.1979/tvheadend_4.3-1979%7Eg8fc2dfa7e%7Estretch_amd64.deb"
|
||||||
tvheadend_deb_arm="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.2.8-36/tvheadend_4.2.8-36%7Eg5bdcfd8ac%7Eraspbianstretch_armhf.deb"
|
tvheadend_deb_arm="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.3.1979/tvheadend_4.3-1979%7Eg8fc2dfa7e%7Eraspbianstretch_armhf.deb"
|
|
@ -23,7 +23,13 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
|
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||||
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
conf_dir=$(ynh_app_setting_get --app=$app --key=conf_dir)
|
||||||
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -27,7 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=2
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/home/hts # Default path for Tvheadend deb package
|
final_path=/home/hts # Default path for Tvheadend deb package
|
||||||
test ! -e "$final_path" || ynh_die --message="The path $final_path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="The path $final_path already contains a folder"
|
||||||
|
@ -38,7 +38,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
|
@ -51,20 +51,21 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN PORTS
|
# FIND AND OPEN PORTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=15
|
ynh_script_progression --message="Finding available ports..." --weight=1
|
||||||
|
|
||||||
# Find a free port for the web server
|
# Find available ports for web interface and streaming
|
||||||
port=$(ynh_find_port --port=9981)
|
port=$(ynh_find_port --port=9981)
|
||||||
# Open this port
|
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
# Find a free port for the streaming server
|
|
||||||
stream_port=$(ynh_find_port --port=9982)
|
stream_port=$(ynh_find_port --port=9982)
|
||||||
# Open this port
|
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
|
|
||||||
ynh_app_setting_set --app=$app --key=stream_port --value=$stream_port
|
ynh_app_setting_set --app=$app --key=stream_port --value=$stream_port
|
||||||
|
|
||||||
|
# Open ports
|
||||||
|
ynh_script_progression --message="Configuring firewall..." --weight=15
|
||||||
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||||
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -84,16 +85,12 @@ ynh_script_progression --message="Downloading Tvheadend..." --weight=5
|
||||||
|
|
||||||
temp_folder="$(mktemp -d)"
|
temp_folder="$(mktemp -d)"
|
||||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||||
tvheadend_deb_url=""
|
|
||||||
|
|
||||||
if [ -n "$(uname -m | grep arm)" ]
|
if [ -n "$(uname -m | grep arm)" ]
|
||||||
then
|
then
|
||||||
tvheadend_deb_url="$tvheadend_deb_arm"
|
tvheadend_deb_url="$tvheadend_deb_arm"
|
||||||
elif [ -n "$(uname -m | grep x86_64)" ]
|
|
||||||
then
|
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_64"
|
|
||||||
else
|
else
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_32"
|
tvheadend_deb_url="$tvheadend_deb_x86"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
||||||
|
@ -103,7 +100,7 @@ ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Tvheadend..." --weight=24
|
ynh_script_progression --message="Installing Tvheadend..." --weight=24
|
||||||
|
|
||||||
ynh_exec_warn_less dpkg -i $tvheadend_deb_dst
|
ynh_exec_warn_less DEBIAN_FRONTEND=noninteractive dpkg -i $tvheadend_deb_dst
|
||||||
|
|
||||||
ynh_secure_remove --file="$temp_folder"
|
ynh_secure_remove --file="$temp_folder"
|
||||||
|
|
||||||
|
@ -116,20 +113,17 @@ ynh_systemd_action --service_name=$app --action="stop"
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY TVHEADEND CONFIG FILES
|
# MODIFY TVHEADEND CONFIG FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Update configuration files..." --weight=1
|
||||||
|
|
||||||
# Copy and modify /etc/default/tvheadend
|
# Copy and modify /etc/default/tvheadend
|
||||||
cp ../conf/tvheadend /etc/default/tvheadend
|
conf_dir=$final_path/.hts/tvheadend
|
||||||
ynh_replace_string --match_string="__CONF_DIR__" --replace_string="$final_path/.hts/tvheadend" --target_file="/etc/default/tvheadend"
|
ynh_app_setting_set --app=$app --key=conf_dir --value=$conf_dir
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/tvheadend"
|
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="/etc/default/tvheadend"
|
|
||||||
ynh_replace_string --match_string="__STREAM_PORT__" --replace_string="$stream_port" --target_file="/etc/default/tvheadend"
|
|
||||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/default/tvheadend"
|
|
||||||
ynh_store_file_checksum --file="/etc/default/tvheadend"
|
|
||||||
|
|
||||||
# Copy and modify /home/hts/.hts/tvheadend/superuser
|
# Copy and modify /home/hts/.hts/tvheadend/superuser
|
||||||
cp ../conf/superuser $final_path/.hts/tvheadend/superuser
|
ynh_add_config --template="superuser" --destination="${conf_dir}/superuser"
|
||||||
ynh_replace_string --match_string="__SUPERUSER__" --replace_string="$superuser" --target_file="$final_path/.hts/tvheadend/superuser"
|
chown hts:video "${conf_dir}/superuser"
|
||||||
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/.hts/tvheadend/superuser"
|
chmod 600 "${conf_dir}/superuser"
|
||||||
ynh_store_file_checksum --file="$final_path/.hts/tvheadend/superuser"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -150,9 +144,10 @@ chmod 666 /var/log/$app.log
|
||||||
ynh_use_logrotate --logfile=/var/log/$app.log
|
ynh_use_logrotate --logfile=/var/log/$app.log
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
yunohost service add $app --log "/var/log/$app.log"
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
yunohost service add $app --description="TV streaming server and recorder" --log "/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -31,7 +31,7 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||||
ynh_script_progression --message="Stopping Tvheadend service..." --weight=2
|
ynh_script_progression --message="Stopping Tvheadend service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop
|
ynh_systemd_action --service_name=$app --action=stop
|
||||||
ynh_exec_quiet systemctl disable $app
|
ynh_exec_quiet systemctl disable $app --quiet
|
||||||
ynh_exec_quiet systemctl daemon-reload
|
ynh_exec_quiet systemctl daemon-reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,12 +42,19 @@ ynh_script_progression --message="Disable prevent Tvheadend being upgraded throu
|
||||||
apt-mark unhold tvheadend
|
apt-mark unhold tvheadend
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# REMOVE TVHEADEND
|
||||||
#=================================================
|
#=================================================
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
ynh_script_progression --message="Removing Tvheadend..." --weight=6
|
||||||
|
|
||||||
|
ynh_package_autopurge $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service..." --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -65,12 +72,12 @@ ynh_script_progression --message="Removing $app log file..." --weight=1
|
||||||
ynh_secure_remove --file="/var/log/$app.log"
|
ynh_secure_remove --file="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
ynh_script_progression --message="Removing dependencies..." --weight=3
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_nginx_config
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR AND CONFIG FILES
|
# REMOVE APP MAIN DIR AND CONFIG FILES
|
||||||
|
@ -82,30 +89,15 @@ ynh_secure_remove --file="$final_path"
|
||||||
ynh_secure_remove --file="/etc/default/tvheadend"
|
ynh_secure_remove --file="/etc/default/tvheadend"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE TVHEADEND
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing Tvheadend..." --weight=6
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
ynh_package_autopurge $app
|
# Remove the dedicated NGINX config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# CLOSE PORTS
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated hts system user..." --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=hts
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=3
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE TVHEADEND PORTS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
|
@ -119,6 +111,14 @@ then
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $stream_port
|
ynh_exec_warn_less yunohost firewall disallow TCP $stream_port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the dedicated hts system user..." --weight=1
|
||||||
|
|
||||||
|
# Delete a system user
|
||||||
|
ynh_system_user_delete --username=hts
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,6 +26,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
conf_dir=$(ynh_app_setting_get --app=$app --key=conf_dir)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# OPEN TVHEADEND PORTS
|
# OPEN TVHEADEND PORTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring firewall..." --weight=15
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
ynh_die --message="Port $port already open (and maybe used by another application)"
|
ynh_die --message="Port $port already open (and maybe used by another application)"
|
||||||
|
@ -76,16 +78,12 @@ ynh_script_progression --message="Downloading Tvheadend..." --weight=3
|
||||||
|
|
||||||
temp_folder="$(mktemp -d)"
|
temp_folder="$(mktemp -d)"
|
||||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||||
tvheadend_deb_url=""
|
|
||||||
|
|
||||||
if [ -n "$(uname -m | grep arm)" ]
|
if [ -n "$(uname -m | grep arm)" ]
|
||||||
then
|
then
|
||||||
tvheadend_deb_url="$tvheadend_deb_arm"
|
tvheadend_deb_url="$tvheadend_deb_arm"
|
||||||
elif [ -n "$(uname -m | grep x86_64)" ]
|
|
||||||
then
|
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_64"
|
|
||||||
else
|
else
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_32"
|
tvheadend_deb_url="$tvheadend_deb_x86"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
||||||
|
@ -95,7 +93,7 @@ ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Tvheadend..." --weight=13
|
ynh_script_progression --message="Installing Tvheadend..." --weight=13
|
||||||
|
|
||||||
ynh_exec_warn_less dpkg -i $tvheadend_deb_dst
|
ynh_exec_warn_less DEBIAN_FRONTEND=noninteractive dpkg -i $tvheadend_deb_dst
|
||||||
|
|
||||||
ynh_secure_remove --file="$temp_folder"
|
ynh_secure_remove --file="$temp_folder"
|
||||||
|
|
||||||
|
@ -129,9 +127,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
ynh_restore_file --origin_path="/var/log/$app.log"
|
ynh_restore_file --origin_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
yunohost service add $app --log "/var/log/$app.log"
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
yunohost service add $app --description="TV streaming server and recorder" --log "/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -20,6 +20,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
conf_dir=$(ynh_app_setting_get --app=$app --key=conf_dir)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||||
|
|
||||||
|
@ -51,23 +52,24 @@ ynh_script_progression --message="Stopping Tvheadend service..." --weight=3
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=15
|
|
||||||
|
|
||||||
if [ -n "$(uname -m | grep arm)" ]
|
|
||||||
then
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies_rb
|
|
||||||
else
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies_x86
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE TVHEADEND DEB PACKAGE
|
# UPGRADE TVHEADEND DEB PACKAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=15
|
||||||
|
|
||||||
|
if [ -n "$(uname -m | grep arm)" ]
|
||||||
|
then
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies_rb
|
||||||
|
else
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies_x86
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD TVHEADEND DEB PACKAGE
|
# DOWNLOAD TVHEADEND DEB PACKAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,16 +77,12 @@ then
|
||||||
|
|
||||||
temp_folder="$(mktemp -d)"
|
temp_folder="$(mktemp -d)"
|
||||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||||
tvheadend_deb_url=""
|
|
||||||
|
|
||||||
if [ -n "$(uname -m | grep arm)" ]
|
if [ -n "$(uname -m | grep arm)" ]
|
||||||
then
|
then
|
||||||
tvheadend_deb_url="$tvheadend_deb_arm"
|
tvheadend_deb_url="$tvheadend_deb_arm"
|
||||||
elif [ -n "$(uname -m | grep x86_64)" ]
|
|
||||||
then
|
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_64"
|
|
||||||
else
|
else
|
||||||
tvheadend_deb_url="$tvheadend_deb_x86_32"
|
tvheadend_deb_url="$tvheadend_deb_x86"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
ynh_exec_quiet "wget -q -O $tvheadend_deb_dst $tvheadend_deb_url"
|
||||||
|
@ -94,7 +92,7 @@ then
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading Tvheadend..." --weight=24
|
ynh_script_progression --message="Upgrading Tvheadend..." --weight=24
|
||||||
|
|
||||||
ynh_exec_warn_less dpkg -i $tvheadend_deb_dst
|
ynh_exec_warn_less DEBIAN_FRONTEND=noninteractive dpkg --force-confold -i $tvheadend_deb_dst
|
||||||
|
|
||||||
ynh_secure_remove --file="$temp_folder"
|
ynh_secure_remove --file="$temp_folder"
|
||||||
|
|
||||||
|
@ -104,15 +102,31 @@ then
|
||||||
# we stop it before the configuration
|
# we stop it before the configuration
|
||||||
ynh_systemd_action --service_name=$app --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
# Deb install seems to remove the superuser config, let's restore it
|
#=================================================
|
||||||
|
# RESTORE TVHEADEND CONFIG FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restore/update configuration files..." --weight=1
|
||||||
|
|
||||||
|
# Copy and modify /etc/default/tvheadend
|
||||||
|
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||||
|
|
||||||
# Copy and modify /home/hts/.hts/tvheadend/superuser
|
# Copy and modify /home/hts/.hts/tvheadend/superuser
|
||||||
cp ../conf/superuser $final_path/.hts/tvheadend/superuser
|
ynh_add_config --template="superuser" --destination="${conf_dir}/superuser"
|
||||||
ynh_replace_string --match_string="__SUPERUSER__" --replace_string="$superuser" --target_file="$final_path/.hts/tvheadend/superuser"
|
chown hts:video "${conf_dir}/superuser"
|
||||||
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/.hts/tvheadend/superuser"
|
chmod 600 "${conf_dir}/superuser"
|
||||||
ynh_store_file_checksum --file="$final_path/.hts/tvheadend/superuser"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue