Add build option to skip steps requiring root permissions
authorDrDaveD <2129743+DrDaveD@users.noreply.github.com>
Thu, 4 Jul 2019 08:01:19 +0000 (03:01 -0500)
committerNikolaus Rath <Nikolaus@rath.org>
Thu, 4 Jul 2019 08:02:30 +0000 (09:02 +0100)
meson_options.txt
util/install_helper.sh
util/meson.build

index c08e38e4b58d5324750532b8767ca1c7104da7c4..8950ff100e4befa74e28bb0626ba08fb86b49278 100644 (file)
@@ -5,7 +5,11 @@ option('udevrulesdir', type : 'string', value : '',
        description: 'Where to install udev rules (if empty, query pkg-config(1))')
 
 option('utils', type : 'boolean', value : true,
-       description: 'Wheter or not to build and install helper programs')
+       description: 'Whether or not to build and install helper programs')
 
 option('examples', type : 'boolean', value : true,
-       description: 'Wheter or not to build example programs')
\ No newline at end of file
+       description: 'Whether or not to build example programs')
+
+option('useroot', type : 'boolean', value : true,
+       description: 'Set owner and setuid bits on installed files')
+
index 688b2450ef300d299924df5b6d05ea304ebe52e8..30f6227b9e96495c7e75991d53fad925359af208 100755 (executable)
@@ -9,6 +9,7 @@ set -e
 sysconfdir="$1"
 bindir="$2"
 udevrulesdir="$3"
+useroot="$4"
 
 # Both sysconfdir and bindir are absolute paths (since they are joined
 # with --prefix in meson.build), but need to be interpreted relative
@@ -22,16 +23,17 @@ else
     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 $useroot; then
+    chown root:root "${DESTDIR}${bindir}/fusermount3"
+    chmod u+s "${DESTDIR}${bindir}/fusermount3"
 
-if test ! -e "${DESTDIR}/dev/fuse"; then
-    mkdir -p "${DESTDIR}/dev"
-    mknod "${DESTDIR}/dev/fuse" -m 0666 c 10 229
+    if test ! -e "${DESTDIR}/dev/fuse"; then
+        mkdir -p "${DESTDIR}/dev"
+        mknod "${DESTDIR}/dev/fuse" -m 0666 c 10 229
+    fi
 fi
 
 install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
index aa0e734a3d929594b0420693c5470b9c6ffd0ffd..5c8f1b5868011a661d861134a78d81be62c1e7a9 100644 (file)
@@ -23,6 +23,7 @@ endif
 meson.add_install_script('install_helper.sh',
                          join_paths(get_option('prefix'), get_option('sysconfdir')),
                          join_paths(get_option('prefix'), get_option('bindir')),
-                         udevrulesdir)
+                         udevrulesdir,
+                         '@0@'.format(get_option('useroot')))