Skip to content

Commit a73363e

Browse files
committed
Add ability to set custom fusermount path
This is only exposed in Meson as Autotools isn't recommended. This also removes the 'fuse' option as it seems redundant.
1 parent f996a79 commit a73363e

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ GLIB_TESTS
230230
FLATPAK_BUILDER_VERSION=flatpak_builder_version
231231
AC_SUBST(FLATPAK_BUILDER_VERSION)
232232

233+
AC_DEFINE([FUSERMOUNT], ["fusermount"], [Path to fusermount binary])
234+
233235
AC_CONFIG_FILES([
234236
Makefile
235237
data/Makefile

meson.build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ project(
22
'flatpak-builder',
33
'c',
44
license: 'LGPL-2.1-or-later',
5-
meson_version: '>= 0.56.2',
5+
meson_version: '>= 0.62.0',
66
version: '1.4.4',
77
default_options: 'c_std=gnu99',
88
)
@@ -44,6 +44,13 @@ debugedit = find_program('debugedit', version: '>= 5.0')
4444
appstreamcli = find_program('appstreamcli', version: '>= 0.15.0')
4545
appstreamcli_compose = run_command(appstreamcli, ['compose', '--help'], check: true)
4646

47+
fusermount = get_option('system_fusermount')
48+
if fusermount == ''
49+
fusermount_program = find_program(['fusermount3', 'fusermount'], required: true)
50+
else
51+
fusermount_program = find_program(fusermount, required: true)
52+
endif
53+
4754
subdir('src')
4855
subdir('doc')
4956
if get_option('tests')

meson_options.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ option(
2323
description: 'Whether to build and run unit tests'
2424
)
2525
option(
26-
'fuse',
27-
type: 'combo',
28-
choices: ['2', '3', 'compatible'],
29-
value: 'compatible',
30-
description: 'Target a specific version of FUSE for best performance or support multiple versions'
31-
)
26+
'system_fusermount',
27+
type: 'string',
28+
description: 'system fusermount executable, or empty string to try multiple names (fusermount3, fusermount) automatically',
29+
value: '',
30+
)

src/builder-context.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,7 @@ static char *rofiles_unmount_path = NULL;
839839
static void
840840
rofiles_umount_handler (int signum)
841841
{
842-
char *argv[] = { "fusermount", "-uz", NULL,
843-
NULL };
842+
char *argv[] = { FUSERMOUNT, "-uz", NULL, NULL };
844843

845844
argv[2] = rofiles_unmount_path;
846845
g_debug ("Unmounting read-only fs: %s %s %s", argv[0], argv[1], argv[2]);
@@ -979,8 +978,7 @@ gboolean
979978
builder_context_disable_rofiles (BuilderContext *self,
980979
GError **error)
981980
{
982-
char *argv[] = { "fusermount", "-u", NULL,
983-
NULL };
981+
char *argv[] = { FUSERMOUNT, "-u", NULL, NULL };
984982

985983
if (!self->use_rofiles)
986984
return TRUE;

src/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ config_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_66')
3939
# We support targeting specific fuse versions to optimize performance.
4040
# Currently only fuse2 has optimizations but this allows for future fuse3
4141
# optimizations.
42-
config_data.set('ASSUME_FUSE_2', get_option('fuse') == '2')
42+
config_data.set('ASSUME_FUSE_2', fusermount_program.version().version_compare('< 3.0.0'))
43+
config_data.set_quoted('FUSERMOUNT', fusermount_program.full_path())
4344

4445
config_h = configure_file(
4546
configuration: config_data,

tests/libtest.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ else
3030
test_builddir=$(dirname $0)
3131
fi
3232

33+
if [ -z "${FUSERMOUNT}" ]; then
34+
FUSERMOUNT=fusermount
35+
fi
36+
3337
assert_not_reached () {
3438
echo $@ 1>&2; exit 1
3539
}
@@ -296,7 +300,7 @@ run_sh () {
296300
# fuse support is needed (and the kernel module needs to be loaded) for several
297301
# flatpak-builder tests
298302
skip_without_fuse () {
299-
if [ ! -w /dev/fuse ] || ! command -v fusermount >/dev/null; then
303+
if [ ! -w /dev/fuse ] || ! command -v "$FUSERMOUNT" >/dev/null; then
300304
echo "1..0 # SKIP this test requires fuse support"
301305
exit 0
302306
fi

tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test_env.set('FLATPAK_TESTS_DEBUG', '1')
66
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
77
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
88
test_env.prepend('PATH', meson.current_build_dir() / '..' / 'src', separator: ':')
9+
test_env.set('FUSERMOUNT', fusermount_program.full_path())
910

1011
test_names = [
1112
'test-builder',

0 commit comments

Comments
 (0)