[PATCH] LFS init script update

This commit is contained in:
mbuesch@freenet.de 2004-01-23 22:54:55 -08:00 committed by Greg KH
parent 1c5c245e6f
commit 25f8a5ad64

View file

@ -2,51 +2,30 @@
# #
# LinuxFromScratch udev init script # LinuxFromScratch udev init script
# derived from original RedHat udev init script # derived from original RedHat udev init script
# 2003 by Michael Buesch <mbuesch@freenet.de> # 2003, 2004 by Michael Buesch <mbuesch@freenet.de>
# #
source /etc/sysconfig/rc source /etc/sysconfig/rc
source $rc_functions source $rc_functions
source /etc/udev/udev.conf
udev_dir="/udev"
sysfs_dir="/sys" sysfs_dir="/sys"
bin="/sbin/udev" bin="/sbin/udev"
case "$1" in
start) run_udev ()
echo "Creating initial udev device nodes ..." {
if [ ! -d $udev_dir ]; then # handle block devices and their partitions
mkdir $udev_dir
if [ $? -ne 0 ]; then
print_status failure
exit 1
fi
fi
if [ ! -d $sysfs_dir ]; then
echo "sysfs_dir $sysfs_dir does not exist!"
print_status failure
exit 1
fi
# propogate /udev from /sys - we only need this while we do not
# have initramfs and an early user-space with which to do early
# device bring up
clean_exit="yes"
export ACTION=add
# add block devices and their partitions
for i in ${sysfs_dir}/block/*; do for i in ${sysfs_dir}/block/*; do
# add each drive # add each drive
export DEVPATH=${i#${sysfs_dir}} export DEVPATH=${i#${sysfs_dir}}
$bin block $bin block &
# add each partition, on each device # add each partition, on each device
for j in $i/*; do for j in $i/*; do
if [ -f $j/dev ]; then if [ -f $j/dev ]; then
export DEVPATH=${j#${sysfs_dir}} export DEVPATH=${j#${sysfs_dir}}
$bin block $bin block &
if [ $? -ne 0 ]; then
echo "Warning: $DEVPATH failed."
clean_exit="no"
fi
fi fi
done done
done done
@ -57,28 +36,41 @@ case "$1" in
export DEVPATH=${j#${sysfs_dir}} export DEVPATH=${j#${sysfs_dir}}
CLASS=`echo ${i#${sysfs_dir}} | \ CLASS=`echo ${i#${sysfs_dir}} | \
cut --delimiter='/' --fields=3-` cut --delimiter='/' --fields=3-`
$bin $CLASS $bin $CLASS &
fi
done
done
return 0
}
case "$1" in
start)
echo "Creating initial udev device nodes ..."
if [ ! -d $sysfs_dir ]; then
echo "sysfs_dir $sysfs_dir does not exist!"
print_status failure
exit 1
fi
if [ ! -d $udev_root ]; then
mkdir $udev_root
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Warning: $DEVPATH failed." print_status failure
clean_exit="no" exit 1
fi fi
fi fi
done
done # propogate /udev from /sys - we only need this while we do not
if [ $clean_exit = "yes" ]; then # have initramfs and an early user-space with which to do early
print_status success # device bring up
else export ACTION=add
print_status warning run_udev
fi evaluate_retval
;; ;;
stop) stop)
echo "Removing udev device nodes ..." echo "Removing udev device nodes ..."
# be careful export ACTION=remove
if [ $udev_dir -a "$udev_dir" != "/" ]; then run_udev
# clear out /udev
rm -rf ${udev_dir}/*
evaluate_retval evaluate_retval
fi
;; ;;
reload) reload)
# nothing to do here # nothing to do here