From: DrDaveD <2129743+DrDaveD@users.noreply.github.com> Date: Thu, 4 Jul 2019 08:01:19 +0000 (-0500) Subject: Add build option to skip steps requiring root permissions X-Git-Tag: fuse-3.6.2~5 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=be8db96603631ea85bb82a39c77a5514cbc47348;p=qemu-gpiodev%2Flibfuse.git Add build option to skip steps requiring root permissions --- diff --git a/meson_options.txt b/meson_options.txt index c08e38e..8950ff1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') + diff --git a/util/install_helper.sh b/util/install_helper.sh index 688b245..30f6227 100755 --- a/util/install_helper.sh +++ b/util/install_helper.sh @@ -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" \ diff --git a/util/meson.build b/util/meson.build index aa0e734..5c8f1b5 100644 --- a/util/meson.build +++ b/util/meson.build @@ -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')))