0d17c11
From bd44ab460a2f0d531df0b6b34176efaf6a0641ac Mon Sep 17 00:00:00 2001
0d17c11
From: Bastien Nocera <hadess@hadess.net>
0d17c11
Date: Thu, 4 Mar 2010 14:47:17 +0000
0d17c11
Subject: [PATCH] Make the temporary mount point configurable
0d17c11
0d17c11
Distributions that use SELinux cannot have libgpod's callouts
0d17c11
mount devices as they wish in random location on the disk.
0d17c11
0d17c11
Instead, we'd use a specific directory, so that the SELinux
0d17c11
rules could be amended for that case.
0d17c11
0d17c11
This patch does not change the default location of the temporary
0d17c11
directory.
0d17c11
---
0d17c11
 configure.ac            |   15 +++++++++++++++
0d17c11
 tools/Makefile.am       |    9 +++++++++
0d17c11
 tools/generic-callout.c |    2 +-
0d17c11
 3 files changed, 25 insertions(+), 1 deletions(-)
0d17c11
0d17c11
diff --git a/configure.ac b/configure.ac
0d17c11
index 14d7135..1d03dcb 100644
0d17c11
--- a/configure.ac
0d17c11
+++ b/configure.ac
0d17c11
@@ -203,6 +203,20 @@ AC_ARG_ENABLE(udev,
0d17c11
 AM_CONDITIONAL(USE_UDEV, test x"$enable_udev" = xyes)
0d17c11
 AC_SUBST([udevdir], [/lib/udev])
0d17c11
 
0d17c11
+dnl ***********************************************************************
0d17c11
+dnl * for the udev and hal callouts, we need a temporary directory to
0d17c11
+dnl * mount the iPod to write out its extended info file.
0d17c11
+dnl ***********************************************************************
0d17c11
+
0d17c11
+temp_mount_dir="/tmp/"
0d17c11
+AC_ARG_WITH(temp_mount_dir, AC_HELP_STRING([--with-mount-dir=DIR],
0d17c11
+	[Directory where HAL/udev will create a sub-directory to mount iPods]),,
0d17c11
+	with_temp_mount_dir="$temp_mount_dir")
0d17c11
+TMPMOUNTDIR="$with_temp_mount_dir"
0d17c11
+AC_SUBST(TMPMOUNTDIR)
0d17c11
+AH_TEMPLATE([TMPMOUNTDIR], [Directory where HAL/udev will create a sub-directory to mount iPods])
0d17c11
+AC_DEFINE_UNQUOTED(TMPMOUNTDIR, "$with_temp_mount_dir", [Directory where HAL/udev will create a sub-directory to mount iPods])
0d17c11
+
0d17c11
 dnl **************************************************
0d17c11
 dnl * TagLib is only used by test-rebuild-db 
0d17c11
 dnl **************************************************
0d17c11
@@ -393,6 +407,7 @@ Configuration for $PACKAGE $VERSION :
0d17c11
  Python bindings ..........: $with_python
0d17c11
  PyGObject support ........: $have_pygobject
0d17c11
  iPhone/iPod Touch support.: $enable_libimobiledevice
0d17c11
+ Temporary mount directory.: $with_temp_mount_dir
0d17c11
 
0d17c11
  Now type 'make' to build $PACKAGE $VERSION,
0d17c11
  and then 'make install' for installation.
0d17c11
diff --git a/tools/Makefile.am b/tools/Makefile.am
0d17c11
index e6334cd..2f8553e 100644
0d17c11
--- a/tools/Makefile.am
0d17c11
+++ b/tools/Makefile.am
0d17c11
@@ -90,3 +90,12 @@ ipod_time_sync_CFLAGS=$(SGUTILS_CFLAGS) $(LIBGPOD_CFLAGS)
0d17c11
 ipod_time_sync_LDADD=$(SGUTILS_LIBS) $(LIBGPOD_LIBS) 
0d17c11
 endif
0d17c11
 
0d17c11
+if USE_UDEV
0d17c11
+install-data-hook:
0d17c11
+	$(MKDIR_P) "$(DESTDIR)$(MOUNTDIR)"
0d17c11
+endif
0d17c11
+if HAVE_HAL
0d17c11
+install-data-hook:
0d17c11
+	$(MKDIR_P) "$(DESTDIR)$(MOUNTDIR)"
0d17c11
+endif
0d17c11
+
0d17c11
diff --git a/tools/generic-callout.c b/tools/generic-callout.c
0d17c11
index b45f6da..b8b617e 100644
0d17c11
--- a/tools/generic-callout.c
0d17c11
+++ b/tools/generic-callout.c
0d17c11
@@ -560,7 +560,7 @@ static char *mount_ipod (const char *dev_path, const char *fstype)
0d17c11
         char *tmpname;
0d17c11
         int result;
0d17c11
 
0d17c11
-        filename = g_build_filename (g_get_tmp_dir (), "ipodXXXXXX", NULL);
0d17c11
+        filename = g_build_filename (TMPMOUNTDIR, "ipodXXXXXX", NULL);
0d17c11
         if (filename == NULL) {
0d17c11
                 return NULL;
0d17c11
         }
0d17c11
-- 
0d17c11
1.6.6.1
0d17c11