| 1 |
#!/bin/sh |
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: mount-configfs |
| 4 |
# Required-Start: mountkernfs |
| 5 |
# Required-Stop: |
| 6 |
# Should-Start: kmod |
| 7 |
# Default-Start: S |
| 8 |
# Default-Stop: |
| 9 |
# Short-Description: Mount configfs kernel virtual file system. |
| 10 |
# Description: Mount configfs kernel virtual file system, |
| 11 |
# if "configfs" module is loaded. |
| 12 |
### END INIT INFO |
| 13 |
set -eu |
| 14 |
|
| 15 |
export PATH=/usr/bin:/bin |
| 16 |
|
| 17 |
case ${1:-missing} in |
| 18 |
start | restart | force-reload) |
| 19 |
readonly mountpoint='/sys/kernel/config' |
| 20 |
# This directory exists only if "configfs" module was loaded by "kmod" |
| 21 |
# script. |
| 22 |
[ -d "${mountpoint}" ] || exit 0 |
| 23 |
! findmnt "${mountpoint}" >/dev/null || exit 0 |
| 24 |
|
| 25 |
mount none -t configfs "${mountpoint}" |
| 26 |
;; |
| 27 |
stop) |
| 28 |
# No-op |
| 29 |
;; |
| 30 |
*) |
| 31 |
echo "Usage: mount-configfs [start|stop]" >&2 |
| 32 |
exit 3 |
| 33 |
;; |
| 34 |
esac |