summaryrefslogtreecommitdiffstats
path: root/initrd
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-04-30 15:57:36 +0200
committerDirk von Suchodoletz2006-04-30 15:57:36 +0200
commitda3771dc4695682492644e6c636fb8d68851fbfd (patch)
tree3f6b39cb8f60c514d7ff2cc97cb5523599ebdbfe /initrd
parentWork on debian, especially udev. Some documentation too. (diff)
downloadcore-da3771dc4695682492644e6c636fb8d68851fbfd.tar.gz
core-da3771dc4695682492644e6c636fb8d68851fbfd.tar.xz
core-da3771dc4695682492644e6c636fb8d68851fbfd.zip
additions, fixups to/of several function files ...
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@205 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rw-r--r--initrd/distro-specs/debian/functions-3.185
-rw-r--r--initrd/distro-specs/suse/functions-10.02
-rw-r--r--initrd/distro-specs/suse/functions-9.313
-rw-r--r--initrd/distro-specs/ubuntu/functions-5.1020
-rw-r--r--initrd/initrd-stuff/etc/functions33
5 files changed, 94 insertions, 59 deletions
diff --git a/initrd/distro-specs/debian/functions-3.1 b/initrd/distro-specs/debian/functions-3.1
index 2a78ab6b..92e495d6 100644
--- a/initrd/distro-specs/debian/functions-3.1
+++ b/initrd/distro-specs/debian/functions-3.1
@@ -2,20 +2,18 @@
# linux diskless clients (executed within initial
# ramdisk after genconfig)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 31-03-2006
-# Blabla
-# Blub
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 30-04-2006
+# Felix Endres, 30-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.2.1c
+# Version: 0.2.1d
# distro specific stuff to initialize
preinit () {
echo "Creating dhcp user"
- echo "dhcp:x:101:">>/etc/group
+ echo "dhcp:x:101:" >>/etc/group
echo "dhcp:x:101:101::/nonexistent:/bin/false" >>/etc/passwd
-
}
postinit () {
@@ -63,6 +61,7 @@ local start="$2"
local stop="$3"
# empty runlevel links - decision on running certain services is
# passed via configuration
+# fixme!! "stop" seems not to be used in Debian!?
for i in rc2.d/K$stop$script rc3.d/K$stop$script \
rc2.d/S$start$script rc3.d/S$start$script ; do
if ! [ -f /mnt/etc/init.d/$script ]; then
@@ -83,11 +82,9 @@ local info=$3
}
# group of functions for the normal runlevels - first parameter is start
-# second stop
+# second stop (fixme: is "stop" needed in Debian??)
# function for ntp configuration
config_ntp () {
-local start=$1
-local stop=$2
if [ -f /mnt/etc/init.d/ntp ] ; then
echo -e "ntp:x:74:65534:NTP daemon:/var/lib/ntp:/bin/false" \
>>/mnt/etc/passwd
@@ -98,7 +95,7 @@ if [ -f /mnt/etc/init.d/ntp ] ; then
echo "ntpdate -s -b $ntp_servers >${LOGFILE} 2>&1 &" \
>>/mnt/etc/${D_INITDIR}/boot.ld
else
- rllinker "ntp" "$start" "$stop"
+ rllinker "ntp" "20" "02"
fi
fi
}
@@ -106,7 +103,11 @@ fi
# function for atd
config_atd () {
if [ "x$start_atd" = "xyes" ]; then
- rllinker "atd" "$1" "$2"
+ # fixme!! needed? Fix permissions
+ #testmkd /mnt/var/spool/cron/atjobs
+ #testmkd /mnt/var/spool/cron/atspool
+ #chown /mnt/var/spool/cron/atjobs /mnt/var/spool/cron/atspool
+ rllinker "atd" "89" "01"
fi
}
@@ -114,10 +115,8 @@ fi
config_cron () {
if [ "x$start_cron" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/cron ] ; then
- rllinker "cron" "18" "02"
- # fixme! check for proper pathes
- testmkd /mnt/var/spool/cron/lastrun
- testmkd /mnt/var/spool/cron/tabs
+ rllinker "cron" "89" "01"
+ testmkd /mnt/var/spool/cron/crontabs
echo -e "# /etc/crontab - file generated by $0:\n\
#\t$date\nSHELL=/bin/sh\nPATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin\
\nMAILTO=\n-*/15 * * * *\troot\ttest -x /usr/lib/cron/run-crons && \
@@ -131,7 +130,7 @@ fi
# syslog service
config_syslog () {
if [ "x$start_syslog" = "xyes" ] ; then
- echo >/dev/null
+ :
fi
}
@@ -139,7 +138,7 @@ fi
config_sshd () {
if [ "x$start_sshd" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/ssh ] ; then
- rllinker "sshd" "$1" "$2"
+ rllinker "sshd" "20" "02"
fi
fi
}
@@ -148,7 +147,7 @@ fi
config_snmp () {
if [ "x$start_snmp" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/snmpd ] ; then
- rllinker "snmpd" "$1" "$2"
+ rllinker "snmpd" "30" "03"
testmkd /mnt/var/lib/net-snmp >/dev/null 2>&1
fi
# fixme!!
@@ -200,17 +199,21 @@ Name=$i\n" > /mnt/etc/X11/sessions/$i.desktop
done
# add special path /var/X11R6/bin to the PATH variable
-[ "x$addpath" != "x" ] && \
- echo -e "# added path component by $0: $date\n\
-PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/SuSEconfig/profile
-
+# fixme!! add path directly to /etc/profile!?
+#[ "x$addpath" != "x" ] && \
+# echo -e "# added path component by $0: $date\n\
+#PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/profile
}
-# consolefont
+# consolefont and language
consolefont () {
echo -e "setfont ${CONSOLE_FONT} >${LOGFILE} 2>&1" \
>>/mnt/etc/${D_INITDIR}/boot.ld
+# fixme!! check for proper operation
+sed -e "s,LANGUAGE=.*,LANGUAGE=\"${LANG}\" # set within initramfs," \
+ -e "s,LANG=.*,LANG=\"${LANG}\" # set within initramfs," \
+ -i /mnt/etc/environment
}
# acpi and powersave
@@ -229,9 +232,11 @@ config_gdm () {
echo -e "\t/etc/${D_INITDIR}/gdm start >${LOGFILE} 2>&1\n\
\t( sleep 120; ln -sf /etc/${D_INITDIR}/gdm /etc/rc3.d/S01gdm \
>${LOGFILE} 2>&1) &\n" >>/mnt/etc/${D_INITDIR}/boot.ld
- # append gdm user
- echo "gdm:x:113:">>/etc/group
- echo "gdm:x:106:113:Gnome Display Manager:/var/lib/gdm:/bin/false" >>/etc/passwd
+ # check for gdm user in passwd and group files
+ # fixme!!
+ echo "gdm:x:113:">>/mnt/etc/group
+ echo "gdm:x:106:113:Gnome Display Manager:/var/lib/gdm:/bin/false" \
+ >>/mnt/etc/passwd
}
# configure kdm as display manager
@@ -245,12 +250,34 @@ config_kdm () {
# configure hal, dbus, resmgr and services like that
config_dreshal () {
if [ "x$start_dreshal" = "xyes" ]; then
- echo >/dev/null
+ :
fi
}
# start name service caching daemon
config_nscd () {
-:
+ :
+}
+# fixme!! taken from SuSE10.0 untested here ...
+# prepare virtual machine environment (vmware, vmplayer)
+config_vmware () {
+rllinker "vmware-prep" "22" "02"
+rllinker "vmware" "24" "02"
+# during vmware sessions linux should not handle usb events/devices
+testmkd /mnt/var/X11R6/bin
+echo '#!/bin/sh'>> /mnt/etc/udev/rules.d/01-udev-vm.rules
+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, <dirk@goe.net>\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, <dirk@goe.net>\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
}
-
diff --git a/initrd/distro-specs/suse/functions-10.0 b/initrd/distro-specs/suse/functions-10.0
index 45e0613c..5dc40141 100644
--- a/initrd/distro-specs/suse/functions-10.0
+++ b/initrd/distro-specs/suse/functions-10.0
@@ -84,7 +84,7 @@ if [ "x$start_dreshal" = "xyes" ]; then
fi
fi
}
-# start vmware
+# prepare virtual machine environment (vmware, vmplayer)
config_vmware () {
rllinker "vmware-prep" "18" "02"
rllinker "vmware" "20" "02"
diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3
index 79309827..d3573ce0 100644
--- a/initrd/distro-specs/suse/functions-9.3
+++ b/initrd/distro-specs/suse/functions-9.3
@@ -4,7 +4,7 @@
# functions file). This file is the main base for the
# following SuSE distributions
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 28-04-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, /28-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
@@ -163,8 +163,7 @@ local dm="$1"
# should be stated that entries were made (fixmee how??)
sed -e "s,DISPLAYMANAGER=.*,DISPLAYMANAGER=\"$start_xdmcp\"," \
-e "s,.*_XSERVER.*,DISPLAYMANAGER_STARTS_XSERVER=\"$dm\"," \
- /mnt/etc/${D_SYSCONFDIR}/displaymanager > /etc/displaymanager
-cp /etc/displaymanager /mnt/etc/${D_SYSCONFDIR}/displaymanager
+ -i /mnt/etc/${D_SYSCONFDIR}/displaymanager
# start the display manager as early as possible, but avoid that is
# started twice during bootup - quickhack ...
#ln -sf /etc/${D_INITDIR}/xdm /mnt/etc/${D_INITDIR}/rc5.d/S01xdm
@@ -313,13 +312,12 @@ config_bt () {
cp /etc/bluetooth /mnt/etc/${D_SYSCONFDIR}/bluetooth
}
-# consolefont
+# consolefont and language
consolefont () {
echo -e "\tsetfont ${CONSOLE_FONT} >${LOGFILE} 2>&1\n" \
>>/mnt/etc/${D_INITDIR}/boot.ld
sed -e "s,RC_LANG=.*,RC_LANG=\"${LANG}\" # added in initrd," \
- /mnt/etc/${D_SYSCONFDIR}/language > /etc/language
-cp /etc/language /mnt/etc/${D_SYSCONFDIR}/language
+ -i /mnt/etc/${D_SYSCONFDIR}/language
}
# acpi and powersave
@@ -435,8 +433,7 @@ sed -e "s,TARGETS =,TARGETS = vmware-prep," \
# to block linux from handling usb events during vmware sessions
sed -e '/USB-specific/{;i\' \
-e 'ps aux |grep -i vmware| grep -v "grep" &>/dev/null && exit 0' \
- -e ' }' /mnt/etc/hotplug.d/usb/50-usb.hotplug > /tmp/50-usb.hotplug
-cp /tmp/50-usb.hotplug /mnt/etc/hotplug.d/usb/50-usb.hotplug
+ -e ' }' -i /mnt/etc/hotplug.d/usb/50-usb.hotplug
}
# initialize runlevel skript to be executed during system startup
diff --git a/initrd/distro-specs/ubuntu/functions-5.10 b/initrd/distro-specs/ubuntu/functions-5.10
index c5bbf4dc..c4b95bcd 100644
--- a/initrd/distro-specs/ubuntu/functions-5.10
+++ b/initrd/distro-specs/ubuntu/functions-5.10
@@ -231,10 +231,28 @@ config_nscd () {
:
}
-# start vmware
+# fixme!! taken from SuSE10.0 untested here ...
+# prepare virtual machine environment (vmware, vmplayer)
config_vmware () {
rllinker "vmware-prep" "18" "02"
rllinker "vmware" "20" "02"
+# during vmware sessions linux should not handle usb events/devices
+testmkd /mnt/var/X11R6/bin
+echo '#!/bin/sh'>> /mnt/etc/udev/rules.d/01-udev-vm.rules
+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, <dirk@goe.net>\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, <dirk@goe.net>\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
}
# configure automounter
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions
index 127b3a4c..bac1e53b 100644
--- a/initrd/initrd-stuff/etc/functions
+++ b/initrd/initrd-stuff/etc/functions
@@ -2,8 +2,8 @@
# linux diskless clients (included by init, hwautocfg,
# servconfig, ... within initial ramdisk)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 11-04-2006
-# Felix Endres, 21-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 30-04-2006
+# Felix Endres, 30-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
@@ -19,16 +19,16 @@ trigger_device_events () {
case "$i" in
*/device/uevent|*\**)
continue
- ;;
+ ;;
*/class/mem/*|*/class/tty/*)
first="$first $i"
- ;;
+ ;;
*/block/md*)
last="$last $i"
- ;;
+ ;;
*/*)
default="$default $i"
- ;;
+ ;;
esac
done
# trigger the sorted events
@@ -41,6 +41,8 @@ trigger_device_events () {
# produce error message and if $2 is empty run (debug) shell
error () {
local e_msg="$1"
+# fixme!! DEBUGLEVEL is exported rather early, so checking it here is
+# redundant ...
if [ -z "$DEBUGLEVEL" ]; then DEBUGLEVEL=0
fi
# check if LOGFILE is really writeable
@@ -143,13 +145,11 @@ case $ipcfg in
;;
ifconfig)
if [ "$ip" = "0.0.0.0" ]; then
- ifconfig $if up
+ ifconfig $if up
else
- ifconfig $if $ip netmask $nm broadcast $bc
- fi
- if [ "$gw" != "0.0.0.0" ] ; then
- route add default gw $gw
+ ifconfig $if $ip netmask $nm broadcast $bc
fi
+ [ "$gw" != "0.0.0.0" ] && route add default gw $gw
;;
none)
error "$error_iptool"
@@ -268,10 +268,10 @@ tftpget () {
case "$1" in
atftp)
atftp -g -r $2 $3
- ;;
+ ;;
tftp)
echo "get $2" | tftp $3
- ;;
+ ;;
esac
}
fileget () {
@@ -323,13 +323,6 @@ strinstr (){
#######################################################################
# simple string in file search
-#strinfile (){
-#local line
-#while read < $2 line; do
-# case "${line}" in *$1*) return 0;; esac
-#done
-#return 1
-#}
strinfile (){
case "$(cat $2)" in *$1*) return 0;; esac
return 1