mirror of
https://github.com/YunoHost-Apps/minidlna_ynh.git
synced 2024-09-03 19:36:34 +02:00
trap et maj ynh 2.4
This commit is contained in:
parent
5f0f617e5f
commit
a54fe4a2e4
7 changed files with 132 additions and 19 deletions
|
@ -2,6 +2,9 @@
|
|||
"name": "MiniDLNA",
|
||||
"id": "minidlna",
|
||||
"packaging_format": 1,
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.4"
|
||||
},
|
||||
"description": {
|
||||
"en": "Light DLNA server to share media files over the LAN",
|
||||
"fr": "Serveur DLNA léger pour partager les fichiers multimédia sur le réseau local"
|
||||
|
|
30
manifest2.2.json
Normal file
30
manifest2.2.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "MiniDLNA",
|
||||
"id": "minidlna",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Light DLNA server to share media files over the LAN",
|
||||
"fr": "Serveur DLNA léger pour partager les fichiers multimédia sur le réseau local"
|
||||
},
|
||||
"url": "http://minidlna.sourceforge.net/",
|
||||
"licence": "free",
|
||||
"maintainer": {
|
||||
"name": "Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
},
|
||||
"multi_instance": "false",
|
||||
"services": [],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "version",
|
||||
"ask": {
|
||||
"en": "Select the minidlna version to install",
|
||||
"fr": "Choix de la version de minidlna à installer"
|
||||
},
|
||||
"choices": ["A. Version of the Debian repositories (recommended)", "B. Latest version available for Debian"],
|
||||
"default": "A. Version of the Debian repositories (recommended)"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
if [ $ynh_version = "2.4" ]; then
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
else
|
||||
app=minidlna
|
||||
fi
|
||||
version=$(sudo yunohost app setting $app version)
|
||||
port=$(sudo yunohost app setting $app port)
|
||||
|
||||
|
|
|
@ -1,8 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Renseigne les variables à partir des arguments.
|
||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
# Retrieve arguments
|
||||
if [ $ynh_version = "2.4" ]
|
||||
then
|
||||
version=$YNH_APP_ARG_VERSION
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Source app helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
else
|
||||
version=$1
|
||||
app=minidlna
|
||||
fi
|
||||
|
||||
|
||||
# Delete files and db if exit with an error
|
||||
EXIT_PROPERLY () {
|
||||
trap '' ERR
|
||||
echo -e "\e[91m \e[1m" # Shell in light red bold
|
||||
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!"
|
||||
|
||||
if [ $ynh_version = "2.2" ]; then
|
||||
/bin/bash ./remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
TRAP_ON () { # Activate signal capture
|
||||
trap EXIT_PROPERLY ERR # Capturing exit signals on error
|
||||
}
|
||||
TRAP_OFF () { # Ignoring signal capture until TRAP_ON
|
||||
# Pour une raison que j'ignore, la fonction TRAP_ON fonctionne très bien.
|
||||
# Mais pas la fonction TRAP_OFF...
|
||||
# Utiliser directement `trap '' ERR` dans le code pour l'utiliser, à la place de la fonction.
|
||||
trap '' ERR # Ignoring exit signals
|
||||
}
|
||||
TRAP_ON
|
||||
|
||||
|
||||
# Cherche un port libre.
|
||||
port=48200
|
||||
|
|
|
@ -1,31 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
if [ $ynh_version = "2.4" ]; then
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Source app helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
else
|
||||
app=minidlna
|
||||
version=$(sudo yunohost app setting $app version)
|
||||
fi
|
||||
port=$(sudo yunohost app setting $app port)
|
||||
|
||||
# Ferme les ports dans le firewall
|
||||
sudo yunohost firewall disallow TCP $port > /dev/null 2>&1
|
||||
sudo yunohost firewall disallow UDP 1900 > /dev/null 2>&1 # Découverte SSDP pour UPNP.
|
||||
if sudo yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
echo "Close port $port"
|
||||
sudo yunohost firewall disallow TCP $port > /dev/null
|
||||
fi
|
||||
if sudo yunohost firewall list | grep -q "\- 1900$"
|
||||
then
|
||||
echo "Close port 1900"
|
||||
sudo yunohost firewall disallow UDP 1900 > /dev/null
|
||||
fi
|
||||
|
||||
# Suppression du paquet minidlna
|
||||
if [ -e "/usr/sbin/minidlnad" ] || [ -e "/usr/bin/minidlnad" ]; then
|
||||
echo "Remove minidlna package"
|
||||
sudo apt-get -y purge minidlna
|
||||
if [ $version = "B" ]
|
||||
then
|
||||
sudo rm /etc/apt/sources.list.d/minidlna.list
|
||||
fi
|
||||
if [ -e "/etc/apt/sources.list.d/minidlna.list" ]; then
|
||||
echo "Delete apt config"
|
||||
sudo rm "/etc/apt/sources.list.d/minidlna.list"
|
||||
fi
|
||||
|
||||
# Suppression du paramètre inotify pour minidlna.
|
||||
sudo rm /etc/sysctl.d/90-inotify_minidlna.conf
|
||||
if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then
|
||||
echo "Delete kernel config"
|
||||
sudo rm "/etc/sysctl.d/90-inotify_minidlna.conf"
|
||||
# Et rechargement de la config du noyau.
|
||||
sudo sysctl --system
|
||||
fi
|
||||
|
||||
# Retire le service du monitoring de Yunohost.
|
||||
if sudo yunohost service status | grep -q minidlna # Test l'existence du service dans Yunohost
|
||||
then
|
||||
echo "Remove minidlna service"
|
||||
sudo yunohost service remove minidlna
|
||||
fi
|
||||
|
||||
# Suppression des log
|
||||
sudo rm -r /var/log/minidlna.log
|
||||
if [ -e "/var/log/minidlna.log" ]; then
|
||||
echo "Delete log"
|
||||
sudo rm "/var/log/minidlna.log"
|
||||
fi
|
||||
|
||||
# Régénère la configuration de SSOwat
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
echo -e "\e[0m" # Restore normal color
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
if [ $ynh_version = "2.4" ]; then
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
else
|
||||
app=minidlna
|
||||
fi
|
||||
version=$(sudo yunohost app setting $app version)
|
||||
port=$(sudo yunohost app setting $app port)
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
if [ $ynh_version = "2.4" ]; then
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
else
|
||||
app=minidlna
|
||||
fi
|
||||
version=$(sudo yunohost app setting $app version)
|
||||
port=$(sudo yunohost app setting $app port)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue