summaryrefslogtreecommitdiff
path: root/package/mpd
diff options
context:
space:
mode:
Diffstat (limited to 'package/mpd')
-rw-r--r--package/mpd/Makefile5
-rw-r--r--package/mpd/files/mpd.conf4
-rw-r--r--package/mpd/files/mpd.init10
-rw-r--r--package/mpd/files/mpd.postinst3
-rw-r--r--package/mpd/patches/patch-src_db_simple_db_plugin_c84
5 files changed, 86 insertions, 20 deletions
diff --git a/package/mpd/Makefile b/package/mpd/Makefile
index c14529ab5..5b211bb30 100644
--- a/package/mpd/Makefile
+++ b/package/mpd/Makefile
@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
PKG_NAME:= mpd
PKG_VERSION:= 0.17.6
-PKG_RELEASE:= 1
+PKG_RELEASE:= 3
PKG_MD5SUM:= d0da6a6a1d9cf1e8710b6082f6ef7849
PKG_DESCR:= A music player daemon
PKG_SECTION:= multimedia
@@ -120,6 +120,7 @@ CONFIGURE_ARGS+= --disable-httpd-output \
--disable-sqlite \
--disable-mpg123 \
--disable-soundcloud \
+ --enable-inotify \
--with-zeroconf=no
ifneq (${ADK_PACKAGE_MPD_WITH_ALSA},)
@@ -207,7 +208,7 @@ CONFIGURE_ARGS+= --disable-lsr
endif
mpd-install:
- ${INSTALL_DIR} ${IDIR_MPD}/usr/bin ${IDIR_MPD}/etc
+ ${INSTALL_DIR} ${IDIR_MPD}/usr/bin ${IDIR_MPD}/etc/mpd/playlists
${INSTALL_BIN} ${WRKINST}/usr/bin/mpd ${IDIR_MPD}/usr/bin
${INSTALL_DATA} ./files/mpd.conf ${IDIR_MPD}/etc/mpd.conf
diff --git a/package/mpd/files/mpd.conf b/package/mpd/files/mpd.conf
index ee3565c15..d022a3069 100644
--- a/package/mpd/files/mpd.conf
+++ b/package/mpd/files/mpd.conf
@@ -1,10 +1,10 @@
# An example configuration file for MPD
-user "mpd"
+user "root"
auto_update "no"
music_directory "/music"
playlist_directory "/etc/mpd/playlists"
state_file "/etc/mpd/state"
-db_file "/etc/mpd/database"
+db_file "/data/mpd/database"
pid_file "/var/run/mpd.pid"
log_file "syslog"
filesystem_charset "UTF-8"
diff --git a/package/mpd/files/mpd.init b/package/mpd/files/mpd.init
index 8ff050b73..2e39cf82e 100644
--- a/package/mpd/files/mpd.init
+++ b/package/mpd/files/mpd.init
@@ -11,16 +11,6 @@ autostart)
exec sh $0 start
;;
start)
- # check group membership
- id mpd | grep audio >/dev/null 2>&1
- if [ $? -ne 0 ];then
- echo "mpd user must be in group audio."
- exit 1
- fi
- if [ ! -d /etc/mpd/playlists ];then
- mkdir -p /etc/mpd/playlists
- chown -R mpd:mpd /etc/mpd
- fi
mpd
;;
stop)
diff --git a/package/mpd/files/mpd.postinst b/package/mpd/files/mpd.postinst
index a635ccae7..9eb855abe 100644
--- a/package/mpd/files/mpd.postinst
+++ b/package/mpd/files/mpd.postinst
@@ -1,6 +1,3 @@
#!/bin/sh
. $IPKG_INSTROOT/etc/functions.sh
-gid=$(get_next_gid)
-add_group mpd $gid
-add_user mpd $(get_next_uid) $gid /music
add_rcconf mpd
diff --git a/package/mpd/patches/patch-src_db_simple_db_plugin_c b/package/mpd/patches/patch-src_db_simple_db_plugin_c
index 4158c5b8e..55ebba670 100644
--- a/package/mpd/patches/patch-src_db_simple_db_plugin_c
+++ b/package/mpd/patches/patch-src_db_simple_db_plugin_c
@@ -1,9 +1,87 @@
---- mpd-0.17.5.orig/src/db/simple_db_plugin.c 2013-08-01 09:15:41.000000000 +0200
-+++ mpd-0.17.5/src/db/simple_db_plugin.c 2013-10-08 15:28:10.000000000 +0200
-@@ -338,6 +338,8 @@ simple_db_save(struct db *_db, GError **
+--- mpd-0.17.6.orig/src/db/simple_db_plugin.c 2013-08-01 09:15:41.000000000 +0200
++++ mpd-0.17.6/src/db/simple_db_plugin.c 2013-10-17 17:51:34.000000000 +0200
+@@ -28,6 +28,9 @@
+ #include "conf.h"
+ #include "directory.h"
+
++#include <sys/mount.h>
++#include <mntent.h>
++#include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -128,8 +131,8 @@ simple_db_check(struct simple_db *db, GE
+ return false;
+ }
+
+- /* Check if we can write to the directory */
+- if (access(dirPath, X_OK | W_OK)) {
++ /* Check if we can change into the directory */
++ if (access(dirPath, X_OK)) {
+ g_set_error(error_r, simple_db_quark(), errno,
+ "Can't create db file in \"%s\": %s",
+ dirPath, g_strerror(errno));
+@@ -159,9 +162,9 @@ simple_db_check(struct simple_db *db, GE
+ }
+
+ /* And check that we can write to it */
+- if (access(db->path, R_OK | W_OK)) {
++ if (access(db->path, R_OK)) {
+ g_set_error(error_r, simple_db_quark(), errno,
+- "Can't open db file \"%s\" for reading/writing: %s",
++ "Can't open db file \"%s\" for reading: %s",
+ db->path, g_strerror(errno));
+ return false;
+ }
+@@ -305,6 +308,9 @@ simple_db_save(struct db *_db, GError **
+ {
+ struct simple_db *db = (struct simple_db *)_db;
+ struct directory *music_root = db->root;
++ struct mntent *mnt;
++ int remount;
++ FILE *f;
+
+ db_lock();
+
+@@ -317,6 +323,26 @@ simple_db_save(struct db *_db, GError **
+ db_unlock();
+
+ g_debug("writing DB");
++
++ remount = 0;
++ /* check if /data is mounted read-only */
++ if ((f = setmntent("/proc/mounts", "r")) == NULL)
++ g_message("Checking /proc/mounts failed");
++
++ while ((mnt = getmntent(f)) != NULL) {
++ if (strcmp(mnt->mnt_dir, "/data") == 0 &&
++ hasmntopt(mnt, MNTOPT_RO) != NULL) {
++ remount = 1;
++ }
++ }
++ endmntent(f);
++
++ if (remount) {
++ if (mount("","/data",0,MS_REMOUNT,0)<0) {
++ g_error("Remounting /data rw failed");
++ }
++ g_message("Mounted /data successfully in read-write mode");
++ }
+
+ FILE *fp = fopen(db->path, "w");
+ if (!fp) {
+@@ -338,6 +364,16 @@ simple_db_save(struct db *_db, GError **
fclose(fp);
++ if (remount) {
++ sync();
++ if (mount("","/data",0,MS_REMOUNT|MS_RDONLY,0)<0) {
++ g_error("Remounting /data ro failed");
++ }
++ g_message("Mounted /data successfully in read-only mode");
++ }
++
+ g_message("Successfully written database to file: %s", db->path);
+
struct stat st;