parent
90983b4fd2
commit
e4742ab0b5
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
is_livecd() {
|
||||
[ "${CDROOT}" = "1" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_nfs() {
|
||||
[ "${REAL_ROOT}" = "/dev/nfs" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_aufs() {
|
||||
[ "${USE_AUFS}" = "1" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
good_msg() {
|
||||
[ -n "${QUIET}" ] && [ -z "${DEBUG}" ] && return 0
|
||||
|
||||
msg_string=$1
|
||||
msg_string="${msg_string:-...}"
|
||||
[ "$2" != 1 ] && \
|
||||
echo -e "${GOOD}>>${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
|
||||
}
|
||||
|
||||
warn_msg() {
|
||||
msg_string=$1
|
||||
msg_string="${msg_string:-...}"
|
||||
[ "$2" != 1 ] && \
|
||||
echo -e "${WARN}**${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
|
||||
}
|
||||
|
||||
bad_msg() {
|
||||
msg_string=$1
|
||||
msg_string="${msg_string:-...}"
|
||||
if [ "$2" != 1 ]; then
|
||||
# TODO(lxnay): fix circular dep with 00-splash.sh
|
||||
splashcmd verbose
|
||||
echo -e "${BAD}!!${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
|
||||
fi
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/initrd.d/00-common.sh
|
||||
|
||||
is_udev() {
|
||||
[ -x "${UDEVD}" ] && [ -z "${USE_MDEV}" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_mdev() {
|
||||
if [ ! -x "${UDEVD}" ] || [ -n "${USE_MDEV}" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
devmgr_init() {
|
||||
if is_udev; then
|
||||
good_msg "Activating udev"
|
||||
echo "${UDEVD}" > /proc/sys/kernel/hotplug
|
||||
echo "" > /sys/kernel/uevent_helper
|
||||
"${UDEVD}" --daemon --resolve-names=never && \
|
||||
udevadm trigger --action=add && \
|
||||
udevadm settle || bad_msg "udevd failed to run"
|
||||
elif is_mdev; then
|
||||
good_msg "Activating mdev"
|
||||
# Serialize hotplug events
|
||||
touch /dev/mdev.seq
|
||||
echo "${MDEVD}" > /proc/sys/kernel/hotplug
|
||||
# Ensure that device nodes are properly configured
|
||||
"${MDEVD}" -s || bad_msg "mdev -s failed"
|
||||
else
|
||||
bad_msg "Cannot find either udev or mdev"
|
||||
fi
|
||||
}
|
||||
|
||||
# Terminate the device manager, this happens right before pivot_root
|
||||
devmgr_terminate() {
|
||||
if is_udev; then
|
||||
udevadm settle
|
||||
udevadm control --exit || bad_msg "Unable to terminate udevd"
|
||||
fi
|
||||
# mdev doesn't require anything, it seems
|
||||
}
|
Loading…
Reference in new issue