Aller au contenu

libreELEC

Contrairement à OSMC, libreELEC est une distrib minimaliste. Pas de apt-get dispo par défaut.
Impossible d'installer autofs facilement pour monter des partages NFS. Mais il y aune solution prévue.

Montages NFS

Les montages NFS ne peuvent se faire que dans le dossier /storage. ça passe par la création de services.

Pour créer le partage /storage/nas/, il faut créer le fichier /storage/.config/system.d/storage-nas.mount (le nom du fichier doit matcher le path de montage) en se basant sur le modèle dispo dans /storage/.config/system.d/nfs.mount.sample. Il faut ensuite configurer le fichier :

storage-nas.mount
# This is a sample service script to mount NFS shares.
# Please read carefully the comments in this file. For production usage
# you can remove all comments (lines beginning with "#") from this file.

[Unit]
# The description should be used to explain what this servicefile is for
Description=test nfs mount script

# if we do network mounts like here we *require* 'network-online.service'
# which checks if the network is online
Requires=network-online.service

# our scripts must start *after* 'network-online.service', on timeout and if
# 'network-online.service' fails we can not mount and this scripts fails too
After=network-online.service

# usually we mount networks shares because we want they avaible *before* XBMC starts.
# so XBMC has access to this mounts from beginning. Note: this slows down the boot!
Before=kodi.service

[Mount]
# The share we want mount
What=192.168.1.101:nas

# Where we want mount this share
Where=/storage/nas

# Any options you usually use with the "-o" parameter in the mount command
Options=rw,nolock

# filesystem type (for NFSv4 use Type=nfs4)
Type=nfs

[Install]
# The target is used by 'systemctl enable <name_of_this_file.mount>' to link
# this service to a runlevel for starting on boot. usually 'multi-user.target'
# is ok here.
WantedBy=multi-user.target

# Important:
# this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path
# where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount
# as extension.
# This means, if we want mount to "/storage/movies2" (see above "Where=/storage/movies2")
# then this file must be renamed to 'storage-movies2.mount' and can be enabled via ssh with the
# command 'systemctl enable storage-movies2.mount'

Ensuite, il faut enable le service : systemctl enable storage-nas.mount

Et enfin reboot pour que ce soit pris en compte.

Crontab (update librairies)

Pour effectuer un update automatique des librairies, la solution la plus solide est de faire des appels API via des scripts dans une crontab :

0 4 * * * /storage/scripts/update_video_library.sh
0 5 * * * /storage/scripts/clean_video_library.sh
0 6 * * * /storage/scripts/update_audio_library.sh
0 7 * * * /storage/scripts/clean_audio_library.sh

#/storage/scripts/clean_audio_library.sh
#!/bin/bash
kodi-send --action="CleanLibrary(music)"

#/storage/scripts/clean_video_library.sh
#!/bin/bash
kodi-send --action="CleanLibrary(video)"

#/storage/scripts/update_audio_library.sh
#!/bin/bash
kodi-send --action="UpdateLibrary(music)"

#/storage/scripts/update_audio_library.sh
#!/bin/bash
kodi-send --action="UpdateLibrary(video)"

Cependant, le système libreELEC étant en lecture seule, les crontabs ne sont pas forcément sauvegardées. Il faut donc d'abord faire cette manipulation :

Avant crontab -e :

mount -o remount,rw /flash
mount -o remount,rw /

Après crontab -e :

mount -o remount,ro /flash
mount -o remount,ro /

Sources