aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/source/system/vfs/mount-binfmt_misc/up
blob: 39a1ae29a809c16433f1f1f6c05a8a2e9737ec60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!@shebangdir@/execlineb -P

# ISC license.
# https://docs.kernel.org/admin-guide/binfmt-misc.html

fdmove -c 2 1

multisubstitute {
	define BINFMT_FS "/proc/sys/fs/binfmt_misc"
	define BINFMT_CONF "/etc/binfmt.d"
}

if { eltest -d ${BINFMT_FS} }
if { mount -t binfmt_misc binfmt_misc ${BINFMT_FS} }

pipeline {
	elglob -0sd '' FILES ${BINFMT_CONF}/*
	if -x0 { eltest ${FILES} }
	define -sd '' SPLITFILES ${FILES}
	cat ${SPLITFILES}
}
pipeline {
	sed
		-e "/^#/d"
		-e "s/^[[:blank:]]*//g"
		-e "s/[[:blank:]]*$//g"
		-e "/^$/d"
}
forstdin -pE LINE
	if -x0 -n { redirfd -w 1 ${BINFMT_FS}/register echo ${LINE} }
	pipeline { echo ${LINE} }
	pipeline {
		sed
			-e s/://
			-e s/:.*//
	}
	withstdinas -E TORESET
	if { redirfd -w 1 ${BINFMT_FS}/${TORESET} echo -1 }
	redirfd -w 1 ${BINFMT_FS}/register echo ${LINE}