mirror of
https://github.com/YunoHost-Apps/tvheadend_ynh.git
synced 2024-10-01 13:34:50 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
5f7a088f2e
commit
300abd2422
8 changed files with 74 additions and 121 deletions
|
@ -18,7 +18,8 @@ userdoc = "https://tvheadend.org/projects/tvheadend/wiki"
|
|||
code = "https://github.com/tvheadend/tvheadend"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = ["amd64", "arm64", "armhf"]
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
|
|
|
@ -12,7 +12,7 @@ _install_tvheadend_package() {
|
|||
echo tvheadend tvheadend/last_notes note | debconf-set-selections
|
||||
|
||||
# Install the package
|
||||
ynh_package_install \
|
||||
_ynh_apt_install \
|
||||
"$install_dir/tvheadend.deb"
|
||||
|
||||
chown -R "hts:video" "$data_dir"
|
||||
|
@ -27,7 +27,7 @@ _install_tvheadend_package() {
|
|||
_uninstall_tvheadend_package() {
|
||||
apt-mark unhold tvheadend
|
||||
|
||||
ynh_package_autopurge tvheadend
|
||||
_ynh_apt autoremove --purge tvheadend
|
||||
|
||||
# Delete the system user created by the package
|
||||
deluser hts --remove-home
|
||||
|
|
|
@ -1,47 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
### Only relevant if there is a "data_dir" resource for this app
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
ynh_backup "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/default/tvheadend"
|
||||
ynh_backup "/etc/default/tvheadend"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -1,29 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemctl --service=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
|
@ -31,26 +23,24 @@ ynh_change_url_nginx_config
|
|||
# Update Tvheadend configuration file
|
||||
if [ "$change_path" -eq 1 ]; then
|
||||
# Update Tvheadend configuration file
|
||||
ynh_script_progression --message="Updating Tvheadend configuration..." --weight=1
|
||||
ynh_script_progression "Updating Tvheadend configuration..."
|
||||
if [ "$path" = "/" ]; then
|
||||
ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
else
|
||||
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="$app" --action="start"
|
||||
ynh_systemctl --service="$app" --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,54 +8,53 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# Passwords are not saved by default.
|
||||
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
||||
ynh_app_setting_set --key=password --value="$password"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing $app package..." --weight=1
|
||||
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
ynh_script_progression "Installing $app package..."
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | 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_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY TVHEADEND CONFIG FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Update configuration files..." --weight=1
|
||||
ynh_script_progression "Update configuration files..."
|
||||
|
||||
# Copy and modify /etc/default/tvheadend
|
||||
if [ "$path" = "/" ]; then
|
||||
ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
else
|
||||
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Adding system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="$app" --action="start"
|
||||
ynh_systemctl --service="$app" --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed, HTSP port is $port_stream" --last
|
||||
ynh_script_progression "Installation of $app completed, HTSP port is $port_stream"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -16,39 +10,39 @@ 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
|
||||
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
|
||||
ynh_script_progression "Removing "$app" service integration..."
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND DISABLE TVHEADEND SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping Tvheadend service..." --weight=2
|
||||
ynh_script_progression "Stopping Tvheadend service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action=stop
|
||||
ynh_exec_quiet systemctl disable "$app" --quiet
|
||||
ynh_exec_quiet systemctl daemon-reload
|
||||
ynh_systemctl --service="$app" --action=stop
|
||||
systemctl disable "$app" --quiet
|
||||
systemctl daemon-reload
|
||||
|
||||
#=================================================
|
||||
# UNHOLD TVHEADEND FROM APT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the $app apt package..." --weight=2
|
||||
ynh_script_progression "Removing the $app apt package..."
|
||||
|
||||
_uninstall_tvheadend_package
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
ynh_secure_remove --file="/etc/default/tvheadend"
|
||||
ynh_safe_rm "/etc/default/tvheadend"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -13,60 +7,59 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling $app package..." --weight=1
|
||||
ynh_script_progression "Reinstalling $app package..."
|
||||
|
||||
_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_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
ynh_script_progression "Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
ynh_restore "$data_dir"
|
||||
|
||||
chown -R "hts:video" "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE TVHEADEND CONFIG FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Tvheadend main directory and config files..." --weight=1
|
||||
ynh_script_progression "Restoring Tvheadend main directory and config files..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/default/tvheadend"
|
||||
ynh_restore "/etc/default/tvheadend"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Restoring system configurations related to $app..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start"
|
||||
ynh_systemctl --service="$app" --action="start"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app, HTSP port is $port_stream" --last
|
||||
ynh_script_progression "Restoration completed for $app, HTSP port is $port_stream"
|
||||
|
|
|
@ -1,83 +1,74 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=3
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop"
|
||||
ynh_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
if [[ -n "${conf_dir:-}" ]]; then
|
||||
# Now we use the standard /var/lib/tvheadend directory
|
||||
ynh_secure_remove --file="$data_dir"
|
||||
ynh_safe_rm "$data_dir"
|
||||
mv "$conf_dir" "$data_dir"
|
||||
chown -R "hts:video" "$data_dir"
|
||||
|
||||
ynh_app_setting_delete --app="$app" --key=conf_dir
|
||||
ynh_app_setting_delete --key=conf_dir
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing $app package..." --weight=1
|
||||
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
ynh_script_progression "Installing $app package..."
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | 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_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY TVHEADEND CONFIG FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Update configuration files..." --weight=1
|
||||
ynh_script_progression "Update configuration files..."
|
||||
|
||||
# Copy and modify /etc/default/tvheadend
|
||||
if [ "$path" = "/" ]; then
|
||||
ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend"
|
||||
else
|
||||
ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
ynh_config_add --template="tvheadend" --destination="/etc/default/tvheadend"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports="$port_stream"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="$app" --action="start"
|
||||
ynh_systemctl --service="$app" --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed, HTSP port is $port_stream" --last
|
||||
ynh_script_progression "Upgrade of $app completed, HTSP port is $port_stream"
|
||||
|
|
Loading…
Reference in a new issue