From e1fcefba015265c2a794d130c7af0a61033b4e41 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 30 May 2023 11:58:44 +0000 Subject: [PATCH 01/13] Auto-update README --- README.md | 22 +++++++++++----------- README_fr.md | 36 ++++++++++++++++++++---------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 6d39e8b..2a2923c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Tvheadend for YunoHost -[![Integration level](https://dash.yunohost.org/integration/tvheadend.svg)](https://dash.yunohost.org/appci/app/tvheadend) ![](https://ci-apps.yunohost.org/ci/badges/tvheadend.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/tvheadend.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/tvheadend.svg)](https://dash.yunohost.org/appci/app/tvheadend) ![Working status](https://ci-apps.yunohost.org/ci/badges/tvheadend.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/tvheadend.maintain.svg) + [![Install Tvheadend with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=tvheadend) *[Lire ce readme en français.](./README_fr.md)* @@ -19,29 +20,28 @@ TV streaming server and recorder **Shipped version:** 4.3.2009~ynh10 - - ## Screenshots -![](./doc/screenshots/overall_screenshot.png) +![Screenshot of Tvheadend](./doc/screenshots/overall_screenshot.png) ## Documentation and resources -* Official app website: https://tvheadend.org -* Official user documentation: https://tvheadend.org/projects/tvheadend/wiki -* Upstream app code repository: https://github.com/tvheadend/tvheadend -* YunoHost documentation for this app: https://yunohost.org/app_tvheadend -* Report a bug: https://github.com/YunoHost-Apps/tvheadend_ynh/issues +* Official app website: +* Official user documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing --debug or sudo yunohost app upgrade tvheadend -u https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index a5a3e25..07a5dd8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,43 +1,47 @@ + + # Tvheadend pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/tvheadend.svg)](https://dash.yunohost.org/appci/app/tvheadend) ![](https://ci-apps.yunohost.org/ci/badges/tvheadend.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/tvheadend.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/tvheadend.svg)](https://dash.yunohost.org/appci/app/tvheadend) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/tvheadend.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/tvheadend.maintain.svg) + [![Installer Tvheadend avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=tvheadend) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer Tvheadend rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer Tvheadend rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Serveur de streaming et d'enregistrement TV **Version incluse :** 4.3.2009~ynh10 +## Captures d’écran - -## Captures d'écran - -![](./doc/screenshots/overall_screenshot.png) +![Capture d’écran de Tvheadend](./doc/screenshots/overall_screenshot.png) ## Documentations et ressources -* Site officiel de l'app : https://tvheadend.org -* Documentation officielle utilisateur : https://tvheadend.org/projects/tvheadend/wiki -* Dépôt de code officiel de l'app : https://github.com/tvheadend/tvheadend -* Documentation YunoHost pour cette app : https://yunohost.org/app_tvheadend -* Signaler un bug : https://github.com/YunoHost-Apps/tvheadend_ynh/issues +* Site officiel de l’app : +* Documentation officielle utilisateur : +* Dépôt de code officiel de l’app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing --debug ou sudo yunohost app upgrade tvheadend -u https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 55ae609a2c2b689684a9eca2b5d34b6ede54c56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 21:36:05 +0100 Subject: [PATCH 02/13] Manifest v2 --- check_process | 21 ------ conf/nginx.conf | 16 ++--- doc/DISCLAIMER.md | 0 manifest.json | 56 ---------------- manifest.toml | 103 ++++++++++++++++++++++++++++ scripts/_common.sh | 46 +++++++++++-- scripts/backup | 22 +----- scripts/change_url | 110 ++---------------------------- scripts/install | 158 +++++-------------------------------------- scripts/remove | 69 ++----------------- scripts/restore | 124 ++++------------------------------ scripts/upgrade | 162 +++++++++------------------------------------ tests.toml | 9 +++ 13 files changed, 234 insertions(+), 662 deletions(-) delete mode 100644 check_process delete mode 100644 doc/DISCLAIMER.md delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index e6a36ed..0000000 --- a/check_process +++ /dev/null @@ -1,21 +0,0 @@ -;; Full test - ; Manifest - domain="domain.tld" - path="/path" - superuser="toto" - password="1Strong-Password" - port="9982" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=0 - upgrade=1 - # 4.3.1979~ynh9 - upgrade=1 from_commit=e82643952e5567db826790e1e4a353559f66f112 - backup_restore=1 - multi_instance=0 - port_already_use=1 - change_url=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index 98fa867..d381b6e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,13 +1,13 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 214876c..0000000 --- a/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "Tvheadend", - "id": "tvheadend", - "packaging_format": 1, - "description": { - "en": "TV streaming server and recorder", - "fr": "Serveur de streaming et d'enregistrement TV" - }, - "version": "4.3.2009~ynh10", - "url": "https://tvheadend.org", - "upstream": { - "license": "GPL-3.0", - "website": "https://tvheadend.org", - "userdoc": "https://tvheadend.org/projects/tvheadend/wiki", - "code": "https://github.com/tvheadend/tvheadend" - }, - "license": "GPL-3.0", - "maintainer": { - "name": "Sylvain Cecchetto", - "email": "cecchetto.sylvain@me.com" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/tvh", - "default": "/tvh" - }, - { - "name": "superuser", - "type": "string", - "ask": { - "en": "Choose the superuser name in order to login on Tvheadend", - "fr": "Choisissez le nom du superutilisateur pour la connexion à Tvheadend" - }, - "example": "johndoe" - }, - { - "name": "password", - "type": "password" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..3ad1403 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,103 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "tvheadend" +name = "Tvheadend" +description.en = "TV streaming server and recorder" +description.fr = "Serveur de streaming et d'enregistrement TV" + +version = "4.3.2009~ynh10" + +maintainers = ["Sylvain Cecchetto"] + +[upstream] +license = "GPL-3.0" +website = "https://tvheadend.org" +userdoc = "https://tvheadend.org/projects/tvheadend/wiki" +code = "https://github.com/tvheadend/tvheadend" + +[integration] +yunohost = ">= 4.3.0" +architectures = ["amd64", "armhf"] +multi_instance = false +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/tvh" + + [install.superuser] + ask.en = "Choose the superuser name in order to login on Tvheadend" + ask.fr = "Choisissez le nom du superutilisateur pour la connexion à Tvheadend" + type = "string" + example = "johndoe" + + [install.password] + type = "password" + +[resources] + [resources.sources.main_buster] + amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_amd64.deb" + amd64.sha256 = "faf486839aa96058b20bd14242cde15371072d69b92313f9a60c63fa21bfc27a" + armhf.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_armhf.deb" + armhf.sha256 = "8c5e16b2320f3de4bd145bdd4de8cd5be6298b3b61412c943435c756b1c508d2" + arm64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_arm64.deb" + arm64.sha256 = "8e5464ab7d5634942fe5da7d68a773b1dcd09b4736c4994a2065705b556e25dc" + rename = "tvheadend.deb" + + format = "whatever" + extract = false + prefetch = false + autoupdate.strategy = "latest_github_tag" + autoupdate.asset = "tarball" + + [resources.sources.main_bullseye] + amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_amd64.deb" + amd64.sha256 = "e8f027620c5af52a805809ff6b42ee321db775f92fb161a6e5875f936f577782" + armhf.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_armhf.deb" + armhf.sha256 = "2b34f372c6272e47880555dd67a1aba23b0410d4b69d5aee41483829bcb3ef89" + arm64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_arm64.deb" + arm64.sha256 = "f672912eb67fe3ac9d469c55d87ce2dde097d441413c862eef758e49b140c5a8" + rename = "tvheadend.deb" + + format = "whatever" + extract = false + prefetch = false + autoupdate.strategy = "latest_github_tag" + autoupdate.asset = "tarball" + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 9981 + stream.default = 9982 + stream.exposed = "TCP" + + [resources.apt] + packages = [ + "libavahi-client3", + "libavahi-common3", + "libc6", + "libdbus-1-3", + "libdvbcsa1", + "libpcre3", + "libssl1.1", + "libstdc++6", + "liburiparser1", + "zlib1g", + "bzip2", + ] diff --git a/scripts/_common.sh b/scripts/_common.sh index d5d23a8..6039510 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,18 +4,50 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -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 libdvbcsa1 libpcre2-8-0 libssl1.1 liburiparser1 zlib1g bzip2" - -# deb package URLs -tvheadend_deb_x86="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.3.2009/tvheadend_4.3-2009%7Eg1295dd2be%7Estretch_amd64.deb" -tvheadend_deb_arm="https://github.com/YunoHost-Apps/tvheadend_ynh/raw/debs/4.3.2009/tvheadend_4.3-2009%7Eg1295dd2be%7Eraspbianstretch_armhf.deb" +debian=$(lsb_release --codename --short) +pkg_version="4.3-2192" #================================================= # PERSONAL HELPERS #================================================= +_install_tvheadend_package() { + # Download the package + if [ ! -f "$install_dir/tvheadend.deb" ]; then + ynh_setup_source --dest_dir="$install_dir" --source_id="main_$debian" + fi + + # Pre-seed debconf database with answers of the interactive dpkg + echo tvheadend tvheadend/admin_password password "$password" | debconf-set-selections + echo tvheadend tvheadend/admin_username string "$superuser" | debconf-set-selections + echo tvheadend tvheadend/last_notes note | debconf-set-selections + + # Install the package + ynh_package_install \ + "$install_dir/tvheadend.deb" + + # The doc says it should be called only once, + # but the code says multiple calls are supported. + # Also, they're already installed so that should be quasi instantaneous. + ynh_install_app_dependencies \ + tvheadend="$pkg_version" + + # Mark packages as dependencies, to allow automatic removal + apt-mark auto tvheadend + + # Prevent tvheadend being upgraded through apt… + apt-mark hold tvheadend +} + +_uninstall_tvheadend_package() { + apt-mark unhold tvheadend + + ynh_package_autopurge tvheadend + + # Delete the system user created by the package + deluser hts --remove-home +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 48295d5..be1f6f2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -39,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index b107e1f..2ceb94c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,64 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -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) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -81,51 +23,16 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config - - # Update Tvheadend configuration file - ynh_script_progression --message="Updating Tvheadend configuration..." --weight=1 - if [ "$path_url" = "/" ] - then - ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend" - else - ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend" - fi -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS #================================================= -# ... -#================================================= - # Update Tvheadend configuration file -if [ $change_path -eq 1 ] -then +if [ "$change_path" -eq 1 ]; then + # Update Tvheadend configuration file ynh_script_progression --message="Updating Tvheadend configuration..." --weight=1 - if [ "$path_url" = "/" ] - then + if [ "$path" = "/" ]; then ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend" else ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend" @@ -140,14 +47,7 @@ fi ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="start" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 972189e..bd5157d 100644 --- a/scripts/install +++ b/scripts/install @@ -10,123 +10,18 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Downloading and installing $app package..." --weight=1 -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -superuser=$YNH_APP_ARG_SUPERUSER -password=$YNH_APP_ARG_PASSWORD - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/home/hts # Default path for Tvheadend deb package -test ! -e "$final_path" || ynh_die --message="This path $final_path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -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=path --value=$path_url -ynh_app_setting_set --app=$app --key=superuser --value=$superuser -ynh_app_setting_set --app=$app --key=password --value=$password -ynh_app_setting_set --app=$app --key=final_path --value=$final_path - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN PORTS -#================================================= -ynh_script_progression --message="Finding available ports..." --weight=1 - -# Find available ports for web interface and streaming -port=$(ynh_find_port --port=9981) -ynh_app_setting_set --app=$app --key=port --value=$port - -stream_port=$(ynh_find_port --port=9982) -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 $stream_port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing 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 - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# DOWNLOAD TVHEADEND DEB PACKAGE -#================================================= -ynh_script_progression --message="Downloading Tvheadend..." --weight=5 - -temp_folder="$(mktemp -d)" -tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb" - -if [ -n "$(uname -m | grep arm)" ] -then - tvheadend_deb_url="$tvheadend_deb_arm" -else - tvheadend_deb_url="$tvheadend_deb_x86" -fi - -ynh_exec_quiet wget -q -O $tvheadend_deb_dst $tvheadend_deb_url - -#================================================= -# INSTALL TVHEADEND DEB PACKAGE -#================================================= -ynh_script_progression --message="Installing Tvheadend..." --weight=24 - -# Pre-seed debconf database with answers of the interactive dpkg -echo tvheadend tvheadend/admin_password password $password | debconf-set-selections -echo tvheadend tvheadend/admin_username string $superuser | debconf-set-selections -echo tvheadend tvheadend/last_notes note | debconf-set-selections - -DEBIAN_FRONTEND=noninteractive ynh_exec_warn_less dpkg -i $tvheadend_deb_dst - -ynh_secure_remove --file="$temp_folder" +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" +ynh_systemd_action --service_name="$app" --action="stop" #================================================= # MODIFY TVHEADEND CONFIG FILES @@ -134,30 +29,23 @@ ynh_systemd_action --service_name=$app --action="stop" ynh_script_progression --message="Update configuration files..." --weight=1 # Copy and modify /etc/default/tvheadend -conf_dir=$final_path/.hts/tvheadend -ynh_app_setting_set --app=$app --key=conf_dir --value=$conf_dir -if [ "$path_url" = "/" ] -then - ynh_add_config --template="tvheadend_no_subpath" --destination="/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" + ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend" fi #================================================= -# PREVENT TVHEADEND BEING UPGRADED THROUGHT APT +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Prevent Tvheadend being upgraded throught APT..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -apt-mark hold tvheadend +# Create a dedicated NGINX config +ynh_add_nginx_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port #================================================= # START SYSTEMD SERVICE @@ -165,21 +53,7 @@ yunohost service add $app --description="TV streaming server and recorder" --nee ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -ynh_permission_update --permission="main" --add="visitors" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="start" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 82a0a09..dac0d28 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,20 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -stream_port=$(ynh_app_setting_get --app=$app --key=stream_port) -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) - #================================================= # STANDARD REMOVE #================================================= @@ -30,8 +16,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # 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 -then +if ynh_exec_warn_less yunohost service status $app >/dev/null; then ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi @@ -41,67 +26,27 @@ fi #================================================= ynh_script_progression --message="Stopping Tvheadend service..." --weight=2 -ynh_systemd_action --service_name=$app --action=stop -ynh_exec_quiet systemctl disable $app --quiet +ynh_systemd_action --service_name="$app" --action=stop +ynh_exec_quiet systemctl disable "$app" --quiet ynh_exec_quiet systemctl daemon-reload #================================================= # UNHOLD TVHEADEND FROM APT #================================================= -ynh_script_progression --message="Disable prevent Tvheadend being upgraded throught APT..." --weight=2 +ynh_script_progression --message="Removing the $app apt package..." --weight=2 -apt-mark unhold tvheadend +_uninstall_tvheadend_package #================================================= -# REMOVE TVHEADEND +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing Tvheadend..." --weight=6 - -ynh_package_autopurge $app - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=3 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $stream_port$" -then - ynh_script_progression --message="Closing port $stream_port..." --weight=8 - ynh_exec_warn_less yunohost firewall disallow TCP $stream_port -fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - ynh_secure_remove --file="/etc/default/tvheadend" -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -deluser hts --remove-home - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index a5e053c..9c063fe 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,108 +11,25 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +ynh_restore_file --origin_path="$install_dir" + +chown -R "$app:www-data" "$install_dir" #================================================= -# LOAD SETTINGS +# DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -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) -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) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=16 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# OPEN TVHEADEND PORTS -#================================================= -ynh_script_progression --message="Configuring firewall..." --weight=15 - -if yunohost firewall list | grep -q "\- $stream_port$" -then - ynh_die --message="Port $stream_port already open (and maybe used by another application)" -fi - -ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=7 - -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 -#================================================= -ynh_script_progression --message="Downloading Tvheadend..." --weight=3 - -temp_folder="$(mktemp -d)" -tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb" - -if [ -n "$(uname -m | grep arm)" ] -then - tvheadend_deb_url="$tvheadend_deb_arm" -else - tvheadend_deb_url="$tvheadend_deb_x86" -fi - -ynh_exec_quiet wget -q -O $tvheadend_deb_dst $tvheadend_deb_url - -#================================================= -# INSTALL TVHEADEND DEB PACKAGE -#================================================= -ynh_script_progression --message="Installing Tvheadend..." --weight=13 - -# Pre-seed debconf database with answers of the interactive dpkg -echo tvheadend tvheadend/admin_password password $password | debconf-set-selections -echo tvheadend tvheadend/admin_username string $superuser | debconf-set-selections -echo tvheadend tvheadend/last_notes note | debconf-set-selections - -DEBIAN_FRONTEND=noninteractive ynh_exec_warn_less dpkg -i $tvheadend_deb_dst - -ynh_secure_remove --file="$temp_folder" +ynh_script_progression --message="Reinstalling $app package..." --weight=1 +_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" +ynh_systemd_action --service_name="$app" --action="stop" #================================================= # RESTORE TVHEADEND CONFIG FILES @@ -120,35 +37,22 @@ ynh_systemd_action --service_name=$app --action="stop" ynh_script_progression --message="Restoring Tvheadend main directory and config files..." --weight=1 ynh_restore_file --origin_path="/etc/default/tvheadend" -ynh_restore_file --origin_path="$final_path" #================================================= -# PREVENT TVHEADEND BEING UPGRADED THROUGHT APT +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Prevent Tvheadend being upgraded throught APT..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 -apt-mark hold tvheadend +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_systemd_action --service_name="$app" --action="start" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 062afc9..8e6119b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,44 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -app=$YNH_APP_INSTANCE_NAME - -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) -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) - -#================================================= -# CHECK VERSION -#================================================= -ynh_script_progression --message="Checking version..." - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -54,118 +16,58 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name="$app" --action="stop" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Downloading and installing $app package..." --weight=1 - ynh_app_setting_delete --app=$app --key=is_public +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 #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE TVHEADEND DEB PACKAGE -#================================================= - -if [ "$upgrade_type" == "UPGRADE_APP" ] -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 - #================================================= - ynh_script_progression --message="Downloading Tvheadend..." --weight=5 - - temp_folder="$(mktemp -d)" - tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb" - - if [ -n "$(uname -m | grep arm)" ] - then - tvheadend_deb_url="$tvheadend_deb_arm" - else - tvheadend_deb_url="$tvheadend_deb_x86" - fi - - ynh_exec_quiet wget -q -O $tvheadend_deb_dst $tvheadend_deb_url - - #================================================= - # INSTALL TVHEADEND DEB PACKAGE - #================================================= - ynh_script_progression --message="Upgrading Tvheadend..." --weight=24 - - DEBIAN_FRONTEND=noninteractive ynh_exec_warn_less dpkg --force-confold -i $tvheadend_deb_dst - - ynh_secure_remove --file="$temp_folder" - - # 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" - - #================================================= - # RESTORE TVHEADEND CONFIG FILES - #================================================= - ynh_script_progression --message="Restore/update configuration files..." --weight=1 - - # Copy and modify /etc/default/tvheadend - if [ "$path_url" = "/" ] - then - ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend" - else - ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend" - fi -fi - -#================================================= -# PREVENT TVHEADEND BEING UPGRADED THROUGHT APT -#================================================= - -apt-mark hold tvheadend - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +# Start a systemd service +ynh_systemd_action --service_name="$app" --action="start" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..aa1eab1 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + test_upgrade_from.e82643952e5567db826790e1e4a353559f66f112.name = "4.3.1979~ynh9" From a3724825e8974954985875c423652917e1ed182d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 21:48:53 +0100 Subject: [PATCH 03/13] test fixes --- manifest.toml | 4 ++++ tests.toml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/manifest.toml b/manifest.toml index 3ad1403..8c70c86 100644 --- a/manifest.toml +++ b/manifest.toml @@ -35,6 +35,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen type = "path" default = "/tvh" + [install.init_main_permission] + type = "group" + default = "visitors" + [install.superuser] ask.en = "Choose the superuser name in order to login on Tvheadend" ask.fr = "Choisissez le nom du superutilisateur pour la connexion à Tvheadend" diff --git a/tests.toml b/tests.toml index aa1eab1..9e989e9 100644 --- a/tests.toml +++ b/tests.toml @@ -6,4 +6,6 @@ test_format = 1.0 # Tests to run # ------------ + args.superuser = "package_checker" + test_upgrade_from.e82643952e5567db826790e1e4a353559f66f112.name = "4.3.1979~ynh9" From df66b8264c5af7c1c478455e11b143c6c0a33bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 22:01:06 +0100 Subject: [PATCH 04/13] fix packages versions --- manifest.toml | 24 ++++++++++-------------- scripts/_common.sh | 3 ++- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/manifest.toml b/manifest.toml index 8c70c86..88064d5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,13 +49,13 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen type = "password" [resources] - [resources.sources.main_buster] - amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_amd64.deb" - amd64.sha256 = "faf486839aa96058b20bd14242cde15371072d69b92313f9a60c63fa21bfc27a" - armhf.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_armhf.deb" - armhf.sha256 = "8c5e16b2320f3de4bd145bdd4de8cd5be6298b3b61412c943435c756b1c508d2" - arm64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/buster/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~buster/tvheadend_4.3-2192~gc9b38a81a~buster_arm64.deb" - arm64.sha256 = "8e5464ab7d5634942fe5da7d68a773b1dcd09b4736c4994a2065705b556e25dc" + [resources.sources.main_bullseye] + amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_amd64.deb" + amd64.sha256 = "e8f027620c5af52a805809ff6b42ee321db775f92fb161a6e5875f936f577782" + armhf.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_armhf.deb" + armhf.sha256 = "2b34f372c6272e47880555dd67a1aba23b0410d4b69d5aee41483829bcb3ef89" + arm64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_arm64.deb" + arm64.sha256 = "f672912eb67fe3ac9d469c55d87ce2dde097d441413c862eef758e49b140c5a8" rename = "tvheadend.deb" format = "whatever" @@ -64,13 +64,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen autoupdate.strategy = "latest_github_tag" autoupdate.asset = "tarball" - [resources.sources.main_bullseye] - amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_amd64.deb" - amd64.sha256 = "e8f027620c5af52a805809ff6b42ee321db775f92fb161a6e5875f936f577782" - armhf.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_armhf.deb" - armhf.sha256 = "2b34f372c6272e47880555dd67a1aba23b0410d4b69d5aee41483829bcb3ef89" - arm64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bullseye/main/t/tv/tvheadend_4.3-2192~gc9b38a81a~bullseye/tvheadend_4.3-2192~gc9b38a81a~bullseye_arm64.deb" - arm64.sha256 = "f672912eb67fe3ac9d469c55d87ce2dde097d441413c862eef758e49b140c5a8" + [resources.sources.main_bookworm] + amd64.url = "https://dl.cloudsmith.io/public/tvheadend/tvheadend/deb/debian/pool/bookworm/main/t/tv/tvheadend_4.3-2098~g44bf691ac~bookworm/tvheadend_4.3-2098~g44bf691ac~bookworm_amd64.deb" + amd64.sha256 = "18a95b1d9c0556590a3089f48cf95d851069eaaba2f4066ea52da2b9d27f5920" rename = "tvheadend.deb" format = "whatever" diff --git a/scripts/_common.sh b/scripts/_common.sh index 6039510..2088c66 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,8 @@ #================================================= debian=$(lsb_release --codename --short) -pkg_version="4.3-2192" +pkg_version_bullseye="4.3-2192~gc9b38a81a~bullseye" +pkg_version_bookworm="4.3-2098~g44bf691ac~bookworm" #================================================= # PERSONAL HELPERS From efbe683f7fadfddaf03a116ab09d821a3a41a8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 22:05:26 +0100 Subject: [PATCH 05/13] bump revision --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 88064d5..d822cbe 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Tvheadend" description.en = "TV streaming server and recorder" description.fr = "Serveur de streaming et d'enregistrement TV" -version = "4.3.2009~ynh10" +version = "4.3.2009~ynh11" maintainers = ["Sylvain Cecchetto"] @@ -18,7 +18,7 @@ userdoc = "https://tvheadend.org/projects/tvheadend/wiki" code = "https://github.com/tvheadend/tvheadend" [integration] -yunohost = ">= 4.3.0" +yunohost = ">= 11.2" architectures = ["amd64", "armhf"] multi_instance = false ldap = "not_relevant" From 00e17f46b6ef8f16c6fa4fb47335b12fe0631d52 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 14 Jan 2024 21:05:34 +0000 Subject: [PATCH 06/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebd6816..95e8a11 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in TV streaming server and recorder -**Shipped version:** 4.3.2009~ynh10 +**Shipped version:** 4.3.2009~ynh11 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 88e423d..3a4d447 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Serveur de streaming et d'enregistrement TV -**Version incluse :** 4.3.2009~ynh10 +**Version incluse :** 4.3.2009~ynh11 ## Captures d’écran From 3add63cce7a87fcf1d475f6d707c1fda738d14a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 22:32:37 +0100 Subject: [PATCH 07/13] fix pkg_version --- scripts/_common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2088c66..148d107 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,9 @@ debian=$(lsb_release --codename --short) pkg_version_bullseye="4.3-2192~gc9b38a81a~bullseye" pkg_version_bookworm="4.3-2098~g44bf691ac~bookworm" +pkg_version_name=pkg_version_$debian +pkg_version="${!pkg_version_name}" + #================================================= # PERSONAL HELPERS #================================================= From 74beb22683dafd5374fe001f3cda7c706e333469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 22:39:48 +0100 Subject: [PATCH 08/13] fix port var name --- conf/tvheadend | 3 +-- conf/tvheadend_no_subpath | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/conf/tvheadend b/conf/tvheadend index eb6926a..197dcb7 100644 --- a/conf/tvheadend +++ b/conf/tvheadend @@ -3,7 +3,7 @@ # systemd # See tvheadend --help for more - default "-u hts -g video" -OPTIONS="-u hts -g video -c __CONF_DIR__ --http_port __PORT__ --http_root __PATH__ --htsp_port __STREAM_PORT__" +OPTIONS="-u hts -g video -c __CONF_DIR__ --http_port __PORT__ --http_root __PATH__ --htsp_port __PORT_STREAM__" # sysvinit # @@ -58,4 +58,3 @@ TVH_DEBUG=0 # TVH_ARGS # add any other arguments TVH_ARGS="" - diff --git a/conf/tvheadend_no_subpath b/conf/tvheadend_no_subpath index 592fc1e..a99b709 100644 --- a/conf/tvheadend_no_subpath +++ b/conf/tvheadend_no_subpath @@ -3,7 +3,7 @@ # systemd # See tvheadend --help for more - default "-u hts -g video" -OPTIONS="-u hts -g video -c __CONF_DIR__ --http_port __PORT__ --htsp_port __STREAM_PORT__" +OPTIONS="-u hts -g video -c __CONF_DIR__ --http_port __PORT__ --htsp_port __PORT_STREAM__" # sysvinit # @@ -58,4 +58,3 @@ TVH_DEBUG=0 # TVH_ARGS # add any other arguments TVH_ARGS="" - From 7dda7b580be64e42b8ee1c6bda633af4e37ca45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 14 Jan 2024 22:43:33 +0100 Subject: [PATCH 09/13] fix --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index bd5157d..dc77826 100644 --- a/scripts/install +++ b/scripts/install @@ -45,7 +45,7 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated NGINX config ynh_add_nginx_config -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream #================================================= # START SYSTEMD SERVICE @@ -59,4 +59,4 @@ ynh_systemd_action --service_name="$app" --action="start" # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed, HTSP port is $stream_port" --last +ynh_script_progression --message="Installation of $app completed, HTSP port is $port_stream" --last diff --git a/scripts/restore b/scripts/restore index 9c063fe..e5496aa 100644 --- a/scripts/restore +++ b/scripts/restore @@ -45,7 +45,7 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream #================================================= # START SYSTEMD SERVICE @@ -60,4 +60,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app, HTSP port is $stream_port" --last +ynh_script_progression --message="Restoration completed for $app, HTSP port is $port_stream" --last diff --git a/scripts/upgrade b/scripts/upgrade index 8e6119b..940714a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,7 +59,7 @@ ynh_script_progression --message="Upgrading system configurations related to $ap # Create a dedicated NGINX config ynh_add_nginx_config -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream #================================================= # START SYSTEMD SERVICE @@ -73,4 +73,4 @@ ynh_systemd_action --service_name="$app" --action="start" # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed, HTSP port is $stream_port" --last +ynh_script_progression --message="Upgrade of $app completed, HTSP port is $port_stream" --last From d5cb594fb3e6abba51dbde7cac2252fabc0bdfd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 15 Jan 2024 23:10:39 +0100 Subject: [PATCH 10/13] Cleanup, fix password not saved in db --- scripts/install | 9 ++++++++- scripts/remove | 6 +++--- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index dc77826..6d66241 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,13 @@ 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 #================================================= @@ -45,7 +52,7 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated NGINX config ynh_add_nginx_config -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index dac0d28..65417f3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,9 +16,9 @@ source /usr/share/yunohost/helpers #================================================= # 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; then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + ynh_script_progression --message="Removing "$app" service integration..." --weight=1 + yunohost service remove "$app" fi #================================================= diff --git a/scripts/restore b/scripts/restore index e5496aa..6590800 100644 --- a/scripts/restore +++ b/scripts/restore @@ -45,7 +45,7 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 940714a..93c75ca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,7 +59,7 @@ ynh_script_progression --message="Upgrading system configurations related to $ap # Create a dedicated NGINX config ynh_add_nginx_config -yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $port_stream +yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream" #================================================= # START SYSTEMD SERVICE From a1c7c6922ea641ac46a7567d393e03b24f734e47 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 2 Feb 2024 14:33:50 +0000 Subject: [PATCH 11/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a2923c..ebd6816 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ TV streaming server and recorder * Official app website: * Official user documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 07a5dd8..88e423d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -29,7 +29,7 @@ Serveur de streaming et d'enregistrement TV * Site officiel de l’app : * Documentation officielle utilisateur : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From 9b8f212ec2d6ade4ae963c3bdf4f060385b77744 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 28 Feb 2024 16:08:37 +0000 Subject: [PATCH 12/13] Auto-update README --- README.md | 4 ++-- README_fr.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 95e8a11..359032b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -44,4 +44,4 @@ or sudo yunohost app upgrade tvheadend -u https://github.com/YunoHost-Apps/tvheadend_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 3a4d447..417ca1e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ From da8491458a2b55a14dddce6d19d78c58e1542bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 28 Feb 2024 17:08:22 +0100 Subject: [PATCH 13/13] remove old tests that can't run --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 9e989e9..17e38be 100644 --- a/tests.toml +++ b/tests.toml @@ -8,4 +8,4 @@ test_format = 1.0 args.superuser = "package_checker" - test_upgrade_from.e82643952e5567db826790e1e4a353559f66f112.name = "4.3.1979~ynh9" + # test_upgrade_from.e82643952e5567db826790e1e4a353559f66f112.name = "4.3.1979~ynh9"