diff options
-rw-r--r-- | multimedia/minidlna/README.SLACKWARE | 22 | ||||
-rw-r--r-- | multimedia/minidlna/doinst.sh | 13 | ||||
-rw-r--r-- | multimedia/minidlna/minidlna.SlackBuild | 19 | ||||
-rw-r--r-- | multimedia/minidlna/minidlna.info | 6 | ||||
-rw-r--r-- | multimedia/minidlna/minidlna.logrotate | 6 | ||||
-rw-r--r-- | multimedia/minidlna/rc.minidlna | 132 |
6 files changed, 187 insertions, 11 deletions
diff --git a/multimedia/minidlna/README.SLACKWARE b/multimedia/minidlna/README.SLACKWARE new file mode 100644 index 000000000000..c2b1f929f459 --- /dev/null +++ b/multimedia/minidlna/README.SLACKWARE @@ -0,0 +1,22 @@ +An init script has been included for the daemon; to run at boot time, +add the following to /etc/rc.d/rc.local: + + if [ -x /etc/rc.d/rc.minidlna ]; then + /etc/rc.d/rc.minidlna start + fi + +You might also want to have the daemon shut down gracefully +on system halt or reboot; if so, add the following to +/etc/rc.d/rc.local_shutdown: + + if [ -x /etc/rc.d/rc.minidlna ]; then + /etc/rc.d/rc.minidlna stop + fi + +Remember to give executable permission to /etc/rc.d/rc.local_shutdown: + + chmod 0755 /etc/rc.d/rc.local_shutdown + +To check the daemon is running properly: + + /etc/rc.d/rc.minidlna status diff --git a/multimedia/minidlna/doinst.sh b/multimedia/minidlna/doinst.sh index 7626d3a507e4..15f3e3fff1b7 100644 --- a/multimedia/minidlna/doinst.sh +++ b/multimedia/minidlna/doinst.sh @@ -11,4 +11,17 @@ config() { # Otherwise, we leave the .new copy for the admin to consider... } +preserve_perms() { + NEW="$1" + OLD="$(dirname ${NEW})/$(basename ${NEW} .new)" + if [ -e ${OLD} ]; then + cp -a ${OLD} ${NEW}.incoming + cat ${NEW} > ${NEW}.incoming + mv ${NEW}.incoming ${NEW} + fi + mv ${NEW} ${OLD} +} + +preserve_perms etc/rc.d/rc.minidlna.new config etc/minidlna.conf.new +config etc/logrotate.d/minidlna.new diff --git a/multimedia/minidlna/minidlna.SlackBuild b/multimedia/minidlna/minidlna.SlackBuild index 29df867d255a..64ffce800be0 100644 --- a/multimedia/minidlna/minidlna.SlackBuild +++ b/multimedia/minidlna/minidlna.SlackBuild @@ -3,7 +3,7 @@ # Slackware build script for minidlna # Copyright 2011-2012 Niels Horn, Rio de Janeiro, RJ, Brazil -# Copyright 2015 Mario Preksavec, Zagreb, Croatia +# Copyright 2015, 2023 Mario Preksavec, Zagreb, Croatia # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=minidlna -VERSION=${VERSION:-1.3.0} +VERSION=${VERSION:-1.3.2} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -99,14 +99,17 @@ make install DESTDIR=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# Include the config file -mkdir -p $PKG/etc -cat $PRGNAM.conf > $PKG/etc/$PRGNAM.conf.new +# Include startup script and configs thanks to Andrew Isakov +install -D -m755 $CWD/rc.$PRGNAM -T $PKG/etc/rc.d/rc.$PRGNAM.new +install -D -m644 $CWD/${PRGNAM}.logrotate -T $PKG/etc/logrotate.d/${PRGNAM}.new +install -D -m644 $PRGNAM.conf -T $PKG/etc/$PRGNAM.conf.new + +# Create log and db cache directories +mkdir -p $PKG/var/{log,cache}/$PRGNAM # Include the manual pages -mkdir -p $PKG/usr/man/man{5,8} -cat minidlna.conf.5 > $PKG/usr/man/man5/minidlna.conf.5 -cat minidlnad.8 > $PKG/usr/man/man8/minidlnad.8 +install -D -m644 minidlna.conf.5 -t $PKG/usr/man/man5 +install -D -m644 minidlnad.8 -t $PKG/usr/man/man8 gzip -9 $PKG/usr/man/man?/*.? mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION diff --git a/multimedia/minidlna/minidlna.info b/multimedia/minidlna/minidlna.info index 65b0e9f7b792..1a2714325e9b 100644 --- a/multimedia/minidlna/minidlna.info +++ b/multimedia/minidlna/minidlna.info @@ -1,8 +1,8 @@ PRGNAM="minidlna" -VERSION="1.3.0" +VERSION="1.3.2" HOMEPAGE="http://minidlna.sourceforge.net/" -DOWNLOAD="http://downloads.sourceforge.net/minidlna/minidlna-1.3.0.tar.gz" -MD5SUM="89e92d1938ee3066631d4ca9fbf31507" +DOWNLOAD="http://downloads.sourceforge.net/minidlna/minidlna-1.3.2.tar.gz" +MD5SUM="9e4cc50a48b1b467a234b579b45457d0" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/multimedia/minidlna/minidlna.logrotate b/multimedia/minidlna/minidlna.logrotate new file mode 100644 index 000000000000..17bf172f49d3 --- /dev/null +++ b/multimedia/minidlna/minidlna.logrotate @@ -0,0 +1,6 @@ +/var/log/minidlna/minidlna.log { + sharedscripts + postrotate + /usr/bin/pkill -HUP -F /var/run/minidlna.pid 2>/dev/null || true + endscript +} diff --git a/multimedia/minidlna/rc.minidlna b/multimedia/minidlna/rc.minidlna new file mode 100644 index 000000000000..2651f3b63698 --- /dev/null +++ b/multimedia/minidlna/rc.minidlna @@ -0,0 +1,132 @@ +#!/bin/sh +# +# /etc/rc.d/rc.minidlna +# +# start/stop/restart/status of the MiniDLNA server. +# +# To make MiniDLNA start automatically at boot, make this +# file executable: chmod 755 /etc/rc.d/rc.minidlna +# +# Written by Georgi D. Sotirov <gsotirov@gmail.com> +# Based on examples from Internet + +# Bash colors +C_GREEN=$'\e[32;01m' +C_YELLOW=$'\e[33;01m' +C_RED=$'\e[31;01m' +C_NORMAL=$'\e[0m' + +SNAME='MiniDLNA server' +NAME=minidlna +CMD="/usr/sbin/${NAME}d" +CONFILE="/etc/${NAME}.conf" +PIDFILE="/var/run/${NAME}.pid" +CMD_OPTS="-f $CONFILE -P $PIDFILE" + +ok() { + echo "${C_GREEN}Done${C_NORMAL}" +} + +fail() { + echo "${C_RED}Failure${C_NORMAL}" +} + +print_status() { + if [ $? != 0 ]; then + fail + else + ok + fi +} + +start() { + if [ -x $CMD ]; then + if [ ! -e $PIDFILE ]; then + echo -n "Starting $SNAME in $CMD... " + $CMD $CMD_OPTS + print_status + else + echo "Starting $SNAME: Already running with PID `cat $PIDFILE`!" + fi + fi +} + +stop() { + if [ -e $PIDFILE ]; then + echo -n "Stopping ${SNAME}... " + kill -15 `cat $PIDFILE` + print_status + else + echo "Stopping ${SNAME}: Not running!" + fi +} + +restart() { + stop + sleep 3 + start +} + +status() { + if [ -e $PIDFILE ]; then + echo "$SNAME running with PID `cat $PIDFILE`." + else + STAT=`ps -C $NAME -o pid= | wc -l` + if [ ${STAT} -ge 1 ]; then + echo "$SNAME is running" + else + echo "$SNAME is not running" + fi + fi +} + +db_clean() { + # If DB dir defined explicitly in log (i.e. not commented), then use it + DB_DIR_CONF=$(grep -E '^db_dir=' $CONFILE | awk -F'=' '{ print $2 }') + # else fallback to default + DB_DIR=${DB_DIR_CONF:-/var/cache/$NAME} + WAS_RUNNING=0 + + if [ -e $DB_DIR -a -d $DB_DIR ]; then + # Stop daemon if running + if [ -e $PIDFILE ]; then + WAS_RUNNING=1 + stop + sleep 3 + fi + + echo -n "Cleaning cache in ${DB_DIR}... " + rm -f ${DB_DIR}/files.db + rm -rf ${DB_DIR}art_cache + print_status + + # And restart daemon afterwards + if [ $WAS_RUNNING -ne 0 ]; then + start + fi + else + echo "Error: cache dir $DB_DIR does not exist or not a direcory!" + fi +} + +help() { + echo "$SNAME control" + echo "Usage: $0 start|stop|restart|status|clean" + echo +} + +case "$1" in + 'start') + start ;; + 'stop') + stop ;; + 'restart') + restart ;; + 'status') + status ;; + 'clean') + db_clean ;; + *) + help ;; +esac + |