-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlordpedal.sh
More file actions
executable file
·32 lines (32 loc) · 869 Bytes
/
lordpedal.sh
File metadata and controls
executable file
·32 lines (32 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
#
# Another fine release by Lordpedal
#
# Variables bash
set -euo pipefail
IFS=$'\n\t'
pidfile="/minidlna/minidlna.pid"
#
# Borrar viejos pid si existen
[ -f $pidfile ] && rm -f $pidfile
#
# Habilitar cambios configuracion
: > /etc/minidlna.conf
for VAR in $(env); do
if [[ "$VAR" =~ ^MINIDLNA_ ]]; then
if [[ "$VAR" =~ ^MINIDLNA_MEDIA_DIR ]]; then
minidlna_name='media_dir'
else
minidlna_name=$(echo "$VAR" | sed -r "s/MINIDLNA_(.*)=.*/\\1/g" | tr '[:upper:]' '[:lower:]')
fi
minidlna_value=$(echo "$VAR" | sed -r "s/.*=(.*)/\\1/g")
echo "${minidlna_name}=${minidlna_value}" >> /etc/minidlna.conf
fi
done
#
# Directorios con permisos de escritura
echo "db_dir=/minidlna/cache" >> /etc/minidlna.conf
echo "log_dir=/minidlna/" >>/etc/minidlna.conf
#
# Iniciar servicio
exec /usr/sbin/minidlnad -P $pidfile -S "$@"