]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/commitdiff
minidlna: New package.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 7 Jul 2013 20:36:25 +0000 (22:36 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 7 Jul 2013 20:36:25 +0000 (22:36 +0200)
minidlna/minidlna.nm [new file with mode: 0644]
minidlna/minidlna.tmpfiles [new file with mode: 0644]
minidlna/systemd/minidlna.service [new file with mode: 0644]

diff --git a/minidlna/minidlna.nm b/minidlna/minidlna.nm
new file mode 100644 (file)
index 0000000..2c4d4a7
--- /dev/null
@@ -0,0 +1,123 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = minidlna
+version    = 1.0.26
+release    = 1
+
+groups     = System/Daemons
+url        = http://sourceforge.net/projects/minidlna/
+license    = GPLv2
+summary    = Lightweight DLNA/UPnP-AV server.
+
+description
+       MiniDLNA (aka ReadyDLNA) is server software with the aim of being fully 
+       compliant with DLNA/UPnP-AV clients.
+
+       The minidlna daemon serves media files (music, pictures, and video) to 
+       clients on your network.  Example clients include applications such as 
+       Totem and XBMC, and devices such as portable media players, smartphones, 
+       and televisions.
+end
+
+source_dl  = http://downloads.sourceforge.net/%{name}/
+
+build
+       requires
+               ffmpeg-devel
+               flac-devel
+               libexif-devel
+               libid3tag-devel
+               libjpeg-devel
+               libuuid-devel
+               libvorbis-devel
+               sqlite-devel
+       end
+
+       prepare_cmds
+               # Honor our CFLAGS and include ffmpeg headers
+               sed -i 's!CFLAGS = -Wall -g -O3!CFLAGS += -I/usr/include/ffmpeg/!' Makefile
+
+               # Verbose Makefile
+               sed -i 's/@$(CC)/$(CC)/;s/&& exit 0\; \\//;/echo "The following command failed:/d' Makefile
+
+               # Edit the default config file to run the daemon with the minidlna user
+               sed -i 's/#db_dir=\/var\/cache\/minidlna/db_dir=\/var\/cache\/minidlna/' \
+                       %{name}.conf
+               sed -i 's/#log_dir=\/var\/log/log_dir=\/var\/log\/minidlna/' \
+                       %{name}.conf
+
+               # Create minidlna user and group.
+               %{create_user}
+       end
+
+       install_cmds
+               # Install configuration file.
+               make install-conf DESTDIR=%{BUILDROOT}
+
+               # Create cache and log directories.
+               mkdir -pv %{BUILDROOT}%{localstatedir}/cache
+               install -d -m 0755 %{BUILDROOT}%{localstatedir}/cache/%{name}/
+
+               mkdir -pv %{BUILDROOT}%{localstatedir}/log
+               install -d -m 0755 %{BUILDROOT}%{localstatedir}/log/%{name}/
+
+               mkdir -pv %{BUILDROOT}/run/%{name}
+
+               # Set correct ownership.
+               chown minidlna:minidlna %{BUILDROOT}%{localstatedir}/cache/%{name}
+               chown minidlna:minidlna %{BUILDROOT}%{localstatedir}/log/%{name}
+               chown minidlna:minidlna %{BUILDROOT}/run/%{name}
+
+       end
+end
+
+create_user
+       getent group minidlna >/dev/null || groupadd -r minidlna
+       getent passwd minidlna >/dev/null || \
+               useradd -r -g minidlna -d /dev/null -s /sbin/nologin \
+                       -c "minidlna user account" minidlna
+end
+
+packages
+       package %{name}
+               prerequires += \
+                       shadow-utils
+
+               configfiles
+                       %{sysconfdir}/%{name}.conf
+               end
+
+               datafiles
+                       %{localstatedir}/log/%{name}
+               end
+
+               script prein
+                       %{create_user}
+               end
+
+               script postin
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script preun
+                       systemctl --no-reload disable minidlna.service >/dev/null 2>&1 || :
+                       systemctl stop minidlna.service >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+                       systemctl try-restart minidlna.service >/dev/null 2>&1 || :
+               end
+       end
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
diff --git a/minidlna/minidlna.tmpfiles b/minidlna/minidlna.tmpfiles
new file mode 100644 (file)
index 0000000..233a3f8
--- /dev/null
@@ -0,0 +1 @@
+d /run/minidlna   755 minidlna minidlna
diff --git a/minidlna/systemd/minidlna.service b/minidlna/systemd/minidlna.service
new file mode 100644 (file)
index 0000000..263b397
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]\r
+Description=MiniDLNA is a DLNA/UPnP-AV server software\r
+After=syslog.target local-fs.target network.target\r
+\r
+[Service]\r
+User=minidlna\r
+Group=minidlna\r
+Type=forking\r
+PIDFile=/run/minidlna/minidlna.pid\r
+ExecStart=/usr/sbin/minidlna -f /etc/minidlna.conf -P /run/minidlna/minidlna.pid\r
+\r
+[Install]\r
+WantedBy=multi-user.target\r