initscripts/etc/rc.d/init.d/sysinit

90 lines
2.5 KiB
Plaintext
Raw Normal View History

2011-04-26 12:26:24 +02:00
#!/bin/sh
# sysinit - System initialization control script
#
# Copyright 2003-2010 (C) Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright 2004-2007,2011 (C) Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
KERNELVER=`uname -r`
trap "" INT QUIT TSTP
if [ ! -L /dev/root ]; then
rootdev=
rootuuid=
for token in `cat /proc/cmdline 2>/dev/null`; do
set -- $token
case "$1" in
root=UUID=*)
rootuuid="${1##*=}"
[ -L /dev/disk/by-uuid/$rootuuid ] &&
rootdev=$(readlink -f /dev/disk/by-uuid/$rootuuid 2>/dev/null) ;;
root=*) rootdev="${1##*=}" ;;
esac
done
if [ -b "$rootdev" ]; then
rm -f /dev/root # to prevent duplicate entries
echo -n "Creating root device link on /dev: "
ln -s $rootdev /dev/root
evaluate_retval
echo
fi
fi
[ -e /lib/modules/$KERNELVER ] || mkdir -p /lib/modules/$KERNELVER
if [ ! "$no_auto_depmod" ]; then
DEPMOD_NEEDED="`find /lib/modules/$KERNELVER -type d -cnewer /lib/modules/$KERNELVER/modules.dep`"
if [ "$DEPMOD_NEEDED" -o ! -s /lib/modules/$KERNELVER/modules.dep ]; then
echo -n "Updating modules dependencies: "
depmod -a
evaluate_retval
echo
fi
fi
if [ ! "$no_auto_ldconfig" ]; then
# do some tests to check if ld.so should rebuild its cache
if [ -s /etc/ld.so.cache ]; then
LIBDIRS="/lib /usr/lib /usr/local/lib"
LIB64DIRS="/lib64 /usr/lib64 /usr/local/lib64"
for DIR in $LIBDIRS $LIB64DIRS \
`LANG=C grep -he "^/.*" \
/etc/ld.so.conf /etc/ld.so.conf.d/* 2>/dev/null`; do
if [ -x /sbin/ldconfig -a $DIR -nt /etc/ld.so.cache ]; then
echo -n "Setting up linker cache using ldconfig: "
/sbin/ldconfig 2>&1
evaluate_retval
echo
break
fi
done
fi
fi
if [ -w /usr/src -a -e /usr/src/linux-$KERNELVER ]; then
echo -n "Creating current kernel sources symlink /usr/src/linux: "
[ -L /usr/src/linux ] && rm -f /usr/src/linux
ln -s linux-$KERNELVER /usr/src/linux
evaluate_retval
echo
fi
if [ -e /boot/vmlinuz-$KERNELVER -a -w /boot ]; then
echo -n "Creating current kernel symlinks in /boot: "
if [ -e /boot/vmlinuz-$KERNELVER ]; then
[ -L /boot/vmlinuz ] && rm -f /boot/vmlinuz
ln -s vmlinuz-$KERNELVER /boot/vmlinuz
fi
if [ -e /boot/initramfs-$KERNELVER.img ]; then
[ -L /boot/initramfs.img ] && rm /boot/initramfs.img
ln -s initramfs-$KERNELVER.img /boot/initramfs.img
fi
evaluate_retval
echo
fi