# configuration functions for SuSE 10.1 which differ from functions defined
# in general SuSE base definitions ... General changes should be done there,
# version specific changes for the 10.1 go here.
#
# Dirk von Suchodoletz <dvs@OpenSLX.com>, 05-09-2006
#
# (c) 2006 - RZ Universitaet Freiburg
# some specific stuff to initialize
preinit () {
# fake the existence of some helper binaries (which are not of any use
# within initialramfs)
shell="/bin/sh"
[ -x /bin/busybox ] && shell="/bin/ash"
for i in usb_id scsi_id vol_id edd_id ata_id path_id hwup ifup ; do
echo -e "#!$shell\n:" >/sbin/$i
done
mkdir /lib/udev /usr/sbin
for i in idedma.sh mount.sh rename_netiface create_floppy_devices ; do
echo -e "#!$shell\n:" >/lib/udev/$i
done
echo -e "#!$shell\n:" >/usr/sbin/alsactl
rm /etc/udev/rules.d/60-persistent-storage.rules 2>/dev/null
chmod u+x /sbin/* /lib/udev/* /usr/sbin/*
}
# udev service
udev_hotplug () {
local result=0
echo "Starting udev"
# might be used if busybox is available
#mknod /dev/console c 5 1
#mknod /dev/null c 1 3
#mknod /dev/kmsg c 1 11
if [ -x /bin/udevd ] ; then
echo "" > /proc/sys/kernel/hotplug
udevd --daemon || result=1
trigger_device_events
usleep 50
else error "$df_errudev" nonfatal
fi
return $result
}
# acpi and powersave
config_acpi () {
rllinker acpid "10" "12"
rllinker powersaved "11" "11"
}
# afs client
# configure afs client
config_afs () {
if [ "x$start_afs" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/openafs-client ] ; then
test -d /mnt/afs || error "${df_errafsd}"
testmkd /mnt/var/cache/openafs
rllinker "openafs-client" "15" "06"
# echo -e "# /etc/sysconfig/afs-client - file generated by \
#$0:\n#\t$date\n" >/etc/sysconfig/afs-client.new;
# sed -e "s,THIS_CELL_SERVER.*,THIS_CELL_SERVER=\"$cell_serv\"," \
# -e "s,PREFERREDSERVERS.*,PREFERREDSERVERS=\"$cell_serv\"," \
# -e "s,THIS_CELL.*,THIS_CELL=\"$this_cell\"," \
# -e "s,MEMCACHE.*,MEMCACHE=\"yes\"," \
# /etc/sysconfig/afs-client >> \
# /etc/sysconfig/afs-client.new
# mv /etc/sysconfig/afs-client.new /etc/sysconfig/afs-client
else
error "${df_errafsn}" nonfatal
fi
fi
}
# prepare virtual machine environment (vmware, vmplayer)
config_vmware () {
rllinker "vmware-prep" "18" "02"
rllinker "vmware" "20" "02"
sed -e "s,TARGETS =,TARGETS = vmware-prep," \
/mnt/etc/${D_INITDIR}/.depend.start >> /etc/.depend.start
echo "vmware-prep: " >> /etc/.depend.start
cp /etc/.depend.start /mnt/etc/${D_INITDIR}/.depend.start
# during vmware sessions linux should not handle usb events/devices
# vmplayer and recent versions of vmware do not need this hack
if [ ! -x /mnt/usr/bin/vmplayer ] ; then
testmkd /mnt/var/X11R6/bin
echo '#!/bin/sh'> /mnt/var/X11R6/bin/vm-udev
echo -e "# Script for blocking linux from handling usb \
devices\n# during vmware sessions. If you like to remove certain modules \
add them\n# to the list below - Dirk von Suchodoletz, <dvs@OpenSLX.com>\n\
STATE=1\nps aux|grep -i vmware|grep -v \"grep\" &>/dev/null && { STATE=0; \
/sbin/rmmod usb-storage &>/tmp/null; }\n\
[ x\$ACTION = xremove ] && { [ \$STATE = 0 ] && /sbin/rmmod usb-storage \
&>/dev/null; }\nexit \$STATE" >> /mnt/var/X11R6/bin/vm-udev
chmod u+x /mnt/var/X11R6/bin/vm-udev
echo -e "# special entry to block linux from reacting to usb events during \
running\n# vmware sessions, generated by $0 during initramfs\n# Dirk von \
Suchodoletz, <dvs@OpenSLX.com>\nSUBSYSTEM==\"usb\", ACTION==\"add\", \
PROGRAM=\"/var/X11R6/bin/vm-udev\", OPTIONS=\"ignore_device\"\n\
SUBSYSTEM==\"usb\", ACTION==\"remove\", PROGRAM=\"/var/X11R6/bin/vm-udev\"" \
>> /mnt/etc/udev/rules.d/01-udev-vm.rules
fi
}
# set up keytable (function run in hwautocfg)
# kbd runlevel link is in the list of initial runlevel scripts (see
# config-10.1 file)
keytable () {
# remove unneeded components from the startscript
sed -e "/wanted keytable/,/^fi$/d;/load usb drivers/,/^esac$/d" \
-i /mnt/etc/${D_INITDIR}/kbd
sed -e "s,KEYTABLE=.*,KEYTABLE=\"${KEYTABLE}\"," \
-i /mnt/etc/${D_SYSCONFDIR}/keyboard
}
# consolefont and language (function run in hwautocfg)
consolefont () {
sed -e "s,RC_LANG=.*,RC_LANG=\"${LANG}\" # added in initrd," \
-i /mnt/etc/${D_SYSCONFDIR}/language
}