diff --git a/aur/mediatomb/PKGBUILD b/aur/mediatomb/PKGBUILD index f17fbb6c2..16952ac31 100644 --- a/aur/mediatomb/PKGBUILD +++ b/aur/mediatomb/PKGBUILD @@ -6,17 +6,18 @@ pkgname=mediatomb pkgver=0.12.1 -pkgrel=12 +pkgrel=12.1 pkgdesc="Free UPnP/DLNA media server" arch=('i686' 'x86_64') url="http://mediatomb.cc/" license=('GPL') -depends=('file' 'curl' 'ffmpegthumbnailer' 'js185' 'libexif' 'libmp4v2' 'sqlite3' 'taglib' 'libmysqlclient') -optdepends=('mysql: to store your music database in mysql') +depends=('file' 'curl' 'ffmpegthumbnailer' 'libexif' 'libmp4v2' 'sqlite3' 'taglib' 'libmariadbclient' 'js185') +optdepends=('mariadb: to store your music database in mariadb') backup=('etc/conf.d/mediatomb') install=mediatomb.install source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz" - 'mediatomb.rc' + 'mediatomb.service' + 'mediatomb-mariadb.service' 'mediatomb.conf' 'gcc46.patch' 'tonewjs.patch' @@ -24,6 +25,16 @@ source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz" 'libav_0.7_support.patch' 'libmp4v2_191_p497.patch' 'libavformat.patch') +md5sums=('e927dd5dc52d3cfcebd8ca1af6f0d3c2' + '951b133930436a0ffc1c9b0c9f8145a3' + '27e796979c7778c3876b9a16452eb6e4' + '6503695608c811133db647e0991698eb' + '0ae34c0d73b76e3d215887834c3c08cf' + 'd9e02a9956eecf5ff645bddf6dac0331' + 'a7509bdaa0301ccbd9e564f727c1dd22' + '88144653ff2dc602bcb737f59b2421ce' + '915fa5b3b72649454009511a152b6102' + '932d29fbaaea6f1715bb6da456fb5f44') build() { cd "$srcdir/$pkgname-$pkgver" @@ -47,16 +58,7 @@ package() { make DESTDIR="$pkgdir/" install - install -D -m0755 "$srcdir/mediatomb.rc" "$pkgdir/etc/rc.d/mediatomb" + install -D -m0755 "$srcdir/mediatomb.service" "$pkgdir/usr/lib/systemd/system/mediatomb.service" + install -D -m0755 "$srcdir/mediatomb-mariadb.service" "$pkgdir/usr/lib/systemd/system/mediatomb-mariadb.service" install -D -m0755 "$srcdir/mediatomb.conf" "$pkgdir/etc/conf.d/mediatomb" - install -d "$pkgdir/var/lib/mediatomb" } -sha256sums=('31163c34a7b9d1c9735181737cb31306f29f1f2a0335fb4f53ecccf8f62f11cd' - '1a67a1deb8a41467fe9bbf66358a255f0df97b0170a5fc3d48c1f768c8d328b9' - 'ba9753a4a380d4c717c987efec03a3c6d401d3ff93a6fced28098adbd3a44cc9' - '0c02a20032f0c296800b1bb9644638970c2dedbc5ab7141d66a637235e9da6ce' - '2cd8f5628c3a38b290526f008bae351b90211825f86e5959bf95f140748de574' - 'd9a3062858900d32b977f0d50d168fd7d36785b6ecc038c019e661e27f7b1c17' - 'c6523e8bf5e2da89b7475d6777ef9bffe7d089752ef2f7b27b5e39a4130fb0ff' - 'd39c2f9aab051c5447461718fd0ec72cf5982f6c920a4a985a50831f34babe84' - '76b11706d70ed8f5e157d96ca441c90c46c42176102fcb651b4ab1102b61bfee') diff --git a/aur/mediatomb/mediatomb-mariadb.service b/aur/mediatomb/mediatomb-mariadb.service new file mode 100644 index 000000000..5b83f1d78 --- /dev/null +++ b/aur/mediatomb/mediatomb-mariadb.service @@ -0,0 +1,13 @@ +[Unit] +Description=MediaTomb Daemon using MariaDB +After=mysql.target network.target + +[Service] +EnvironmentFile=/etc/conf.d/mediatomb +ExecStart=/usr/bin/mediatomb -p $MT_PORT -u $MT_USER -g $MT_GROUP \ + -P $MT_PIDFILE -l $MT_LOGFILE -m $MT_HOME -f $MT_CFGDIR $MT_OPTIONS +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/aur/mediatomb/mediatomb.conf b/aur/mediatomb/mediatomb.conf index 798018d2a..c2b435f92 100644 --- a/aur/mediatomb/mediatomb.conf +++ b/aur/mediatomb/mediatomb.conf @@ -6,8 +6,8 @@ MT_PORT='50500' # User and group to run as -MT_USER='nobody' -MT_GROUP='nobody' +MT_USER='mediatomb' +MT_GROUP='mediatomb' # Location of the PID file MT_PIDFILE='/var/run/mediatomb.pid' diff --git a/aur/mediatomb/mediatomb.install b/aur/mediatomb/mediatomb.install index 56f6ef92c..27f71d5a4 100644 --- a/aur/mediatomb/mediatomb.install +++ b/aur/mediatomb/mediatomb.install @@ -1,9 +1,20 @@ post_install() { + post_upgrade + passwd -l mediatomb &>/dev/null echo 'Warning: the MediaTomb web interface exposes your filesystem to the network' echo 'For maximum security, set in your MediaTomb config file' } post_upgrade() { - # TODO: disable next update - post_install + # create user/group that the daemon will run as by default, do not delete this on uninstall, as it will own files + getent group mediatomb >/dev/null || groupadd -g 241 mediatomb &>/dev/null + getent passwd mediatomb >/dev/null || useradd -c 'Mediatomb DLNA Server' -u 241 -g mediatomb -b '/var/lib' -m -s /bin/false mediatomb &>/dev/null + + echo 'Attention: By default, MediaTomb now runs as its own user: mediatomb.' + echo 'Ensuring ownership of /var/lib/mediatomb is mediatomb:mediatomb...' + chown -R mediatomb:mediatomb /var/lib/mediatomb &>/dev/null + echo + echo 'Please note that the old rc script has been replaced with systemd service files.' + echo } + diff --git a/aur/mediatomb/mediatomb.rc b/aur/mediatomb/mediatomb.rc deleted file mode 100644 index 7b93012cd..000000000 --- a/aur/mediatomb/mediatomb.rc +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /etc/conf.d/mediatomb - -MT_OPTIONS="-p $MT_PORT -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE \ - -l $MT_LOGFILE -m $MT_HOME -f $MT_CFGDIR $MT_OPTIONS" - -case "$1" in - start) - stat_busy "Starting Mediatomb UPnP Media Server" - - chown "$MT_USER:$MT_GROUP" "$MT_HOME" - - if ! pidof -o %PPID /usr/bin/mediatomb &> /dev/null; then - rm -f "$MT_PIDFILE" - fi - - PID="$(cat "$MT_PIDFILE" 2> /dev/null)" - - if [ -z "$PID" ] && /usr/bin/mediatomb -d $MT_OPTIONS; then - add_daemon mediatomb - stat_done - else - stat_fail - fi - ;; - - stop) - stat_busy "Stopping Mediatomb UPnP Media Server" - - PID="$(cat "$MT_PIDFILE" 2> /dev/null)" - - if [ -n "$PID" ] && kill "$PID" &> /dev/null; then - rm -f "$MT_PIDFILE" - rm_daemon mediatomb - stat_done - else - stat_fail - fi - ;; - - restart) - "$0" stop - sleep 1 - "$0" start - ;; - - *) - echo "usage: $0 {start|stop|restart}" - ;; -esac -exit 0 diff --git a/aur/mediatomb/mediatomb.service b/aur/mediatomb/mediatomb.service new file mode 100644 index 000000000..e9869cfb5 --- /dev/null +++ b/aur/mediatomb/mediatomb.service @@ -0,0 +1,13 @@ +[Unit] +Description=MediaTomb Daemon +After=network.target + +[Service] +EnvironmentFile=/etc/conf.d/mediatomb +ExecStart=/usr/bin/mediatomb -p $MT_PORT -u $MT_USER -g $MT_GROUP \ + -P $MT_PIDFILE -l $MT_LOGFILE -m $MT_HOME -f $MT_CFGDIR $MT_OPTIONS +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target