All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package
@ 2021-05-16  1:05 Christian Stewart
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 2/3] package/fuse-overlayfs: enable building as " Christian Stewart
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Christian Stewart @ 2021-05-16  1:05 UTC (permalink / raw)
  To: buildroot

Adds 1 patch to fix an install error when building as a host package.

Patch was submitted upstream:
https://github.com/libfuse/libfuse/pull/598

Signed-off-by: Christian Stewart <christian@paral.in>

---

v1 -> v2:

 - adjusted patch to completely remove init.d script install

Signed-off-by: Christian Stewart <christian@paral.in>
---
 ...remove-installation-of-init.d-script.patch | 48 +++++++++++++++++++
 package/libfuse3/libfuse3.mk                  |  7 +++
 2 files changed, 55 insertions(+)
 create mode 100644 package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch

diff --git a/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
new file mode 100644
index 0000000000..5df6f3690c
--- /dev/null
+++ b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
@@ -0,0 +1,48 @@
+From b3d28b5aa5887162847a85738450e8c719ee8523 Mon Sep 17 00:00:00 2001
+From: Christian Stewart <christian@paral.in>
+Date: Sun, 2 May 2021 19:04:50 -0700
+Subject: [PATCH] install_helper: remove installation of init.d script
+
+Fixes the following build error in Buildroot as a host package:
+
+Running custom install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false
++ sysconfdir=/host/etc
++ bindir=/host/bin
++ udevrulesdir=/host/lib/udev/rules.d
++ useroot=false
++ '[' -z '' ']'
++ DESTDIR=
++ install -D -m 644 /build/host-libfuse3-3.10.3/util/fuse.conf /host/etc/fuse.conf
++ false
++ install -D -m 644 /build/host-libfuse3-3.10.3/util/udev.rules /host/lib/udev/rules.d/99-fuse3.rules
++ install -D -m 755 /build/host-libfuse3-3.10.3/util/init_script /etc/init.d/fuse3
+install: cannot create regular file '/etc/init.d/fuse3': Permission denied
+FAILED: install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false' exit code 1, stopped
+FAILED: meson-install
+
+Signed-off-by: Christian Stewart <christian@paral.in>
+
+diff --git a/util/install_helper.sh b/util/install_helper.sh
+index cb649a7..f2fa146 100755
+--- a/util/install_helper.sh
++++ b/util/install_helper.sh
+@@ -38,16 +38,3 @@ fi
+ 
+ install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
+         "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
+-
+-install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
+-        "${DESTDIR}/etc/init.d/fuse3"
+-
+-
+-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"
+-fi
+-
+-
+-- 
+2.31.1
+
diff --git a/package/libfuse3/libfuse3.mk b/package/libfuse3/libfuse3.mk
index d61e313391..b29780dc09 100644
--- a/package/libfuse3/libfuse3.mk
+++ b/package/libfuse3/libfuse3.mk
@@ -10,11 +10,17 @@ LIBFUSE3_LICENSE = LGPL-2.1
 LIBFUSE3_LICENSE_FILES = LICENSE
 LIBFUSE3_INSTALL_STAGING = YES
 LIBFUSE3_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
+
 LIBFUSE3_CONF_OPTS = \
 	-Dexamples=false \
 	-Dudevrulesdir=/lib/udev/rules.d \
 	-Duseroot=false
 
+HOST_LIBFUSE3_CONF_OPTS = \
+	-Dexamples=false \
+	-Dudevrulesdir=$(HOST_DIR)/lib/udev/rules.d \
+	-Duseroot=false
+
 define LIBFUSE3_DEVICES
 	/dev/fuse  c  666  0  0  10  229  0  0  -
 endef
@@ -28,3 +34,4 @@ define LIBFUSE3_LINUX_CONFIG_FIXUPS
 endef
 
 $(eval $(meson-package))
+$(eval $(host-meson-package))
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/fuse-overlayfs: enable building as host package
  2021-05-16  1:05 [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Christian Stewart
@ 2021-05-16  1:05 ` Christian Stewart
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package Christian Stewart
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Christian Stewart @ 2021-05-16  1:05 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/Config.in.host                   | 1 +
 package/fuse-overlayfs/Config.in.host    | 7 +++++++
 package/fuse-overlayfs/fuse-overlayfs.mk | 4 ++++
 3 files changed, 12 insertions(+)
 create mode 100644 package/fuse-overlayfs/Config.in.host

diff --git a/package/Config.in.host b/package/Config.in.host
index 064c98af3d..90a6afdf4f 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -27,6 +27,7 @@ menu "Host utilities"
 	source "package/f2fs-tools/Config.in.host"
 	source "package/faketime/Config.in.host"
 	source "package/fatcat/Config.in.host"
+	source "package/fuse-overlayfs/Config.in.host"
 	source "package/fwup/Config.in.host"
 	source "package/genext2fs/Config.in.host"
 	source "package/genimage/Config.in.host"
diff --git a/package/fuse-overlayfs/Config.in.host b/package/fuse-overlayfs/Config.in.host
new file mode 100644
index 0000000000..cf459a4a2a
--- /dev/null
+++ b/package/fuse-overlayfs/Config.in.host
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_FUSE_OVERLAYFS
+	bool "host fuse-overlayfs"
+	help
+	  FUSE-overlayfs is an implementation of overlay+shiftfs in
+	  FUSE, intended to be used for rootless containers.
+
+	  http://github.com/containers/fuse-overlayfs
\ No newline at end of file
diff --git a/package/fuse-overlayfs/fuse-overlayfs.mk b/package/fuse-overlayfs/fuse-overlayfs.mk
index 707cacce03..36cbfc91fd 100644
--- a/package/fuse-overlayfs/fuse-overlayfs.mk
+++ b/package/fuse-overlayfs/fuse-overlayfs.mk
@@ -12,4 +12,8 @@ FUSE_OVERLAYFS_LICENSE_FILES = COPYING
 FUSE_OVERLAYFS_AUTORECONF = YES
 FUSE_OVERLAYFS_DEPENDENCIES = libfuse3 host-pkgconf
 
+HOST_FUSE_OVERLAYFS_AUTORECONF = YES
+HOST_FUSE_OVERLAYFS_DEPENDENCIES = host-libfuse3 host-pkgconf
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package
  2021-05-16  1:05 [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Christian Stewart
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 2/3] package/fuse-overlayfs: enable building as " Christian Stewart
@ 2021-05-16  1:05 ` Christian Stewart
  2021-05-18  8:44   ` Yann E. MORIN
  2021-05-18  8:19 ` [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Yann E. MORIN
  2021-05-18  8:30 ` Yann E. MORIN
  3 siblings, 1 reply; 7+ messages in thread
From: Christian Stewart @ 2021-05-16  1:05 UTC (permalink / raw)
  To: buildroot

Img is a standalone, daemon-less, unprivileged Dockerfile and OCI compatible
container image builder. It uses the moby-buildkit solver internally. The
commands/UX mirror the Docker CLI for workflow compatibility.

Using the genuinetools- prefix due to the generic nature of the "img" name.

Adds both host and target variants. fuse-overlayfs can be used as an
unprivileged and rootless overlay filesystem backend.

https://github.com/genuinetools/img

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/Config.in                             |  1 +
 package/Config.in.host                        |  1 +
 package/genuinetools-img/Config.in            | 23 ++++++++++++++++
 package/genuinetools-img/Config.in.host       |  9 +++++++
 .../genuinetools-img/genuinetools-img.hash    |  3 +++
 package/genuinetools-img/genuinetools-img.mk  | 27 +++++++++++++++++++
 6 files changed, 64 insertions(+)
 create mode 100644 package/genuinetools-img/Config.in
 create mode 100644 package/genuinetools-img/Config.in.host
 create mode 100644 package/genuinetools-img/genuinetools-img.hash
 create mode 100644 package/genuinetools-img/genuinetools-img.mk

diff --git a/package/Config.in b/package/Config.in
index 82b28d2835..62ac9d292c 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2443,6 +2443,7 @@ menu "System tools"
 	source "package/emlog/Config.in"
 	source "package/ftop/Config.in"
 	source "package/getent/Config.in"
+	source "package/genuinetools-img/Config.in"
 	source "package/gkrellm/Config.in"
 	source "package/htop/Config.in"
 	source "package/ibm-sw-tpm2/Config.in"
diff --git a/package/Config.in.host b/package/Config.in.host
index 90a6afdf4f..851ab401fd 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -32,6 +32,7 @@ menu "Host utilities"
 	source "package/genext2fs/Config.in.host"
 	source "package/genimage/Config.in.host"
 	source "package/genpart/Config.in.host"
+	source "package/genuinetools-img/Config.in.host"
 	source "package/gnupg/Config.in.host"
 	source "package/go/Config.in.host"
 	source "package/go-bootstrap/Config.in.host"
diff --git a/package/genuinetools-img/Config.in b/package/genuinetools-img/Config.in
new file mode 100644
index 0000000000..eb4992db07
--- /dev/null
+++ b/package/genuinetools-img/Config.in
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_GENUINETOOLS_IMG
+	bool "genuinetools-img"
+	depends on BR2_USE_MMU # fuse-overlayfs libfuse3
+	depends on !BR2_STATIC_LIBS # fuse-overlayfs libfuse3
+	depends on BR2_TOOLCHAIN_HAS_THREADS # fuse-overlayfs libfuse3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 # fuse-overlayfs
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC
+	select BR2_PACKAGE_CGROUPFS_MOUNT if !BR2_PACKAGE_SYSTEMD # runtime dependency
+	select BR2_PACKAGE_FUSE_OVERLAYFS # runtime dependency
+	select BR2_PACKAGE_LIBFUSE3 # fuse-overlayfs
+	help
+	  Img is a standalone, daemon-less, unprivileged Dockerfile
+	  and OCI compatible container image builder.
+
+	  https://github.com/genuinetools/img
+
+comment "genuinetools-img needs a toolchain w/ threads, dynamic library, headers >= 3.15"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
diff --git a/package/genuinetools-img/Config.in.host b/package/genuinetools-img/Config.in.host
new file mode 100644
index 0000000000..bbef88acf6
--- /dev/null
+++ b/package/genuinetools-img/Config.in.host
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_HOST_GENUINETOOLS_IMG
+	bool "host genuinetools-img"
+	depends on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_FUSE_OVERLAYFS # runtime dependency
+	help
+	  Img is a standalone, daemon-less, unprivileged Dockerfile
+	  and OCI compatible container image builder.
+
+	  https://github.com/genuinetools/img
diff --git a/package/genuinetools-img/genuinetools-img.hash b/package/genuinetools-img/genuinetools-img.hash
new file mode 100644
index 0000000000..097ad17d91
--- /dev/null
+++ b/package/genuinetools-img/genuinetools-img.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  c6d805ab899db639fa08f0e33fe6673593be8336d288bb1cb4cb81a3229a916f  genuinetools-img-0.5.11.tar.gz
+sha256	c696614021eafe355c7fb0af3e724fc7fa8729a0c10c27cbed2505bf30a853ce  LICENSE
diff --git a/package/genuinetools-img/genuinetools-img.mk b/package/genuinetools-img/genuinetools-img.mk
new file mode 100644
index 0000000000..08330d1113
--- /dev/null
+++ b/package/genuinetools-img/genuinetools-img.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# genuinetools-img
+#
+################################################################################
+
+GENUINETOOLS_IMG_VERSION = 0.5.11
+GENUINETOOLS_IMG_SITE = $(call github,genuinetools,img,v$(GENUINETOOLS_IMG_VERSION))
+
+GENUINETOOLS_IMG_LICENSE = MIT
+GENUINETOOLS_IMG_LICENSE_FILES = LICENSE
+
+GENUINETOOLS_IMG_DEPENDENCIES = host-pkgconf
+GENUINETOOLS_IMG_GOMOD = github.com/genuinetools/img
+
+GENUINETOOLS_IMG_TAGS = cgo noembed
+GENUINETOOLS_IMG_LDFLAGS = \
+	-X $(GENUINETOOLS_IMG_GOMOD)/version.VERSION="$(GENUINETOOLS_IMG_VERSION)"
+
+HOST_GENUINETOOLS_IMG_TAGS = $(GENUINETOOLS_IMG_TAGS)
+HOST_GENUINETOOLS_IMG_LDFLAGS = $(GENUINETOOLS_IMG_LDFLAGS)
+
+HOST_GENUINETOOLS_IMG_BIN_NAME = genuinetools-img
+HOST_GENUINETOOLS_IMG_INSTALL_BINS = $(HOST_GENUINETOOLS_IMG_BIN_NAME)
+
+$(eval $(golang-package))
+$(eval $(host-golang-package))
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package
  2021-05-16  1:05 [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Christian Stewart
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 2/3] package/fuse-overlayfs: enable building as " Christian Stewart
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package Christian Stewart
@ 2021-05-18  8:19 ` Yann E. MORIN
  2021-05-18  8:30 ` Yann E. MORIN
  3 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2021-05-18  8:19 UTC (permalink / raw)
  To: buildroot

Christian, All,

On 2021-05-15 18:05 -0700, Christian Stewart spake thusly:
> Adds 1 patch to fix an install error when building as a host package.
> 
> Patch was submitted upstream:
> https://github.com/libfuse/libfuse/pull/598

Sigh, that's sick...

> Signed-off-by: Christian Stewart <christian@paral.in>
> 
> ---
> v1 -> v2:
>  - adjusted patch to completely remove init.d script install

Although I understand the reasoning for the host variant, that means the
target variant will no longer install that init script either.

That init script does two things:

  - load the fuse module if not already done: that's not a problem for
    Buildroot, because lbfuse3.mk enfirces FUSE to be built-in to the
    kernel,

  - mount the fusectl mountpoint: this is not strictly required for most
    usage of FUSE, but will be missing for some.

But this init script is very tailored for classical distros, and does
not fit nicely in our case. Also, there is no corresponding systemd or
openrc unit, so that means the fusectl is not automatically mounted with
BR2_INIT_SYSTEMD=y or BR2_INIT_OPENRC=y already...

So, I think we should just carry this patch. Having an init script, an
openrc, and a systemd unit, that do the fusectl mount, would be nice.

Could you please rework this patch to at least provide the init script,
so that there is no regression (openrc and systemd units can come
separately since they do not currently exist)?

Regards,
Yann E. MORIN.

> Signed-off-by: Christian Stewart <christian@paral.in>
> ---
>  ...remove-installation-of-init.d-script.patch | 48 +++++++++++++++++++
>  package/libfuse3/libfuse3.mk                  |  7 +++
>  2 files changed, 55 insertions(+)
>  create mode 100644 package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> 
> diff --git a/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> new file mode 100644
> index 0000000000..5df6f3690c
> --- /dev/null
> +++ b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> @@ -0,0 +1,48 @@
> +From b3d28b5aa5887162847a85738450e8c719ee8523 Mon Sep 17 00:00:00 2001
> +From: Christian Stewart <christian@paral.in>
> +Date: Sun, 2 May 2021 19:04:50 -0700
> +Subject: [PATCH] install_helper: remove installation of init.d script
> +
> +Fixes the following build error in Buildroot as a host package:
> +
> +Running custom install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false
> ++ sysconfdir=/host/etc
> ++ bindir=/host/bin
> ++ udevrulesdir=/host/lib/udev/rules.d
> ++ useroot=false
> ++ '[' -z '' ']'
> ++ DESTDIR=
> ++ install -D -m 644 /build/host-libfuse3-3.10.3/util/fuse.conf /host/etc/fuse.conf
> ++ false
> ++ install -D -m 644 /build/host-libfuse3-3.10.3/util/udev.rules /host/lib/udev/rules.d/99-fuse3.rules
> ++ install -D -m 755 /build/host-libfuse3-3.10.3/util/init_script /etc/init.d/fuse3
> +install: cannot create regular file '/etc/init.d/fuse3': Permission denied
> +FAILED: install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false' exit code 1, stopped
> +FAILED: meson-install
> +
> +Signed-off-by: Christian Stewart <christian@paral.in>
> +
> +diff --git a/util/install_helper.sh b/util/install_helper.sh
> +index cb649a7..f2fa146 100755
> +--- a/util/install_helper.sh
> ++++ b/util/install_helper.sh
> +@@ -38,16 +38,3 @@ fi
> + 
> + install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
> +         "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
> +-
> +-install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
> +-        "${DESTDIR}/etc/init.d/fuse3"
> +-
> +-
> +-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"
> +-fi
> +-
> +-
> +-- 
> +2.31.1
> +
> diff --git a/package/libfuse3/libfuse3.mk b/package/libfuse3/libfuse3.mk
> index d61e313391..b29780dc09 100644
> --- a/package/libfuse3/libfuse3.mk
> +++ b/package/libfuse3/libfuse3.mk
> @@ -10,11 +10,17 @@ LIBFUSE3_LICENSE = LGPL-2.1
>  LIBFUSE3_LICENSE_FILES = LICENSE
>  LIBFUSE3_INSTALL_STAGING = YES
>  LIBFUSE3_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
> +
>  LIBFUSE3_CONF_OPTS = \
>  	-Dexamples=false \
>  	-Dudevrulesdir=/lib/udev/rules.d \
>  	-Duseroot=false
>  
> +HOST_LIBFUSE3_CONF_OPTS = \
> +	-Dexamples=false \
> +	-Dudevrulesdir=$(HOST_DIR)/lib/udev/rules.d \
> +	-Duseroot=false
> +
>  define LIBFUSE3_DEVICES
>  	/dev/fuse  c  666  0  0  10  229  0  0  -
>  endef
> @@ -28,3 +34,4 @@ define LIBFUSE3_LINUX_CONFIG_FIXUPS
>  endef
>  
>  $(eval $(meson-package))
> +$(eval $(host-meson-package))
> -- 
> 2.31.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package
  2021-05-16  1:05 [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Christian Stewart
                   ` (2 preceding siblings ...)
  2021-05-18  8:19 ` [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Yann E. MORIN
@ 2021-05-18  8:30 ` Yann E. MORIN
  2021-05-18  9:58   ` Christian Stewart
  3 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2021-05-18  8:30 UTC (permalink / raw)
  To: buildroot

Christian, All,

On 2021-05-15 18:05 -0700, Christian Stewart spake thusly:
> Adds 1 patch to fix an install error when building as a host package.

Forgot to state in my previous review: of course, this will require that
the build machine is configured to allow the user doing the build is
allowed to use FUSE, i.e. that it is allowed access to /dev/fuse.

This is not currently something we ensure, because we do not use FUSE as
part of the build.

I wonder if we should add a check and nicely inform the user, or let the
build later fail when fuse-overlayfs (or genuinetools-img) fails to do
the mount... Maybe just the following:

    define HOST_GENUINETOOLS_IMG_CHECK_ACCESS
        $(Q)if [ ! -w /dev/fuse ]; then \
            printf 'Your user is not allowed to access /dev/fuse\n' >&2; \
            exit 1; \
        fi
    endef
    HOST_GENUINETOOLS_IMG_PRE_CONFIGURE_HOOKS += HOST_GENUINETOOLS_IMG_CHECK_ACCESS

Thoughts?

Regards,
Yann E. MORIN.

> Patch was submitted upstream:
> https://github.com/libfuse/libfuse/pull/598
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
> 
> ---
> 
> v1 -> v2:
> 
>  - adjusted patch to completely remove init.d script install
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
> ---
>  ...remove-installation-of-init.d-script.patch | 48 +++++++++++++++++++
>  package/libfuse3/libfuse3.mk                  |  7 +++
>  2 files changed, 55 insertions(+)
>  create mode 100644 package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> 
> diff --git a/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> new file mode 100644
> index 0000000000..5df6f3690c
> --- /dev/null
> +++ b/package/libfuse3/0001-install_helper-remove-installation-of-init.d-script.patch
> @@ -0,0 +1,48 @@
> +From b3d28b5aa5887162847a85738450e8c719ee8523 Mon Sep 17 00:00:00 2001
> +From: Christian Stewart <christian@paral.in>
> +Date: Sun, 2 May 2021 19:04:50 -0700
> +Subject: [PATCH] install_helper: remove installation of init.d script
> +
> +Fixes the following build error in Buildroot as a host package:
> +
> +Running custom install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false
> ++ sysconfdir=/host/etc
> ++ bindir=/host/bin
> ++ udevrulesdir=/host/lib/udev/rules.d
> ++ useroot=false
> ++ '[' -z '' ']'
> ++ DESTDIR=
> ++ install -D -m 644 /build/host-libfuse3-3.10.3/util/fuse.conf /host/etc/fuse.conf
> ++ false
> ++ install -D -m 644 /build/host-libfuse3-3.10.3/util/udev.rules /host/lib/udev/rules.d/99-fuse3.rules
> ++ install -D -m 755 /build/host-libfuse3-3.10.3/util/init_script /etc/init.d/fuse3
> +install: cannot create regular file '/etc/init.d/fuse3': Permission denied
> +FAILED: install script 'install_helper.sh /host/etc /host/bin /host/lib/udev/rules.d false' exit code 1, stopped
> +FAILED: meson-install
> +
> +Signed-off-by: Christian Stewart <christian@paral.in>
> +
> +diff --git a/util/install_helper.sh b/util/install_helper.sh
> +index cb649a7..f2fa146 100755
> +--- a/util/install_helper.sh
> ++++ b/util/install_helper.sh
> +@@ -38,16 +38,3 @@ fi
> + 
> + install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
> +         "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
> +-
> +-install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
> +-        "${DESTDIR}/etc/init.d/fuse3"
> +-
> +-
> +-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"
> +-fi
> +-
> +-
> +-- 
> +2.31.1
> +
> diff --git a/package/libfuse3/libfuse3.mk b/package/libfuse3/libfuse3.mk
> index d61e313391..b29780dc09 100644
> --- a/package/libfuse3/libfuse3.mk
> +++ b/package/libfuse3/libfuse3.mk
> @@ -10,11 +10,17 @@ LIBFUSE3_LICENSE = LGPL-2.1
>  LIBFUSE3_LICENSE_FILES = LICENSE
>  LIBFUSE3_INSTALL_STAGING = YES
>  LIBFUSE3_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
> +
>  LIBFUSE3_CONF_OPTS = \
>  	-Dexamples=false \
>  	-Dudevrulesdir=/lib/udev/rules.d \
>  	-Duseroot=false
>  
> +HOST_LIBFUSE3_CONF_OPTS = \
> +	-Dexamples=false \
> +	-Dudevrulesdir=$(HOST_DIR)/lib/udev/rules.d \
> +	-Duseroot=false
> +
>  define LIBFUSE3_DEVICES
>  	/dev/fuse  c  666  0  0  10  229  0  0  -
>  endef
> @@ -28,3 +34,4 @@ define LIBFUSE3_LINUX_CONFIG_FIXUPS
>  endef
>  
>  $(eval $(meson-package))
> +$(eval $(host-meson-package))
> -- 
> 2.31.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package
  2021-05-16  1:05 ` [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package Christian Stewart
@ 2021-05-18  8:44   ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2021-05-18  8:44 UTC (permalink / raw)
  To: buildroot

Christian, All,

On 2021-05-15 18:05 -0700, Christian Stewart spake thusly:
> Img is a standalone, daemon-less, unprivileged Dockerfile and OCI compatible
> container image builder. It uses the moby-buildkit solver internally. The
> commands/UX mirror the Docker CLI for workflow compatibility.
> 
> Using the genuinetools- prefix due to the generic nature of the "img" name.
> 
> Adds both host and target variants. fuse-overlayfs can be used as an
> unprivileged and rootless overlay filesystem backend.
> 
> https://github.com/genuinetools/img
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
> ---
[--SNIP--]
> diff --git a/package/genuinetools-img/Config.in b/package/genuinetools-img/Config.in
> new file mode 100644
> index 0000000000..eb4992db07
> --- /dev/null
> +++ b/package/genuinetools-img/Config.in
> @@ -0,0 +1,23 @@
> +config BR2_PACKAGE_GENUINETOOLS_IMG
> +	bool "genuinetools-img"
> +	depends on BR2_USE_MMU # fuse-overlayfs libfuse3
> +	depends on !BR2_STATIC_LIBS # fuse-overlayfs libfuse3
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # fuse-overlayfs libfuse3
> +	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 # fuse-overlayfs
> +	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
> +	depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS

You forgot to add those two to the comment, below...

> +	depends on BR2_TOOLCHAIN_HAS_THREADS

Duplicate. ;-)

> +	depends on !BR2_TOOLCHAIN_USES_UCLIBC

... and this one too...

Also, keep arch-related dependencies first, then toolchain-related
dependencies, the package-related dependencies (with the comments):

    depends on BR2_USE_MMU
    depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
    depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
    depends on !BR2_STATIC_LIBS
    depends on BR2_TOOLCHAIN_HAS_THREADS
    depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15

> +	select BR2_PACKAGE_CGROUPFS_MOUNT if !BR2_PACKAGE_SYSTEMD # runtime dependency
> +	select BR2_PACKAGE_FUSE_OVERLAYFS # runtime dependency
> +	select BR2_PACKAGE_LIBFUSE3 # fuse-overlayfs
> +	help
> +	  Img is a standalone, daemon-less, unprivileged Dockerfile
> +	  and OCI compatible container image builder.
> +
> +	  https://github.com/genuinetools/img
> +
> +comment "genuinetools-img needs a toolchain w/ threads, dynamic library, headers >= 3.15"
> +	depends on BR2_USE_MMU
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
> +		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15

    comment "genuinetools-img needs a glibc or musl toolchain w/ ..."
        depends on BR2_USE_MMU
        depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
        depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
        depends on BR2_TOOLCHAIN_USES_UCLIB || !BR2_TOOLCHAIN_HAS_THREADS \
                || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15

[--SNIP--]

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package
  2021-05-18  8:30 ` Yann E. MORIN
@ 2021-05-18  9:58   ` Christian Stewart
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Stewart @ 2021-05-18  9:58 UTC (permalink / raw)
  To: buildroot

Hi Yann,

On Tue, May 18, 2021 at 1:30 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> I wonder if we should add a check and nicely inform the user, or let the
> build later fail when fuse-overlayfs (or genuinetools-img) fails to do
> the mount... Maybe just the following:
>
>     define HOST_GENUINETOOLS_IMG_CHECK_ACCESS
>         $(Q)if [ ! -w /dev/fuse ]; then \
>             printf 'Your user is not allowed to access /dev/fuse\n' >&2; \
>             exit 1; \
>         fi
>     endef
>     HOST_GENUINETOOLS_IMG_PRE_CONFIGURE_HOOKS += HOST_GENUINETOOLS_IMG_CHECK_ACCESS

I don't think it'd be best to fail the build on failure to access a
/dev/ path for a host package configure stage.

Probably better to let the build complete, and check before running
the tool instead.

The tool itself will fail when trying to execute it and fuse-overlayfs
does not work, so the access check is technically already there.

I'll look at adding the systemd unit and init.d script.

Best regards,
Christian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-18  9:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16  1:05 [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Christian Stewart
2021-05-16  1:05 ` [Buildroot] [PATCH v2 2/3] package/fuse-overlayfs: enable building as " Christian Stewart
2021-05-16  1:05 ` [Buildroot] [PATCH v2 3/3] package/genuinetools-img: new host and target package Christian Stewart
2021-05-18  8:44   ` Yann E. MORIN
2021-05-18  8:19 ` [Buildroot] [PATCH v2 1/3] package/libfuse3: allow building as a host package Yann E. MORIN
2021-05-18  8:30 ` Yann E. MORIN
2021-05-18  9:58   ` Christian Stewart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.