1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kodi_ynh.git synced 2024-09-03 19:26:34 +02:00

Automated packaging v2 conversion

This commit is contained in:
Salamandar 2024-06-06 12:01:33 +02:00
parent 5658d3185a
commit 9e3733098e
9 changed files with 194 additions and 130 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/xbmc/chorus2/releases/download/2.4.4/webinterface.default.2.4.4.zip
SOURCE_SUM=efa76c18a155f263183df9eaa345e859f017000da064c35ec9809ff5c09e31c4
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb
SOURCE_SUM=9faa6f6cba80aeb69c9bac139b74a3d61596d4486e2458c2c65efe9e21ff3c7d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=deb-multimedia-keyring.deb
SOURCE_EXTRACT=false

78
manifest.toml Normal file
View file

@ -0,0 +1,78 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "kodi"
name = "Kodi"
description.en = "Media center that brings all your digital media together"
description.fr = "Centre multimédia qui rassemble tous vos médias numériques"
version = "19.1~ynh1"
maintainers = ["Sylvain Cecchetto"]
[upstream]
license = "GPL-2.0"
website = "https://kodi.tv"
admindoc = "https://kodi.wiki/view/Main_Page"
code = "https://github.com/xbmc"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
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]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/kodi"
[install.launch_on_boot]
ask.en = "Launch Kodi at YunoHost server startup"
ask.fr = "Démarrer Kodi au démarrage du serveur YunoHost"
type = "boolean"
default = true
[install.open_webserver_port]
ask.en = "Open port 8080 in order to use a smartphone Kodi remote app on your local network"
ask.fr = "Ouvrir le port 8080 afin de pouvoir utiliser une application smartphone de télécommande Kodi sur le réseau local"
type = "boolean"
default = false
[resources]
[resources.sources]
[resources.sources.arm-chorus2]
url = "https://github.com/xbmc/chorus2/releases/download/2.4.4/webinterface.default.2.4.4.zip"
sha256 = "efa76c18a155f263183df9eaa345e859f017000da064c35ec9809ff5c09e31c4"
[resources.sources.deb-multimedia-keyring]
url = "http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb"
sha256 = "9faa6f6cba80aeb69c9bac139b74a3d61596d4486e2458c2c65efe9e21ff3c7d"
format = "deb"
rename = "deb-multimedia-keyring.deb"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8095
[resources.apt]
packages = "xorg, xinit, dbus-x11, kodi, xserver-xorg-legacy, xorg, dbus-x11, kodi, xserver-xorg-video-dummy"

View file

@ -5,11 +5,11 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="xorg xinit dbus-x11 kodi" #REMOVEME? pkg_dependencies="xorg xinit dbus-x11 kodi"
arm_pkg_dependencies="xserver-xorg-legacy xorg dbus-x11 kodi" #REMOVEME? arm_pkg_dependencies="xserver-xorg-legacy xorg dbus-x11 kodi"
package_check_dependencies="xserver-xorg-video-dummy" #REMOVEME? package_check_dependencies="xserver-xorg-video-dummy"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -39,7 +39,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -13,56 +13,56 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN #REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH #REMOVEME? path=$YNH_APP_ARG_PATH
is_public=1 is_public=1
launch_on_boot=$YNH_APP_ARG_LAUNCH_ON_BOOT #REMOVEME? launch_on_boot=$YNH_APP_ARG_LAUNCH_ON_BOOT
open_webserver_port=$YNH_APP_ARG_OPEN_WEBSERVER_PORT #REMOVEME? open_webserver_port=$YNH_APP_ARG_OPEN_WEBSERVER_PORT
app=$YNH_APP_INSTANCE_NAME #REMOVEME? 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..." #REMOVEME? ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app #REMOVEME? install_dir=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." #REMOVEME? ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain #REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url #REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path #REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
ynh_app_setting_set --app=$app --key=launch_on_boot --value=$launch_on_boot ynh_app_setting_set --app=$app --key=launch_on_boot --value=$launch_on_boot
ynh_app_setting_set --app=$app --key=open_webserver_port --value=$open_webserver_port #REMOVEME? ynh_app_setting_set --app=$app --key=open_webserver_port --value=$open_webserver_port
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." #REMOVEME? ynh_script_progression --message="Finding an available port..."
# Find an available port # Find an available port
port=$(ynh_find_port --port=8095) #REMOVEME? port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port #REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
# Optional: Expose this port publicly # Optional: Expose this port publicly
# (N.B.: you only need to do this if the app actually needs to expose the port publicly. # (N.B.: you only need to do this if the app actually needs to expose the port publicly.
@ -78,20 +78,20 @@ fi
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." #REMOVEME? ynh_script_progression --message="Installing dependencies..."
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
dpkg -i "$tmpdir/deb-multimedia-keyring.deb" dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
pkg_dependencies="$pkg_dependencies $package_check_dependencies" #REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies"
fi fi
if [[ $YNH_ARCH != arm* ]]; then if [[ $YNH_ARCH != arm* ]]; then
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
else else
ynh_install_app_dependencies $arm_pkg_dependencies #REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies
fi fi
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
@ -101,10 +101,10 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." #REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -128,12 +128,12 @@ ynh_replace_string --match_string="allowed_users=console" --replace_string="allo
#================================================= #=================================================
ynh_script_progression --message="Configuring Kodi..." ynh_script_progression --message="Configuring Kodi..."
mkdir -p "$final_path/.kodi/userdata/" mkdir -p "$install_dir/.kodi/userdata/"
ynh_add_config --template="../conf/advancedsettings.xml" --destination="$final_path/.kodi/userdata/advancedsettings.xml" ynh_add_config --template="../conf/advancedsettings.xml" --destination="$install_dir/.kodi/userdata/advancedsettings.xml"
mkdir -p "$final_path/.kodi/addons/" mkdir -p "$install_dir/.kodi/addons/"
if [[ $YNH_ARCH != arm* ]]; then if [[ $YNH_ARCH != arm* ]]; then
ynh_setup_source --dest_dir="$final_path/.kodi/addons/" --source_id="arm-chorus2" ynh_setup_source --dest_dir="$install_dir/.kodi/addons/" --source_id="arm-chorus2"
fi fi
#================================================= #=================================================
@ -157,9 +157,9 @@ fi
ynh_script_progression --message="Securing files and directories..." ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files # Set permissions to app files
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
@ -167,7 +167,7 @@ usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="media center" --log="$final_path/.kodi/temp/kodi.log" --needs_exposed_ports=$port yunohost service add $app --description="media center" --log="$install_dir/.kodi/temp/kodi.log" --needs_exposed_ports=$port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -180,27 +180,27 @@ ynh_systemd_action --service_name=$app --action="start"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." #REMOVEME? ynh_script_progression --message="Configuring permissions..."
ynh_app_setting_set "$app" protected_uris "/" ynh_app_setting_set "$app" protected_uris "/"
domainregex=$(echo "$domain" | sed 's/-/\%&/g') domainregex=$(echo "$domain" | sed 's/-/\%&/g')
ynh_app_setting_set "$app" skipped_regex "$domainregex/jsonrpc.*$,$domainregex/image.*$" #REMOVEME? ynh_app_setting_set "$app" skipped_regex "$domainregex/jsonrpc.*$,$domainregex/image.*$"
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] #REMOVEME? if [ $is_public -eq 1 ]
then then
# Everyone can access the app. # Everyone can access the app.
# The "main" permission is automatically created before the install script. # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" #REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) #REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) #REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot)
open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) #REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -47,18 +47,18 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." #REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." #REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
@ -93,10 +93,10 @@ ynh_replace_string "allowed_users=anybody" "allowed_users=console" /etc/X11/Xwra
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app #REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -14,30 +14,30 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) #REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot)
open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) #REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port)
port=$(ynh_app_setting_get --app=$app --key=port) #REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
# ynh_script_progression --message="Finding an available port..." #REMOVEME? # ynh_script_progression --message="Finding an available port..."
# Open the port # Open the port
ynh_script_progression --message="Configuring firewall..." ynh_script_progression --message="Configuring firewall..."
@ -49,10 +49,10 @@ fi
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." #REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \ #REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $install_dir "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -66,37 +66,37 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
dpkg -i "$tmpdir/deb-multimedia-keyring.deb" dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
pkg_dependencies="$pkg_dependencies $package_check_dependencies" #REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies"
fi fi
if [[ $YNH_ARCH != arm* ]]; then if [[ $YNH_ARCH != arm* ]]; then
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
else else
ynh_install_app_dependencies $arm_pkg_dependencies #REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies
fi fi
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
@ -134,9 +134,9 @@ ynh_replace_string "allowed_users=console" "allowed_users=anybody" /etc/X11/Xwra
ynh_script_progression --message="Restoring user rights..." ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files # Restore permissions on app files
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
@ -144,7 +144,7 @@ usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="media center" --log="$final_path/.kodi/temp/kodi.log" --needs_exposed_ports=$port yunohost service add $app --description="media center" --log="$install_dir/.kodi/temp/kodi.log" --needs_exposed_ports=$port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) #REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot)
open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) #REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port)
port=$(ynh_app_setting_get --app=$app --key=port) #REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -33,16 +33,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." #REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -59,8 +59,8 @@ ynh_systemd_action --service_name=$app --action="stop"
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then #REMOVEME? if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all #REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
@ -76,20 +76,20 @@ fi
# Fix launch_on_boot as a boolean value # Fix launch_on_boot as a boolean value
if [ "$open_webserver_port" = "Yes" ]; then if [ "$open_webserver_port" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=open_webserver_port --value=1 #REMOVEME? ynh_app_setting_set --app=$app --key=open_webserver_port --value=1
open_webserver_port=1 open_webserver_port=1
elif [ "$open_webserver_port" = "No" ]; then elif [ "$open_webserver_port" = "No" ]; then
ynh_app_setting_set --app=$app --key=open_webserver_port --value=0 #REMOVEME? ynh_app_setting_set --app=$app --key=open_webserver_port --value=0
open_webserver_port=0 open_webserver_port=0
fi fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." #REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -102,20 +102,20 @@ ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." #REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
dpkg -i "$tmpdir/deb-multimedia-keyring.deb" dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
pkg_dependencies="$pkg_dependencies $package_check_dependencies" #REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies"
fi fi
if [[ $YNH_ARCH != arm* ]]; then if [[ $YNH_ARCH != arm* ]]; then
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
else else
ynh_install_app_dependencies $arm_pkg_dependencies #REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies
fi fi
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
@ -138,9 +138,9 @@ ynh_add_systemd_config
ynh_script_progression --message="Securing files and directories..." ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files # Set permissions on app files
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
@ -148,7 +148,7 @@ usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="media center" --log="$final_path/.kodi/temp/kodi.log" --needs_exposed_ports=$port yunohost service add $app --description="media center" --log="$install_dir/.kodi/temp/kodi.log" --needs_exposed_ports=$port
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -160,9 +160,9 @@ ynh_systemd_action --service_name=$app --action="start"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT