mirror of
https://github.com/YunoHost-Apps/kodi_ynh.git
synced 2024-09-03 19:26:34 +02:00
Apply example_ynh
This commit is contained in:
parent
1decb41596
commit
7f2d952f25
15 changed files with 142 additions and 105 deletions
|
@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
|
|||
1. *Read this whole template first.*
|
||||
2. *Determine if you are on the right place:*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to Kodi itself. Refer to its documentation or repository for help.*
|
||||
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||
- *When in doubt, post here and we will figure it out together.*
|
||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||
---
|
||||
|
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
|
|||
|
||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||
```sh
|
||||
sudo yunohost app install kodi
|
||||
sudo yunohost app install the_app
|
||||
```
|
||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||
- *If the error occurs in your browser, explain what you did:*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
## Problem
|
||||
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
|
||||
- [ ] Code finished and ready to be reviewed/tested
|
||||
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||
|
||||
## Automatic tests
|
||||
|
||||
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
|
@ -1,12 +1,7 @@
|
|||
# See here for more information
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
launch_on_boot=1
|
||||
open_webserver_port=1
|
||||
; Checks
|
||||
|
@ -19,7 +14,11 @@
|
|||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=all
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.gif
Normal file
BIN
doc/screenshots/screenshot1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 MiB |
|
@ -8,6 +8,12 @@
|
|||
},
|
||||
"version": "17.3~ynh1",
|
||||
"url": "https://kodi.tv",
|
||||
"upstream": {
|
||||
"license": "GPL-2.0",
|
||||
"website": "https://kodi.tv",
|
||||
"admindoc": "https://kodi.wiki/view/Main_Page",
|
||||
"code": "https://github.com/xbmc"
|
||||
},
|
||||
"license": "GPL-2.0",
|
||||
"maintainer": {
|
||||
"name": "Sylvain Cecchetto",
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Package_check results
|
||||
---
|
||||
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
|
|
@ -7,6 +7,7 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_detect_arch__2
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -28,7 +29,7 @@ path_url=$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
|
||||
arch=$(uname -m)
|
||||
arch=$(ynh_detect_arch)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -73,7 +74,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
# ynh_script_progression --message="Configuring firewall..."
|
||||
if [ "$open_webserver_port" -eq 1 ]
|
||||
then
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -83,7 +84,7 @@ ynh_script_progression --message="Installing dependencies..."
|
|||
|
||||
tmpdir=$(mktemp -d)
|
||||
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
|
||||
sudo dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
|
||||
if [[ $arch != arm* ]]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb https://www.deb-multimedia.org/ buster main non-free" --package="$pkg_dependencies"
|
||||
|
@ -91,14 +92,6 @@ else
|
|||
ynh_install_extra_app_dependencies --repo="deb https://www.deb-multimedia.org/ buster main non-free" --package="$arm_pkg_dependencies"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -107,6 +100,14 @@ ynh_script_progression --message="Configuring system user..."
|
|||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -158,7 +159,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 --log "$final_path/.kodi/temp/kodi.log"
|
||||
yunohost service add $app --log "$final_path/.kodi/temp/kodi.log" --needs_exposed_ports $port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -21,7 +21,6 @@ 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)
|
||||
arch=$(uname -m)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source ../settings/scripts/ynh_detect_arch__2
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -23,7 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -33,7 +34,7 @@ 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)
|
||||
arch=$(uname -m)
|
||||
arch=$(ynh_detect_arch)
|
||||
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
|
@ -66,13 +67,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -81,6 +75,13 @@ 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
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
@ -100,7 +101,7 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
|||
|
||||
tmpdir=$(mktemp -d)
|
||||
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
|
||||
sudo dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
|
||||
if [[ $arch != arm* ]]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb https://www.deb-multimedia.org/ buster main non-free" --package="$pkg_dependencies"
|
||||
|
@ -116,19 +117,12 @@ ynh_script_progression --message="Restoring the systemd configuration..."
|
|||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --log "$final_path/.kodi/temp/kodi.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE LAUNCH ON BOOT
|
||||
#=================================================
|
||||
if [ "$launch_on_boot" -eq 0 ]
|
||||
then
|
||||
systemctl disable "$app"
|
||||
systemctl disable "$app".service --quiet
|
||||
else
|
||||
systemctl enable "$app".service --quiet
|
||||
fi
|
||||
|
@ -140,6 +134,13 @@ ynh_script_progression --message="Configuring X11..."
|
|||
|
||||
ynh_replace_string "allowed_users=console" "allowed_users=anybody" /etc/X11/Xwrapper.config
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --log "$final_path/.kodi/temp/kodi.log" --needs_exposed_ports $port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_detect_arch__2
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -20,7 +22,8 @@ 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)
|
||||
arch=$(uname -m)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
arch=$(ynh_detect_arch)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -29,36 +32,6 @@ ynh_script_progression --message="Checking version..."
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Fix launch_on_boot as a boolean value
|
||||
if [ "$launch_on_boot" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=launch_on_boot --value=1
|
||||
launch_on_boot=1
|
||||
elif [ "$launch_on_boot" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=launch_on_boot --value=0
|
||||
launch_on_boot=0
|
||||
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
|
||||
open_webserver_port=1
|
||||
elif [ "$open_webserver_port" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=open_webserver_port --value=0
|
||||
open_webserver_port=0
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -82,6 +55,44 @@ ynh_script_progression --message="Stopping a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Fix launch_on_boot as a boolean value
|
||||
if [ "$launch_on_boot" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=launch_on_boot --value=1
|
||||
launch_on_boot=1
|
||||
elif [ "$launch_on_boot" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=launch_on_boot --value=0
|
||||
launch_on_boot=0
|
||||
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
|
||||
open_webserver_port=1
|
||||
elif [ "$open_webserver_port" = "No" ]; then
|
||||
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..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -97,7 +108,7 @@ ynh_script_progression --message="Upgrading dependencies..."
|
|||
|
||||
tmpdir=$(mktemp -d)
|
||||
ynh_setup_source --dest_dir="$tmpdir" --source_id="deb-multimedia-keyring"
|
||||
sudo dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
dpkg -i "$tmpdir/deb-multimedia-keyring.deb"
|
||||
|
||||
if [[ $arch != arm* ]]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb https://www.deb-multimedia.org/ buster main non-free" --package="$pkg_dependencies"
|
||||
|
@ -105,14 +116,6 @@ else
|
|||
ynh_install_extra_app_dependencies --repo="deb https://www.deb-multimedia.org/ buster main non-free" --package="$arm_pkg_dependencies"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
@ -121,7 +124,6 @@ ynh_script_progression --message="Upgrading systemd configuration..."
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -138,7 +140,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 --log "$final_path/.kodi/temp/kodi.log"
|
||||
yunohost service add $app --log "$final_path/.kodi/temp/kodi.log" --needs_exposed_ports $port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
25
scripts/ynh_detect_arch__2
Normal file
25
scripts/ynh_detect_arch__2
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check the architecture
|
||||
#
|
||||
# example: architecture=$(ynh_detect_arch)
|
||||
#
|
||||
# usage: ynh_detect_arch
|
||||
#
|
||||
# Requires YunoHost version 2.2.4 or higher.
|
||||
|
||||
ynh_detect_arch(){
|
||||
local architecture
|
||||
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
|
||||
architecture="arm64"
|
||||
elif [ -n "$(uname -m | grep 64)" ]; then
|
||||
architecture="x86-64"
|
||||
elif [ -n "$(uname -m | grep 86)" ]; then
|
||||
architecture="i386"
|
||||
elif [ -n "$(uname -m | grep arm)" ]; then
|
||||
architecture="arm"
|
||||
else
|
||||
architecture="unknown"
|
||||
fi
|
||||
echo $architecture
|
||||
}
|
Loading…
Add table
Reference in a new issue