From f6329ff653cc1485dc8ba38733c23582e30d3495 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Fri, 31 Mar 2006 23:20:41 +0000 Subject: added functions for gentoo (runlevel system, services) ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@137 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/gentoo/config-2005.1 | 4 +- initrd/distro-specs/gentoo/functions-2005.1 | 216 +++++++++++++++++++++++++++- initrd/distro-specs/suse/functions-9.3 | 3 + initrd/initrd-stuff/bin/servconfig | 4 +- initrd/initrd-stuff/etc/vmware-prep | 2 +- 5 files changed, 219 insertions(+), 10 deletions(-) (limited to 'initrd') diff --git a/initrd/distro-specs/gentoo/config-2005.1 b/initrd/distro-specs/gentoo/config-2005.1 index 1e47f8ee..ff8ee109 100644 --- a/initrd/distro-specs/gentoo/config-2005.1 +++ b/initrd/distro-specs/gentoo/config-2005.1 @@ -1,6 +1,6 @@ # Description: distro specific settings for Gentoo # -# Author(s): Dirk von Suchodoletz , 24-03-2006 +# Author(s): Dirk von Suchodoletz , 31-03-2006 # # Copyright: (c) 2005,6 - RZ Universitaet Freiburg @@ -39,7 +39,7 @@ D_BINDMNT="# spielspass fuer splash" D_INITDIR="/init.d" D_INITBOOTD="/runlevels/boot" D_RCDIRS="/runlevels/default /runlevels/nonetwork /runlevels/single" -D_INITSCRIPTS="bootmisc clock urandom consolefont keymaps" +D_INITSCRIPTS="bootmisc clock urandom boot.ld" D_XF86CONFFILE="/etc/X11/xorg.conf" D_XFONTPATH="/usr/share/fonts/*" D_DEFAULTCOUNTRY="de" diff --git a/initrd/distro-specs/gentoo/functions-2005.1 b/initrd/distro-specs/gentoo/functions-2005.1 index 7852853c..c28eccae 100644 --- a/initrd/distro-specs/gentoo/functions-2005.1 +++ b/initrd/distro-specs/gentoo/functions-2005.1 @@ -14,13 +14,18 @@ preinit () { } postinit () { - : +# rm -rf /mnt/etc/runlevels/default/* +: } # distro specific general function called from servconfig script config_distro () { -echo -e "dxs version 4.0a\initramfs generation date $date" \ +echo -e "dxs version 4.0a\ninitramfs generation date $date" \ >> /mnt/etc/gentoo-release +echo -e "# changes made to this file by $0 (initrd from $date)" \ + > /etc/rc.conf +# keytable is set by hwautocfg script (added just for convenience here) +config_rc_entry "KEYMAP" "${KEYTABLE}" } # udev service - not checked! @@ -37,6 +42,21 @@ apprear." nonfatal fi } +# linking runlevel scripts +rllinker () { +local script="$1" +local need="$2" +# empty runlevel links - decision on running certain services is +# passed via configuration +ln -s /etc/init.d/$1 /mnt/etc/runlevels/default/$1 +echo $1 >> /mnt/etc/runlevels/default/.critical +# hack to remove unneeded dependency stuff +#if [ "$script" != "vmware-prep" ] ; then +# sed "/depend/,/}/d" /mnt/etc/init.d/$1 > /etc/rls +# cp /etc/rls /mnt/etc/init.d/$1 +#fi +} + # initialize boot.ld - skript to be executed during early system startup # (before most of the normal boot init scripts) # this script should operate like a normal runlevel script @@ -50,15 +70,201 @@ local info="$3" case "$switch" in init) echo -e "#!/sbin/runskript\n# skeleton of /etc/${D_INITDIR}/$name \ -generated by $0" >/mnt/etc/${D_INITDIR}/$name - echo -e "\n\nstart() {\tebegin \"$info\"" \ +generated by $0\ndepend() {\n\t:\n}" >/mnt/etc/${D_INITDIR}/$name + echo -e "\n\nstart() {\n\tebegin \"$info\"" \ >>/mnt/etc/${D_INITDIR}/$name chmod u+x /mnt/etc/${D_INITDIR}/$name ;; close) - echo -e "\t;;\n stop)\n\t;;\nesac\nexit 0" \ + echo -e "\n}\n\nstop() {\n\t:\n}\n# vim:ts=4" \ >>/mnt/etc/${D_INITDIR}/$name ;; esac } +# group of functions for the normal runlevels +# function for ntp configuration (unchecked) +config_ntp () { +if [ -f /mnt/etc/init.d/ntp ] ; then + if ! strinfile "ntp:" /mnt/etc/passwd ; then + echo -e "ntp:x:74:65534:NTP daemon:/var/lib/ntp:/bin/false" \ + >>/mnt/etc/passwd + echo -e "ntp:!:13099:0:99999:7:::" >>/mnt/etc/shadow + fi + testmkd /mnt/var/lib/ntp/var/run/ntp &>/dev/null + if [ "x$start_ntp" = "xinitial" ] ; then + echo -e "\t# entries added by $0 (InitRamFS from $date)\n\ +\t( ntpdate -s -b $ntp_servers >${LOGFILE} 2>&1 && {\n\t which \ +hwclock &>/dev/null && hwclock -w;} ) &" \ + >>/mnt/etc/${D_INITDIR}/boot.ld + elif [ "x$start_ntp" = "xyes" ] ; then + rllinker "ntp" + fi +fi +} + +# function for atd (unchecked) +config_atd () { +if [ "x$start_atd" = "xyes" ]; then + rllinker "atd" +fi +} + +# cron service +config_cron () { +if [ "x$start_cron" = "xyes" ] ; then + if [ -f /mnt/etc/init.d/cron ] ; then + : + else + error " The cron start script seems not to be installed, so requesting \ +\n the start of cron services make no sense." nonfatal + fi +fi +} + +# syslog service +config_syslog () { +if [ "x$start_syslog" = "xyes" ] ; then + if [ -f /mnt/etc/init.d/syslog-ng ] ; then + rllinker syslog-ng + else + error " The syslog start script does not seem to be installed, so \ +requesting\n the start of service does not make much sense." nonfatal + fi +fi +} + +# secure shell service +config_sshd () { +if [ "x$start_sshd" = "xyes" ] ; then + if [ -f /mnt/etc/init.d/sshd ] ; then + rllinker "sshd" + else + error " The sshd start script does not seem to be installed, so \ +requesting\n the start of service does not make much sense." nonfatal + fi +fi +} + +# snmp agent for remote monitoring (unchecked) +config_snmp () { +if [ "x$start_snmp" = "xyes" ] ; then + if [ -f /mnt/etc/init.d/snmpd ] ; then + rllinker "snmpd" + testmkd /mnt/var/lib/net-snmp >/dev/null 2>&1 + fi + # fixme!! + # write service monitor depending on services started + fi +} + +# configure X display manager (runlevel links and kind of manager) +config_xdm () { +if [ -f /mnt/etc/init.d/xdm ] ; then + sed -e "s,DISPLAYMANAGER=.*,DISPLAYMANAGER=\"xdm\"," /mnt/etc/rc.conf \ + > /etc/rc.conf + cp /etc/rc.conf /mnt/etc/rc.conf + ln -s /etc/init.d/xdm /mnt/etc/runlevels/boot/xdm + ln -s /etc/init.d/xdm /mnt/etc/runlevels/default/xdm + echo "xdm" >> /mnt/etc/runlevels/boot/.critical +fi +} + +# change entries in rc.conf (most for convenience only) +config_rc_entry () { +local var=$1 +local value=$2 +sed -e "s,$var=.*,$var=\"$value\"," /mnt/etc/rc.conf \ + > /etc/rc.conf +cp /etc/rc.conf /mnt/etc/rc.conf +} + +# configure gdm +config_gdm () { +config_rc_entry "DISPLAYMANAGER" "gdm" +# fixmee!! check for needed directories and permissions +#testmkd /mnt/var/lib/gdm +#testmkd /mnt/var/log/gdm +#strinfile "gdm:" /mnt/etc/passwd || echo "gdm:x:50:15:Gnome Display Manager \ +#Daemon:/var/lib/gdm:/bin/false" >>/mnt/etc/passwd +# hack - gdm should be user 50 and shadow group 15 +#chown 50:15 /mnt/var/lib/gdm /mnt/var/log/gdm +#chmod 0750 /mnt/var/lib/gdm /mnt/var/log/gdm +#rllinker "gdm" ?? +} + +# configure kdm as display manager +config_kdm () { +config_rc_entry "DISPLAYMANAGER" "kdm" +} + +# configure bluetooth services +config_bt () { +rllinker "bluetooth" +} + +# set consolefont +consolefont () { +echo -e "\tsetfont ${CONSOLE_FONT} >${LOGFILE} 2>&1\n" \ + >>/mnt/etc/${D_INITDIR}/boot.ld +config_rc_entry "CONSOLEFONT" "${CONSOLE_FONT}" +} + +# acpi and powersave +config_acpi () { +rllinker acpid +# remove dependencies (runs unneeded services ...) +sed "/depend/,/}/d" /mnt/etc/init.d/acpid > /etc/rls +cp /etc/rls /mnt/etc/init.d/acpid +} + +# configure dbus (inter application communication for kde and gnome), hal +# (hardware abstraction layer - used e.g. by powersaved) and resmgr +# (resource manager - the user gets permissions to devices when loggin on) +config_dreshal () { + : +} + +# configure automounter +config_automount () { +if [ -f /mnt/etc/init.d/autofs ] ; then + rllinker autofs + if [ -n "${automnt_src}" ] ; then + # local directory and home directory server from machine-setup + [ -z "${automnt_dir}" ] && automnt_dir="/home" + strinstr "/" "${automnt_dir}" && error " Only toplevel directories \ +are allowed as mount points for user home\n directories. Please set the \ +variable \${automnt_dir} appropriately in\n machine-setup file." nonfatal + automnt_dir=${automnt_dir#/} + echo -e "/home\t/etc/auto.${automnt_dir}\n" >> /mnt/etc/auto.master + echo -e "# /etc/auto.${automnt_dir} created by $0:\n" \ + > /mnt/etc/auto.${automnt_dir} + echo -e "*\t-rsize=32768,wsize=32768,rw\t${automnt_src}/&" \ + >> /mnt/etc/auto.${automnt_dir} + config_portmap + fi +else + error " Automounter seems not to be installed" nonfatal +fi +} + +# start name service caching daemon (recommended in combination with +# ldap source as user admin base) +config_nscd () { +if [ -f /mnt/etc/init.d/nscd ] ; then + #testmkd /mnt/var/run/nscd + rllinker "nscd" +fi +} + +# start portmapper (needed at least for nfs and nis services - unchecked) +config_portmap () { +rllinker "portmap" +} + +# start vmware and vmware preparation services +config_vmware () { +rllinker "vmware-prep" +rllinker "vmware" +} + diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3 index 39159383..f08517b6 100644 --- a/initrd/distro-specs/suse/functions-9.3 +++ b/initrd/distro-specs/suse/functions-9.3 @@ -125,6 +125,9 @@ if [ "x$start_syslog" = "xyes" ] ; then /mnt/etc/syslog-ng/syslog-ng.conf >> /etc/syslog-ng.conf cp /etc/syslog-ng.conf /mnt/etc/syslog-ng/syslog-ng.conf rllinker syslog "02" "20" + else + error " The syslog start script does not seem to be installed, so \ +requesting\n the start of service does not make much sense." nonfatal fi fi } diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 3c8731e7..fc04749b 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -117,11 +117,11 @@ case ${DISTRO} in ;; gentoo*) # rather different runlevel concept - rm /mnt/etc/*/.critical 2>/dev/null + rm /mnt/etc/runlevels/*/.critical 2>/dev/null for i in ${D_INITSCRIPTS}; do ln -sf /etc${D_INITDIR}/$i /mnt/etc/${D_INITBOOTD}/$i echo $i >> /mnt/etc/${D_INITBOOTD}/.critical - echo $i >> /mnt/etc/default/.critical + echo $i >> /mnt/etc/runlevels/default/.critical done # ( for i in /mnt/etc/init.d/*; do diff --git a/initrd/initrd-stuff/etc/vmware-prep b/initrd/initrd-stuff/etc/vmware-prep index 4421a1c5..c7cd90dc 100644 --- a/initrd/initrd-stuff/etc/vmware-prep +++ b/initrd/initrd-stuff/etc/vmware-prep @@ -42,7 +42,7 @@ mount_loop () { mkdir -p /media/loop0 cp ${vmdir}/templ/fd0.img /tmp/${clientip}-fd0.img chmod a+rw /tmp/${clientip}-fd0.img - mount -t msdos -o loop,umask=000 /tmp/${clientip}-fd0.img \ + mount -n -t msdos -o loop,umask=000 /tmp/${clientip}-fd0.img \ /media/loop0 } -- cgit v1.2.3-55-g7522