blob: 91468ef73b73a968e63f19f46550b68298c0f1e2 (
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
40
41
42
43
44
45
|
#!/bin/bash
#
# /usr/lib/initscripts/arch-binfmt
#
# Configure additional binary formats at boot
#
shopt -s nullglob
declare -a binfmt_d
# files given has argv supersede config files
if (( $# > 0 )); then
for arg; do [[ -r "$arg" ]] && binfmt_d+=("$arg"); done
else
binfmt_d=(
/usr/lib/binfmt.d/*.conf
/etc/binfmt.d/*.conf
/run/binfmt.d/*.conf
)
fi
# check there is file to load
(( ${#binfmt_d[@]} > 0 )) || exit 1
# mount binfmt_misc if api filesystem is missing
mountpoint -q /proc/sys/fs/binfmt_misc ||
mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc
# files declared later in the binfmt_d array will override earlier
# Example: `/etc/binfmt.d/foo.conf' supersedes `/usr/lib/binfmt.d/foo.conf'.
declare -A fragments
for path in "${binfmt_d[@]}"; do
[[ -f $path ]] && fragments[${path##*/}]=$path
done
for path in "${fragments[@]}"; do
while read -r line; do
[[ ${line:0:1} == '#' ]] && continue
printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register
done < "$path"
done
:
# vim: set ts=2 sw=2 noet:
|