diff options
author | Tom Gundersen <teg@jklm.no> | 2012-03-13 15:50:34 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2012-03-13 15:50:34 +0100 |
commit | b49cc7be1be791318f57d2941999368ae58636b7 (patch) | |
tree | 43393eacaa669a4ff09eff9d1fd867c1c089cec1 /arch-binfmt | |
parent | cb18be3f401a2c693d66a9417e479ed74e17c2f0 (diff) | |
parent | 9f75591c8a56ba7ec1ea20cfe16dd10a83c65503 (diff) | |
download | initscripts-b49cc7be1be791318f57d2941999368ae58636b7.tar.xz |
Merge remote-tracking branch 'seblu/master'
Conflicts:
Makefile
Diffstat (limited to 'arch-binfmt')
-rwxr-xr-x | arch-binfmt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch-binfmt b/arch-binfmt new file mode 100755 index 0000000..6931843 --- /dev/null +++ b/arch-binfmt @@ -0,0 +1,36 @@ +#!/bin/bash +# +# /usr/lib/initscripts/arch-binfmt +# +# Configure additional binary formats at boot +# + +shopt -s nullglob + +declare -a binfmt_d=( + /usr/lib/binfmt.d/*.conf + /etc/binfmt.d/*.conf + /run/binfmt.d/*.conf +) +declare -A fragments + +# check binfmt_misc filesystem is mounted +mountpoint -q /proc/sys/fs/binfmt_misc || + { echo "/proc/sys/fs/binfmt_misc is not mounted"; exit 1;} + +# files declared later in the sysctl_d array will override earlier +# Example: `/etc/sysctl.d/foo.conf' supersedes `/usr/lib/sysctl.d/foo.conf'. +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: |