View | Details | Raw Unified | Return to bug 238735
Collapse All | Expand All

(-)libexec/rc/rc.d/Makefile (+1 lines)
Lines 16-21 Link Here
16
	adjkerntz \
16
	adjkerntz \
17
	archdep \
17
	archdep \
18
	bgfsck \
18
	bgfsck \
19
	binmisc \
19
	${_blacklistd} \
20
	${_blacklistd} \
20
	${_bluetooth} \
21
	${_bluetooth} \
21
	bridge \
22
	bridge \
(-)libexec/rc/rc.d/binmisc (+60 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# PROVIDE: binmisc
4
# REQUIRE: LOGIN
5
# KEYWORD: shutdown
6
7
. /etc/rc.subr
8
9
name="binmisc"
10
desc="Load binmisc rules"
11
rcvar="binmisc_enable"
12
binmiscctl_program="/usr/sbin/binmiscctl"
13
start_cmd="binmisc_start"
14
stop_cmd="binmisc_stop"
15
status_cmd="binmisc_status"
16
17
# To enable 'status'
18
procname="${binmiscctl_program}"
19
20
binmisc_start() {
21
	local name magic size mask offset _i
22
	for name in ${binmisc_names}; do
23
		eval "magic=\"\${binmisc_${name}_magic}\""
24
		eval "size=\"\${binmisc_${name}_size}\""
25
		eval "mask=\"\${binmisc_${name}_mask}\""
26
		eval "interpreter=\"\${binmisc_${name}_interpreter}\""
27
		eval "offset=\"\${binmisc_${name}_offset:-0}\""
28
		if [ -z "${mask}" ]; then
29
			# It currently doesn't work without a '--mask'
30
			_i=0
31
			while [ ${_i} -lt ${size} ]; do
32
				mask="\\xff${mask}"
33
				_i=$((_i+1))
34
			done
35
		fi
36
		${binmiscctl_program} add ${name} --magic "${magic}" --size "${size}" --mask "${mask}" --interpreter "${interpreter}" --offset "${offset}" --set-enabled
37
	done
38
}
39
40
binmisc_stop() {
41
	for name in ${binmisc_names}; do
42
		${binmiscctl_program} remove ${name}
43
	done
44
	kldstat -q -n imgact_binmisc.ko && kldunload imgact_binmisc.ko
45
}
46
47
binmisc_status() {
48
	if ! kldstat -q -m imgact_binmisc; then
49
		echo "Kernel module imgact_binmisc not loaded" 1>&2
50
		return 1
51
	fi
52
	${binmiscctl_program} list
53
}
54
55
56
load_rc_config ${name}
57
58
: ${binmisc_enable="NO"}
59
60
run_rc_command "$1"

Return to bug 238735