mirror of
https://github.com/YunoHost-Apps/kodi_ynh.git
synced 2024-09-03 19:26:34 +02:00
First work
This commit is contained in:
parent
7af4384735
commit
fbe3096cc2
7 changed files with 238 additions and 0 deletions
29
README.md
Normal file
29
README.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Kodi for YunoHost
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
**This package is currently under development, install it at your own risk.**
|
||||||
|
|
||||||
|
[Kodi](https://kodi.tv) transform your YunoHost server on media center that is designed to look great on your big screen TV but is just as home on a small screen.
|
||||||
|
|
||||||
|
**Shipped version:** 16.1 from jessie backports
|
||||||
|
|
||||||
|
[![Install Kodi with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kodi)
|
||||||
|
![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png)
|
||||||
|
|
||||||
|
## Current package status
|
||||||
|
* The scprit use jessie backports to install Kodi 16 (We have to wait for Debian Strech officialy install Kodi 17)
|
||||||
|
* A dedicated kodi user is create
|
||||||
|
* Use of systemd
|
||||||
|
* You can launch Kodi with the ```sudo systemctl start kodi``` command
|
||||||
|
|
||||||
|
## To do
|
||||||
|
* Test package on Raspberry (maybe Kodi is avaible in v17 on raspbian repo instead of v16 in debian jessie backports)
|
||||||
|
* Add option to launch Kodi at server startup
|
||||||
|
* Add the control web interface to YunoHost user interface
|
||||||
|
* Maybe we can launch Kodi from YunoHost web interface instead of SSH
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* Report a bug: Use GitHub issues
|
||||||
|
* Kodi website: https://kodi.tv
|
||||||
|
* YunoHost website: https://yunohost.org/
|
4
conf/kodi.list
Normal file
4
conf/kodi.list
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# kodi repos
|
||||||
|
# starting with debian jessie, debian provides kodi via its backports repository
|
||||||
|
# remember: those packages are not supported by team kodi
|
||||||
|
deb http://http.debian.net/debian jessie-backports main
|
21
conf/kodi.service
Normal file
21
conf/kodi.service
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[Unit]
|
||||||
|
Description = Kodi Media Center
|
||||||
|
|
||||||
|
# if you don't need the MySQL DB backend, this should be sufficient
|
||||||
|
After = systemd-user-sessions.service network.target sound.target
|
||||||
|
|
||||||
|
# if you need the MySQL DB backend, use this block instead of the previous
|
||||||
|
# After = systemd-user-sessions.service network.target sound.target mysql.service
|
||||||
|
# Wants = mysql.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User = #KODIUSER#
|
||||||
|
Group = #KODIGROUP#
|
||||||
|
Type = simple
|
||||||
|
#PAMName = login # you might want to try this one, did not work on all systems
|
||||||
|
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-standalone -- :0 -nolisten tcp vt7
|
||||||
|
Restart = on-abort
|
||||||
|
RestartSec = 5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
56
manifest.json
Normal file
56
manifest.json
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"name": "Kodi",
|
||||||
|
"id": "kodi",
|
||||||
|
"packaging_format": 1,
|
||||||
|
"description": {
|
||||||
|
"en": "Transform your YunoHost server into media center with Kodi",
|
||||||
|
"fr": "Transfromez votre serveur YunoHost en media center avec Kodi"
|
||||||
|
},
|
||||||
|
"version": "17.4",
|
||||||
|
"url": "https://kodi.tv",
|
||||||
|
"license": "free",
|
||||||
|
"maintainer": {
|
||||||
|
"name": "Sylvain Cecchetto",
|
||||||
|
"email": "cecchetto.sylvain@me.com",
|
||||||
|
"url": "blog.cecchettosylvain.fr"
|
||||||
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 2.6.4"
|
||||||
|
},
|
||||||
|
"multi_instance": false,
|
||||||
|
"services": [
|
||||||
|
"nginx"
|
||||||
|
],
|
||||||
|
"arguments": {
|
||||||
|
"install" : [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for the control web interface",
|
||||||
|
"fr": "Choisissez un nom de domaine pour l'interface de contrôle web"
|
||||||
|
},
|
||||||
|
"example": "example.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for the control web interface",
|
||||||
|
"fr": "Choisissez un chemin pour l'interface de contrôle web"
|
||||||
|
},
|
||||||
|
"example": "/kodi",
|
||||||
|
"default": "/kodi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "launch_on_boot",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Launch Kodi at YunoHost server startup",
|
||||||
|
"fr": "Démarrer Kodi au démarrage du serveur YunoHost"
|
||||||
|
},
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
1
scripts/_common.sh
Normal file
1
scripts/_common.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#!/bin/bash
|
70
scripts/install
Normal file
70
scripts/install
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
launch_on_boot=$YNH_APP_ARG_LAUNCH_ON_BOOT
|
||||||
|
|
||||||
|
app=kodi
|
||||||
|
final_path=/var/www/$app
|
||||||
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
# Normalize the url path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
# Check web path availability
|
||||||
|
ynh_webpath_available $domain $path_url
|
||||||
|
# Register (book) web path
|
||||||
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_setting_set $app domain $domain
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
ynh_app_setting_set $app launch_on_boot $launch_on_boot
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE KODI USER
|
||||||
|
#=================================================
|
||||||
|
sudo mkdir /home/$app
|
||||||
|
ynh_system_user_create "$app" "/home/$app"
|
||||||
|
sudo chown -R $app:$app /home/$app
|
||||||
|
sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input $app
|
||||||
|
sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD SYSTEMD SCRIPT (SERVICE)
|
||||||
|
#=================================================
|
||||||
|
sed -i "s@#KODIUSER#@${app}@g" ../conf/kodi.service
|
||||||
|
sed -i "s@#KODIGROUP#@${app}@g" ../conf/kodi.service
|
||||||
|
sudo cp ../conf/kodi.service /etc/systemd/system/kodi.service
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
sudo cp ../conf/kodi.list /etc/apt/sources.list.d/${app}.list
|
||||||
|
ynh_package_update
|
||||||
|
ynh_package_install xinit dbus-x11 kodi
|
||||||
|
|
57
scripts/remove
Normal file
57
scripts/remove
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
launch_on_boot=$(ynh_app_setting_get $app launch_on_boot)
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_package_autoremove kodi xinit dbus-x11
|
||||||
|
sudo rm -f "/etc/apt/sources.list.d/${app}.list"
|
||||||
|
ynh_package_update
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove "$final_path"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SYSTEMD SCRIPT (SERVICE)
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE KODI USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_system_user_delete "$app"
|
||||||
|
sudo rm -rf "/home/$app"
|
||||||
|
sudo sed -i 's/allowed_users=anybody/allowed_users=console/' /etc/X11/Xwrapper.config
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue