From 95c42e5352375c0bd08f597cad5a01fa29a73c41 Mon Sep 17 00:00:00 2001 From: Felix Endres Date: Sun, 30 Apr 2006 02:03:13 +0000 Subject: Work on debian, especially udev. Some documentation too. git-svn-id: http://svn.openslx.org/svn/openslx/ld4@204 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/debian/functions-3.1 | 37 ++++++++++++++++++++++++--- initrd/initrd-stuff/etc/functions | 8 +++++- initrd/mkdxsinitrd | 43 ++++++++++++++++++++++++++------ packaging/default_files/mkdxsinitrd.1 | 3 --- 4 files changed, 77 insertions(+), 14 deletions(-) diff --git a/initrd/distro-specs/debian/functions-3.1 b/initrd/distro-specs/debian/functions-3.1 index 144a7774..2a78ab6b 100644 --- a/initrd/distro-specs/debian/functions-3.1 +++ b/initrd/distro-specs/debian/functions-3.1 @@ -12,13 +12,39 @@ # distro specific stuff to initialize preinit () { - : + echo "Creating dhcp user" + echo "dhcp:x:101:">>/etc/group + echo "dhcp:x:101:101::/nonexistent:/bin/false" >>/etc/passwd + } postinit () { : } +# distro specific function called from servconfig script +config_distro () { +# add the halt link to the 0 and 6 runlevel directories + ln -sf ../init.d/halt /mnt/etc/rc0.d/S90halt + ln -sf ../init.d/reboot /mnt/etc/rc6.d/S90reboot + + # set default runlevel + sed -e "s/.*initdefault/id:${D_INITDEFAULT}:initdefault/" -i /mnt/etc/inittab +} + +# AUS SuSE-9.3 +# udev/hotplug - auto device discovery service +# Result: 1 is bad, 0 is good +udev_hotplug () { + local result=1 + [ -d /etc/hotplug -a -d /etc/hotplug.d ] || error "$df_errhotpl" nonfatal + echo "Enabling hotplug/udev" + udevstart && result=0 + udevtrigger && result=0 + udevd -d || result=1 + return $result +} + # distro specific general function called from servconfig script config_distro () { # add the halt link to the 0 and 6 runlevel directories @@ -39,8 +65,13 @@ local stop="$3" # passed via configuration for i in rc2.d/K$stop$script rc3.d/K$stop$script \ rc2.d/S$start$script rc3.d/S$start$script ; do - ln -sf ../$script /mnt/etc/init.d/$i - echo "Linked $script" + if ! [ -f /mnt/etc/init.d/$script ]; then + echo "Target `pwd`../$script does not exist. Skipping links" + break + else + ln -sf ../init.d/$script /mnt/etc/$i + echo "Linked $script" + fi done } diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index b7e7ecce..127b3a4c 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -41,6 +41,8 @@ trigger_device_events () { # produce error message and if $2 is empty run (debug) shell error () { local e_msg="$1" +if [ -z "$DEBUGLEVEL" ]; then DEBUGLEVEL=0 +fi # check if LOGFILE is really writeable if [ -n "${LOGFILE}" ] ; then [ "${LOGFILE}" != "/dev/null" ] && \ @@ -140,7 +142,11 @@ case $ipcfg in ipconfig $ip::$gw:$nm:$if:none ;; ifconfig) - ifconfig $if $ip netmask $nm broadcast $bc + if [ "$ip" = "0.0.0.0" ]; then + ifconfig $if up + else + ifconfig $if $ip netmask $nm broadcast $bc + fi if [ "$gw" != "0.0.0.0" ] ; then route add default gw $gw fi diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 6cdfb30b..8e43b605 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -52,7 +52,34 @@ D_DEFAULTCOUNTRY="" usage() { - echo Here is how to use mkdxsinitrd + echo -e "mkdxsinitrd [-gh] [-k Kernelversion] [-i Pfad] [-f Module] [-n Module] [-r Pfad] [-s Bildgröße]\n" + echo "OPTIONEN" + echo " -g Benutze glibc als Basisbibliothek in der ramdisk." + echo " -h Zeige Informationen zur Benutzung." + echo " -k Kernelversion" + echo " mkdxsinitrd versucht die aktuellste Kernelversion zu finden." + echo " Falls dies nicht klappt, oder eine andere Kernelversion" + echo " gewünscht ist kann diese hier angegeben werden (funktioniert" + echo " natürlich nur für auf dem Hostsystem vorhandene Kernelversio‐" + echo " nen)." + echo " -i Pfad" + echo " Optionale Angabe wo die erstellte ramdisk hingeschrieben werden" + echo " soll." + echo " -f Modulliste" + echo " Kernelmodule die benutzt werden sollen um das Rootfilesystem" + echo " über das dem Netzwerk zu mounten (z.B. nfs, nbd dnbd)." + echo " -n Modulliste" + echo " Kernelmodule zum Betrieb der Clientnetzwerkkarten (z.B. e100 tg3" + echo " via-rhine)." + echo " -r Pfad" + echo " Pfad zum Wurzelverzeichnis des zu exportierenden Betriebsystems" + echo " (z.B. /nfsroot)." + echo " -s Bildgröße" + echo " Größenangabe des splash images." + echo " -d Name" + echo " Name der Distribution der Betriebsystemvorlage" + echo " -v Version" + echo " Versionskennung der Distribution der Betriebsystemvorlage" exit 0 } @@ -229,11 +256,11 @@ while getopts :hgk:i:r:o:s:f:n:Sut:d:v:I:V:a: a ; do t) INSTDIR=$OPTARG;; d) DISTRO=$OPTARG;; v) DISTRO_VER=$OPTARG;; - I) NET_IF=$OPTARG;; - a) acpi_dsdt="$OPTARG";; - S) use_selinux=1;; - V) vendor_init_script="$OPTARG";; - u) sysfs_root=1 + I) NET_IF=$OPTARG;; # Not in use + a) acpi_dsdt="$OPTARG";; # Not in use + S) use_selinux=1;; # Not in use + V) vendor_init_script="$OPTARG";; # Not in use + u) sysfs_root=1 # Not in use use_udev= ;; h) usage;; @@ -291,6 +318,8 @@ case "${DISTRO}" in case "${DISTRO_VER}" in Sarge*|sarge*|3.1*|*) DISTRO_VER=3.1 + mkdir -p ${INSTDIR}/lib/udev + cp -r ${ROOTDIR}/lib/udev/* ${INSTDIR}/lib/udev/ ;; esac ;; @@ -393,7 +422,7 @@ for bbins in \ done # style of hotplug/udev/dev (for etc directories see above!!) -for bbins in udev udevd udevstart +for bbins in udev udevd udevstart udevtrigger do cobi ${bbins} bin &>/dev/null || echo "Program ${bbins} not found" done diff --git a/packaging/default_files/mkdxsinitrd.1 b/packaging/default_files/mkdxsinitrd.1 index 9682070a..b62f46c9 100644 --- a/packaging/default_files/mkdxsinitrd.1 +++ b/packaging/default_files/mkdxsinitrd.1 @@ -72,9 +72,6 @@ Name der Distribution der Betriebsystemvorlage .TP .BI \-v\ Version Versionskennung der Distribution der Betriebsystemvorlage -.TP -.BI \-s\ Bildgre -Grenangabe des splash images. .SH SIEHE AUCH .BR ld4-inst "(1). -- cgit v1.2.3-55-g7522