~alpine/aports

main/openrc: mount firmware from modloop to /lib v1 PROPOSED

Mark White: 1
 main/openrc: mount firmware from modloop to /lib

 3 files changed, 42 insertions(+), 18 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/2385/mbox | git am -3
Learn more about email & git

[alpine-aports] [PATCH] main/openrc: mount firmware from modloop to /lib Export this patch

Uses overlayfs if available, or a symlink if not. But to preserve
existing behaviour, if overlayfs isn't available and if both modloop
and $alpine_mnt contain firmware, a merged copy is made instead.

fixes #5146
---
The logic is that that any firmware files from $alpine_mnt always
overlay/replace files from modloop: I think this is the behaviour we
would expect, but happy to be corrected if not.

 main/openrc/APKBUILD      | 14 +++++++-------
 main/openrc/modloop.confd |  5 +++--
 main/openrc/modloop.initd | 41 ++++++++++++++++++++++++++++++++---------
 3 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/main/openrc/APKBUILD b/main/openrc/APKBUILD
index 2ab7097..4e99b4a 100644
--- a/main/openrc/APKBUILD
+++ b/main/openrc/APKBUILD
@@ -2,7 +2,7 @@
pkgname=openrc
pkgver=0.20.4
_ver=${pkgver/_git*/}
pkgrel=0
pkgrel=1
pkgdesc="OpenRC manages the services, startup and shutdown of a host"
url="http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git"
arch="all"
@@ -90,9 +90,9 @@ d83df5513f08f09fa9e7353327701bf7  openrc.logrotate
887eba592d487d6ffe2b42cfcd2813df  hwdrivers.initd
41974f5408fd2e92892f891b58f2e49f  keymaps.initd
0ece77eff8f163b36f6f0e7a6d422866  modules.initd
91439e5e7cbf4bb4c9860e60694da168  modloop.initd
af100768ea2fdf771705f12f0c64756a  modloop.initd
27c22aa4e5cdba499ac9a0b6b9385f7d  networking.initd
c1ec888202d868710b5749f7b217d1e3  modloop.confd
5d76f5a7b3dd884aaff4a1db140971b6  modloop.confd
bd51c5353d6dbbb34d929bf59097b232  consolefont.initd
1c629807d282ca1dc73ffe55c29146ef  consolefont.confd"
sha256sums="162018f2cba6d8df74daeca40522ce716370d67f19b8592d4beaa2df5435cee3  openrc-0.20.4.tar.gz
@@ -109,9 +109,9 @@ dda515d7d906cebcf4137746939f3fdccc7f504fe097ef1dbf429e3e6773a013  hostname.initd
6cb4d9ea3ad562bcf2697f61f5a76a10481d23f5dead570f82eff576eaca5236  hwdrivers.initd
32562d39ade4092df8163c2e8cf0b31eeec06aa5713d343e1c487bfa6d9f7c84  keymaps.initd
a145636e84547d76b8a188a94c0a76fcc266cd0f486be6cf24d2d74f03038118  modules.initd
e92994dfd5ad6b099eca7627e36dbbe1107c5862b46722c1e1e1b13d10276b60  modloop.initd
22c634aaab7e3c79a5b8d0b19a2b4a40dae5616d67a5eb2091e05e3af0e0d666  modloop.initd
66151b5cc199485ddd188528a0f22f081994721f04c15b33df38f41a5d08ea78  networking.initd
a5a0316cd59f5401b1d789bb466c98186201277ba6f014017b14965fcc10c254  modloop.confd
a8da5bfbb04528878a1c698acb32e021ced348dded546bd3f1e02e72a98b71fe  modloop.confd
8a3f663e9ac14f62c3aef4121736a71edd676bdc9dd93c1d411f13a0e7ab4ee6  consolefont.initd
9010b94892280f0bb42be39c0e989a70439eb97cbfe2a7a41a32df9a3035b8c2  consolefont.confd"
sha512sums="722d26f5235ff8ecff4dd9647b69e9058e5c228d8423c71ef3690aef1200bac11e5b02741752101c1c35c8aa7261a502392d3fd1448c068ef61cdf0c47015029  openrc-0.20.4.tar.gz
@@ -128,8 +128,8 @@ a3c2f419a3d475519cc8f78bd3baa26cae90a492a5fc92308b18931889db10452aa33324cca84890
b51d95df7b692aaea3e14ed009d99b46b82500d505e2eeecb6a20136cee140aea4a7377a65ccc5c51fff64be7a50666be48616d179888eaeff9d35178a7a772b  hwdrivers.initd
584ecbbcecb284527d7616790b6e337ace610e4b3cedf2993eca294bfbef54674aeaee3078b6c17d746a0c48b5a64a813c3534136915947e6f62a6fa206cd3ca  keymaps.initd
7702e2704e4bcfad7c0736eec4cb0e8b20a685851afb5bd9022c5056ea78b8598a9402bae9644ae3268e2ff1c566e147cbb8d00e143491841682e4125fde2a75  modules.initd
c4de2292b5a175f082f4f80de5145746e4d97481fccb1d22f3a637e46c7c986ad4cd363cb1096312a4e338ce19c2bb4928d819a47e21a149fc36dba3b6dc1727  modloop.initd
24b3589851a467f2db05dd18fd1d2780070272d2d168ea6986e8fc3cb471ff2cfcd612030ce9ca44cc04c95c3ce61009c818794233410074691e79191803ced5  modloop.initd
9aeba2c5cae539f16185b82c6e6e84c1b044e838749b92e8994172296d86ec3f1c674d62d54db1e08a8191e513ddb0ab3509f50ccae6cb5d7ba5ff5a5b6abb46  networking.initd
aa702a7da8e6c0e5d8738febaf6b4e4cb021b30ce5c1809b530abf2b36739079446b16fc054740da8d86ed099942cf5deed6597cedb64c058f3def587a8b4689  modloop.confd
8ebbc4c2dfb013ca0dc1aebac88989356b8dd219242b2c1f5e2b625b0813fec03ce5b50f3182aa7830f2ffb050208c8a218c5b9d660de4dd1edc4947a09cf177  modloop.confd
c8d52d69692a00862cd55719174d7a260d5149f4951dd71196f5e9cebce3a75420a8815f0fe8b186d00b4d46739dc54542dae01a941605fcb1435f4385e444b7  consolefont.initd
260fb9500cf59ad00006086b80d463b5557c4779eb6683966a570471d302ec00325acedabf542a70f7f4bda7b5d813b51128b46d75e0c01f78223c68b3c75260  consolefont.confd"
diff --git a/main/openrc/modloop.confd b/main/openrc/modloop.confd
index de4cbb6..baaf50b 100644
--- a/main/openrc/modloop.confd
+++ b/main/openrc/modloop.confd
@@ -1,3 +1,4 @@
# enable loadable module support when running from RAM
# when unionfs support is available in the kernel
# make /lib/modules and /lib/firmware writable when running from RAM
# if overlayfs support is available in the kernel
# (you may need to add modules=overlay,... to the kernel command line)
unionfs_size="32M"
diff --git a/main/openrc/modloop.initd b/main/openrc/modloop.initd
index 392569a..c5998b5 100644
--- a/main/openrc/modloop.initd
+++ b/main/openrc/modloop.initd
@@ -86,24 +86,47 @@ start() {
		fi
	fi

	#use overlayfs if available and configured
	# use overlayfs if available and configured
	mkdir -p /lib/modules /lib/firmware
	if grep -q -w "overlay$" /proc/filesystems && [ -n "$unionfs_size" ]; then
		ebegin "OverlayFS detected, mounting modloop rw"
		mkdir -p /.modunisonfs /lib/modules
		mount -t tmpfs -o size="$unionfs_size" tmpfs /.modunisonfs
		mkdir -p /.modunisonfs/modules /.modunisonfs/work
		mount -t overlay -o upperdir=/.modunisonfs/modules,lowerdir=/.modloop/modules,workdir=/.modunisonfs/work overlay /lib/modules
		ebegin "Mounting modules rw with overlayfs"
		mkdir -p /.modoverlay
		mount -t tmpfs -o size="$unionfs_size" tmpfs /.modoverlay
		mkdir -p /.modoverlay/modules /.modoverlay/modules-work
		mount -t overlay -o upperdir=/.modoverlay/modules \
			-o lowerdir=/.modloop/modules \
			-o workdir=/.modoverlay/modules-work overlay /lib/modules
		eend $? || return 1

		if [ -d /.modloop/firmware ]; then
			ebegin "Mounting firmware rw with overlayfs"
			mkdir -p /.modoverlay/firmware /.modoverlay/firmware-work
			mount -t overlay -o upperdir=/.modoverlay/firmware \
				-o lowerdir=/.modloop/firmware \
				-o workdir=/.modoverlay/firmware-work overlay /lib/firmware
			eend $? || return 1
		fi
	else
		rm -rf /lib/modules && ln -sf /.modloop/modules /lib/

		if [ -d /.modloop/firmware ]; then
			if [ -d $alpine_mnt/firmware ]; then
				cp -R -a /.modloop/firmware /lib/
			else
				rm -rf /lib/firmware && ln -sf /.modloop/firmware /lib/
			fi
		fi
	fi

	# copy firmware if there are any
	# copy additional firmware if there are any
	if [ -d $alpine_mnt/firmware ]; then
	        ebegin "Copying firmware from $alpine_mnt/firmware"
	        cp -R -a $alpine_mnt/firmware /lib/
	        eend $?
	elif  [ -d /lib/modules/firmware ]; then
		eend $?
	fi

	# if /lib/firmware still empty dir, try symlink to /lib/modules/firmware
	if  [ -d /lib/modules/firmware ]; then
		rmdir /lib/firmware 2>/dev/null \
			&& ln -s /lib/modules/firmware /lib/
	fi
-- 
2.7.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---