Do not hardcode /etc/fuse.conf path.
authorNikolaus Rath <Nikolaus@rath.org>
Fri, 31 Aug 2018 11:38:26 +0000 (13:38 +0200)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 31 Aug 2018 11:46:13 +0000 (13:46 +0200)
ChangeLog.rst
meson_options.txt
util/fusermount.c
util/install_helper.sh
util/meson.build

index 97f51640be5a2bf5ceb5a8f09aeccd14aea57c1f..75fcc48fd8538fc147c8d7fc372f87c2ddc87d24 100644 (file)
@@ -6,6 +6,9 @@ Unreleased Changes
   bcachefs, aufs and FAT filesystems.
 * libfuse may now be used as a Meson subproject.
 * Fix a few low-impact memory leaks.
+* The `fuse.conf` file is no longer looked for in `/etc`, but in the
+  *sysconfdir* directory (which can be set with `meson configure`). By
+  default, the location is thus `/usr/local/etc/fuse.conf`.
 
 libfuse 3.2.5 (2018-07-24)
 ==========================
index b4608a7b1fe63b4744c08e997ecff83ac1e5b3ad..983fcacce29580d7de705aa453bf33106d81d4ed 100644 (file)
@@ -2,4 +2,4 @@ option('disable-mtab', type : 'boolean', value : false,
        description: 'Disable and ignore usage of /etc/mtab')
 
 option('udevrulesdir', type : 'string', value : '',
-       description: 'Path where udev rules are installed to (Defaults to udevdir specified in udev.pc)')
+       description: 'Where to install udev rules (if empty, query pkg-config(1))')
index ed9d0aa0ac457b5a773940a16d7642d268b03cec..250bf761a5149f8524a10524333b0c2698ac0b90 100644 (file)
@@ -35,7 +35,6 @@
 #define FUSE_COMMFD_ENV                "_FUSE_COMMFD"
 
 #define FUSE_DEV "/dev/fuse"
-#define FUSE_CONF "/etc/fuse.conf"
 
 #ifndef MS_DIRSYNC
 #define MS_DIRSYNC 128
index 48a8927f39a0a9934bdc347a49c52f441ec13a7a..688b2450ef300d299924df5b6d05ea304ebe52e8 100755 (executable)
@@ -9,10 +9,25 @@ set -e
 sysconfdir="$1"
 bindir="$2"
 udevrulesdir="$3"
-prefix="${MESON_INSTALL_DESTDIR_PREFIX}"
 
-chown root:root "${prefix}/${bindir}/fusermount3"
-chmod u+s "${prefix}/${bindir}/fusermount3"
+# Both sysconfdir and bindir are absolute paths (since they are joined
+# with --prefix in meson.build), but need to be interpreted relative
+# to DESTDIR (if specified).
+
+if [ -z "${DESTDIR}" ]; then
+    # Prevent warnings about uninitialized variable
+    DESTDIR=""
+else
+    # Get rid of duplicate slash
+    DESTDIR="${DESTDIR%/}"
+fi
+
+chown root:root "${DESTDIR}${bindir}/fusermount3"
+chmod u+s "${DESTDIR}${bindir}/fusermount3"
+
+install -D -m 644 "${MESON_SOURCE_ROOT}/util/fuse.conf" \
+       "${DESTDIR}${sysconfdir}/fuse.conf"
+
 
 if test ! -e "${DESTDIR}/dev/fuse"; then
     mkdir -p "${DESTDIR}/dev"
@@ -20,19 +35,17 @@ if test ! -e "${DESTDIR}/dev/fuse"; then
 fi
 
 install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
-        "${DESTDIR}/${udevrulesdir}/99-fuse3.rules"
+        "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
 
 install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
-        "${DESTDIR}/etc/init.d/fuse3"
+        "${DESTDIR}${sysconfdir}/init.d/fuse3"
 
-install -D -m 644 "${MESON_SOURCE_ROOT}/util/fuse.conf" \
-       "${DESTDIR}/etc/fuse.conf"
 
 if test -x /usr/sbin/update-rc.d && test -z "${DESTDIR}"; then
     /usr/sbin/update-rc.d fuse3 start 34 S . start 41 0 6 . || /bin/true
 else
     echo "== FURTHER ACTION REQUIRED =="
-    echo "Make sure that your init system will start the ${DESTDIR}/etc/init.d/fuse3 init script"
+    echo "Make sure that your init system will start the ${sysconfdir}/init.d/fuse3 init script"
 fi
 
 
index ec08c17c3d9ae2713caadef6f0c6f7debbaac9ad..01f7678a754b2b15656f5c5fce7d2e3eb7ceca7f 100644 (file)
@@ -8,10 +8,13 @@ mount_util_c = custom_target('mount_util',
   command : ['cp', '-a', '@INPUT@', '@OUTPUT@'],
 )
 
+fuseconf_path = join_paths(get_option('prefix'), get_option('sysconfdir'), 'fuse.conf')
+
 executable('fusermount3', ['fusermount.c', mount_util_c],
            include_directories: include_dirs,
            install: true,
-           install_dir: get_option('bindir'))
+           install_dir: get_option('bindir'),
+           c_args: '-DFUSE_CONF="@0@"'.format(fuseconf_path))
 
 executable('mount.fuse3', ['mount.fuse.c'], 
            include_directories: include_dirs,
@@ -25,7 +28,9 @@ if udevrulesdir == ''
   udevrulesdir = join_paths(udev.get_pkgconfig_variable('udevdir'), 'rules.d')
 endif
 
-meson.add_install_script('install_helper.sh', get_option('sysconfdir'),
-                         get_option('bindir'), udevrulesdir)
+meson.add_install_script('install_helper.sh',
+                         join_paths(get_option('prefix'), get_option('sysconfdir')),
+                         join_paths(get_option('prefix'), get_option('bindir')),
+                         udevrulesdir)