From 9e3733098e8d11aae12cf3f4fd3efe5252f05556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 6 Jun 2024 12:01:33 +0200 Subject: [PATCH] Automated packaging v2 conversion --- conf/arm-chorus2.src | 7 --- conf/deb-multimedia-keyring.src | 7 --- manifest.toml | 78 +++++++++++++++++++++++++++++++++ scripts/_common.sh | 6 +-- scripts/backup | 14 +++--- scripts/install | 78 ++++++++++++++++----------------- scripts/remove | 26 +++++------ scripts/restore | 50 ++++++++++----------- scripts/upgrade | 58 ++++++++++++------------ 9 files changed, 194 insertions(+), 130 deletions(-) delete mode 100644 conf/arm-chorus2.src delete mode 100644 conf/deb-multimedia-keyring.src create mode 100644 manifest.toml diff --git a/conf/arm-chorus2.src b/conf/arm-chorus2.src deleted file mode 100644 index 857940e..0000000 --- a/conf/arm-chorus2.src +++ /dev/null @@ -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 \ No newline at end of file diff --git a/conf/deb-multimedia-keyring.src b/conf/deb-multimedia-keyring.src deleted file mode 100644 index ea339ed..0000000 --- a/conf/deb-multimedia-keyring.src +++ /dev/null @@ -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 diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..48d8bec --- /dev/null +++ b/manifest.toml @@ -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" diff --git a/scripts/_common.sh b/scripts/_common.sh index e5be016..f774f6b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,11 +5,11 @@ #================================================= # 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 diff --git a/scripts/backup b/scripts/backup index 237d36b..010be97 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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) -domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # 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 #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 445936d..347f882 100644 --- a/scripts/install +++ b/scripts/install @@ -13,56 +13,56 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # 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 #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH is_public=1 -launch_on_boot=$YNH_APP_ARG_LAUNCH_ON_BOOT -open_webserver_port=$YNH_APP_ARG_OPEN_WEBSERVER_PORT +#REMOVEME? launch_on_boot=$YNH_APP_ARG_LAUNCH_ON_BOOT +#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 #================================================= -ynh_script_progression --message="Validating installation parameters..." +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # 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 #================================================= -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 -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$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=open_webserver_port --value=$open_webserver_port +#REMOVEME? ynh_app_setting_set --app=$app --key=open_webserver_port --value=$open_webserver_port #================================================= # STANDARD MODIFICATIONS #================================================= # 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 -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # Optional: Expose this 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 #================================================= -ynh_script_progression --message="Installing dependencies..." +#REMOVEME? ynh_script_progression --message="Installing dependencies..." tmpdir=$(mktemp -d) ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" dpkg -i "$tmpdir/deb-multimedia-keyring.deb" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then - pkg_dependencies="$pkg_dependencies $package_check_dependencies" +#REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies" fi if [[ $YNH_ARCH != arm* ]]; then - ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies else - ynh_install_app_dependencies $arm_pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies fi if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then @@ -101,10 +101,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." +#REMOVEME? ynh_script_progression --message="Configuring 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 @@ -128,12 +128,12 @@ ynh_replace_string --match_string="allowed_users=console" --replace_string="allo #================================================= ynh_script_progression --message="Configuring Kodi..." -mkdir -p "$final_path/.kodi/userdata/" -ynh_add_config --template="../conf/advancedsettings.xml" --destination="$final_path/.kodi/userdata/advancedsettings.xml" +mkdir -p "$install_dir/.kodi/userdata/" +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 - 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 #================================================= @@ -157,9 +157,9 @@ fi ynh_script_progression --message="Securing files and directories..." # Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" 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..." -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 @@ -180,27 +180,27 @@ ynh_systemd_action --service_name=$app --action="start" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." ynh_app_setting_set "$app" protected_uris "/" 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 -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then # Everyone can access the app. # 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 #================================================= # 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 diff --git a/scripts/remove b/scripts/remove index b44b55c..a16cd3b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # 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) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -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? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) +#REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) #================================================= # STANDARD REMOVE @@ -47,18 +47,18 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +#REMOVEME? ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # 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 -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -93,10 +93,10 @@ ynh_replace_string "allowed_users=anybody" "allowed_users=console" /etc/X11/Xwra #================================================= # 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 -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index b194217..e5bbcc8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,30 +14,30 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -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) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) +#REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=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 ynh_script_progression --message="Configuring firewall..." @@ -49,10 +49,10 @@ fi #================================================= # 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 \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -66,37 +66,37 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # 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) -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 #================================================= 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 #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." tmpdir=$(mktemp -d) ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" dpkg -i "$tmpdir/deb-multimedia-keyring.deb" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then - pkg_dependencies="$pkg_dependencies $package_check_dependencies" +#REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies" fi if [[ $YNH_ARCH != arm* ]]; then - ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies else - ynh_install_app_dependencies $arm_pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies fi 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..." # Restore permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" 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..." -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 diff --git a/scripts/upgrade b/scripts/upgrade index fe3b8ac..4e1f908 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers #================================================= # 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -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) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? launch_on_boot=$(ynh_app_setting_get --app=$app --key=launch_on_boot) +#REMOVEME? open_webserver_port=$(ynh_app_setting_get --app=$app --key=open_webserver_port) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION @@ -33,16 +33,16 @@ 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)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -59,8 +59,8 @@ ynh_systemd_action --service_name=$app --action="stop" ynh_script_progression --message="Ensuring downward compatibility..." # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -76,20 +76,20 @@ fi # Fix launch_on_boot as a boolean value 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 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 fi #================================================= # 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) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # NGINX CONFIGURATION @@ -102,20 +102,20 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." tmpdir=$(mktemp -d) ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring" dpkg -i "$tmpdir/deb-multimedia-keyring.deb" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then - pkg_dependencies="$pkg_dependencies $package_check_dependencies" +#REMOVEME? pkg_dependencies="$pkg_dependencies $package_check_dependencies" fi if [[ $YNH_ARCH != arm* ]]; then - ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies else - ynh_install_app_dependencies $arm_pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $arm_pkg_dependencies fi if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then @@ -138,9 +138,9 @@ ynh_add_systemd_config ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" 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..." -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 @@ -160,9 +160,9 @@ ynh_systemd_action --service_name=$app --action="start" #================================================= # 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