diff --git a/patches/libfuse/mount.c.diff b/patches/libfuse/mount.c.diff index e3a6981..3239021 100644 --- a/patches/libfuse/mount.c.diff +++ b/patches/libfuse/mount.c.diff @@ -1,16 +1,15 @@ -diff --git a/lib/mount.c b/lib/mount.c -index d71e6fc..ab3f54b 100644 +diff -ur a/lib/mount.c b/lib/mount.c --- a/lib/mount.c +++ b/lib/mount.c -@@ -41,7 +41,6 @@ +@@ -46,7 +46,6 @@ #define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0) #endif -#define FUSERMOUNT_PROG "fusermount3" #define FUSE_COMMFD_ENV "_FUSE_COMMFD" + #define FUSE_COMMFD2_ENV "_FUSE_COMMFD2" - #ifndef HAVE_FORK -@@ -117,17 +116,44 @@ static const struct fuse_opt fuse_mount_opts[] = { +@@ -121,6 +120,35 @@ FUSE_OPT_END }; @@ -42,64 +41,94 @@ index d71e6fc..ab3f54b 100644 + return fusermountProg; +} + - static void exec_fusermount(const char *argv[]) ++ + /* + * Running fusermount by calling 'posix_spawn' + * +@@ -129,19 +157,13 @@ + static int fusermount_posix_spawn(posix_spawn_file_actions_t *action, + char const * const argv[], pid_t *out_pid) { -- execv(FUSERMOUNT_DIR "/" FUSERMOUNT_PROG, (char **) argv); -- execvp(FUSERMOUNT_PROG, (char **) argv); -+ execv(fusermountProg(), (char **) argv); - } +- const char *full_path = FUSERMOUNT_DIR "/" FUSERMOUNT_PROG; + pid_t pid; + + /* See man 7 environ for the global environ pointer */ + + /* first try the install path */ +- int status = posix_spawn(&pid, full_path, action, NULL, ++ int status = posix_spawn(&pid, fusermountProg(), action, NULL, + (char * const *) argv, environ); +- if (status != 0) { +- /* if that fails, try a system install */ +- status = posix_spawnp(&pid, FUSERMOUNT_PROG, action, NULL, +- (char * const *) argv, environ); +- } + + if (status != 0) { + fuse_log(FUSE_LOG_ERR, +@@ -160,12 +182,12 @@ void fuse_mount_version(void) { - int pid = fork(); - if (!pid) { -- const char *argv[] = { FUSERMOUNT_PROG, "--version", NULL }; -+ const char *argv[] = { fusermountProg(), "--version", NULL }; - exec_fusermount(argv); - _exit(1); - } else if (pid != -1) -@@ -300,7 +326,7 @@ void fuse_kern_unmount(const char *mountpoint, int fd) - return; +- char const *const argv[] = {FUSERMOUNT_PROG, "--version", NULL}; ++ char const *const argv[] = {fusermountProg(), "--version", NULL}; + int status = fusermount_posix_spawn(NULL, argv, NULL); - if(pid == 0) { -- const char *argv[] = { FUSERMOUNT_PROG, "-u", "-q", "-z", -+ const char *argv[] = { fusermountProg(), "-u", "-q", "-z", - "--", mountpoint, NULL }; + if(status != 0) + fuse_log(FUSE_LOG_ERR, "Running '%s --version' failed", +- FUSERMOUNT_PROG); ++ fusermountProg()); + } + + struct mount_flags { +@@ -337,12 +359,12 @@ + return; - exec_fusermount(argv); -@@ -346,7 +372,7 @@ static int setup_auto_unmount(const char *mountpoint, int quiet) - } - } + char const * const argv[] = +- { FUSERMOUNT_PROG, "--unmount", "--quiet", "--lazy", ++ { fusermountProg(), "--unmount", "--quiet", "--lazy", + "--", mountpoint, NULL }; + int status = fusermount_posix_spawn(NULL, argv, NULL); + if(status != 0) { + fuse_log(FUSE_LOG_ERR, "Spawning %s to unmount failed: %s", +- FUSERMOUNT_PROG, strerror(-status)); ++ fusermountProg(), strerror(-status)); + return; + } + } +@@ -378,7 +400,7 @@ + setenv(FUSE_COMMFD2_ENV, arg_fd_entry, 1); -- argv[a++] = FUSERMOUNT_PROG; -+ argv[a++] = fusermountProg(); - argv[a++] = "--auto-unmount"; - argv[a++] = "--"; - argv[a++] = mountpoint; -@@ -357,7 +383,7 @@ static int setup_auto_unmount(const char *mountpoint, int quiet) - snprintf(env, sizeof(env), "%i", fds[0]); - setenv(FUSE_COMMFD_ENV, env, 1); - exec_fusermount(argv); -- perror("fuse: failed to exec fusermount3"); -+ perror("fuse: failed to exec $FUSERMOUNT_PROG"); - _exit(1); + char const *const argv[] = { +- FUSERMOUNT_PROG, ++ fusermountProg(), + "--auto-unmount", + "--", + mountpoint, +@@ -434,7 +456,7 @@ + res = socketpair(PF_UNIX, SOCK_STREAM, 0, fds); + if(res == -1) { + fuse_log(FUSE_LOG_ERR, "Running %s: socketpair() failed: %s\n", +- FUSERMOUNT_PROG, strerror(errno)); ++ fusermountProg(), strerror(errno)); + return -1; } -@@ -407,7 +433,7 @@ static int fuse_mount_fusermount(const char *mountpoint, struct mount_opts *mo, - } - } +@@ -451,7 +473,7 @@ + setenv(FUSE_COMMFD2_ENV, arg_fd_entry, 1); -- argv[a++] = FUSERMOUNT_PROG; -+ argv[a++] = fusermountProg(); - if (opts) { - argv[a++] = "-o"; - argv[a++] = opts; -@@ -421,7 +447,7 @@ static int fuse_mount_fusermount(const char *mountpoint, struct mount_opts *mo, - snprintf(env, sizeof(env), "%i", fds[0]); - setenv(FUSE_COMMFD_ENV, env, 1); - exec_fusermount(argv); -- perror("fuse: failed to exec fusermount3"); -+ perror("fuse: failed to exec $FUSERMOUNT_PROG"); - _exit(1); + char const *const argv[] = { +- FUSERMOUNT_PROG, ++ fusermountProg(), + "-o", opts ? opts : "", + "--", + mountpoint, +@@ -476,7 +498,7 @@ + close(fds[0]); + close(fds[1]); + fuse_log(FUSE_LOG_ERR, "posix_spawn(p)() for %s failed: %s", +- FUSERMOUNT_PROG, strerror(-status)); ++ fusermountProg(), strerror(-status)); + return -1; } diff --git a/scripts/common/install-dependencies.sh b/scripts/common/install-dependencies.sh index 0e21cdb..08cb682 100755 --- a/scripts/common/install-dependencies.sh +++ b/scripts/common/install-dependencies.sh @@ -18,26 +18,25 @@ this_dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")" cd "$tmpdir" -wget https://github.com/libfuse/libfuse/releases/download/fuse-3.15.0/fuse-3.15.0.tar.xz -echo "70589cfd5e1cff7ccd6ac91c86c01be340b227285c5e200baa284e401eea2ca0 fuse-3.15.0.tar.xz" | sha256sum -c - -tar xf fuse-3.*.tar.xz +wget https://github.com/libfuse/libfuse/releases/download/fuse-3.17.2/fuse-3.17.2.tar.gz +echo "3d932431ad94e86179e5265cddde1d67aa3bb2fb09a5bd35c641f86f2b5ed06f fuse-3.17.2.tar.gz" | sha256sum -c - +tar xf fuse-3.*.tar.gz pushd fuse-3*/ patch -p1 < "$this_dir"/../../patches/libfuse/mount.c.diff mkdir build cd build meson setup --prefix=/usr .. -meson configure --default-library static +meson configure -Dexamples=false --default-library static ninja -v install popd # Minimize binary size export CFLAGS="-ffunction-sections -fdata-sections -Os" -wget "https://github.com/vasi/squashfuse/archive/0.5.2.tar.gz" -echo "db0238c5981dabbd80ee09ae15387f390091668ca060a7bc38047912491443d3 0.5.2.tar.gz" | sha256sum -c - -tar xf 0.5.2.tar.gz +wget "https://github.com/vasi/squashfuse/releases/download/0.6.1/squashfuse-0.6.1.tar.gz" +echo "7b18a58c40a3161b5c329ae925b72336b5316941f906b446b8ed6c5a90989f8c squashfuse-0.6.1.tar.gz" | sha256sum -c - +tar xf squashfuse-*.tar.gz pushd squashfuse-*/ -./autogen.sh ./configure LDFLAGS="-static" make -j"$(nproc)" make install