Skip to content

Commit

Permalink
Merge pull request #143 from vladgh:rescan
Browse files Browse the repository at this point in the history
Add force scan and rebuild options
  • Loading branch information
vladgh authored Oct 1, 2021
2 parents eaa7ef0 + d70ad4d commit d3ba2bc
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions minidlna/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
set -euo pipefail
IFS=$'\n\t'

# DEBUG
[ -z "${DEBUG:-}" ] || set -x

# VARs
TZ="${TZ:-}"
PUID="${PUID:-100}"
PGID="${PGID:-101}"
PIDFILE="/minidlna/minidlna.pid"
export TZ="${TZ:-}"
export PUID="${PUID:-100}"
export PGID="${PGID:-101}"
export PIDFILE='/minidlna/minidlna.pid'
export FORCE_SCAN="${FORCE_SCAN:-false}"
export FORCE_REBUILD="${FORCE_REBUILD:-false}"

# Remove old pid if it exists
[ -f $PIDFILE ] && rm -f $PIDFILE
[ -f "$PIDFILE" ] && rm -f "$PIDFILE"

echo '=== Set user and group identifier'
groupmod --non-unique --gid "$PGID" minidlna
Expand Down Expand Up @@ -45,5 +50,13 @@ echo '=== Set permissions'
mkdir -p /minidlna/cache
chown -R "${PUID}:${PGID}" /minidlna

echo '=== Generate scan/rebuild flags'
if [[ "$FORCE_SCAN" == true ]]; then
set -- -r "$@"
fi
if [[ "$FORCE_REBUILD" == true ]]; then
set -- -R "$@"
fi

echo '=== Start daemon'
exec su-exec minidlna /usr/sbin/minidlnad -P "$PIDFILE" -S "$@"

0 comments on commit d3ba2bc

Please sign in to comment.