From 6e7ef11152c910101d66d10b418d1b27f566ec3a Mon Sep 17 00:00:00 2001 From: Nico Dietrich Date: Thu, 12 Jan 2006 17:44:55 +0000 Subject: Ersteinstellung von ld v4 ins SVN git-svn-id: http://svn.openslx.org/svn/openslx/dxs/ld4@11 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/initrd-stuff/bin/servconfig | 260 +++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100755 initrd/initrd-stuff/bin/servconfig (limited to 'initrd/initrd-stuff/bin/servconfig') diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig new file mode 100755 index 00000000..0fda5df9 --- /dev/null +++ b/initrd/initrd-stuff/bin/servconfig @@ -0,0 +1,260 @@ +#!/bin/sh +# +# Description: universal (distro independent) configuration script +# for linux diskless clients (executed within initial +# ramdisk) +# +# Author(s): Dirk von Suchodoletz , 08-01-2006 +# Blabla +# Blub +# +# Copyright: (c) 2006 - RZ Universitaet Freiburg +# +# Version: 0.0.1b + +# check for configuration files to source + +# functions common for all distros +. /etc/functions +# load distro specific configuration variables and functions. distro +# specific functions may overwrite functions defined in /etc/functions +. /etc/sysconfig/config +. /etc/distro-functions +# get location of logfile definition +. /mnt/etc/${SYSCONFDIR}/logfile + +####################################################################### +# copy distro specific scripts, programs, libraries and configs +cp -a /etc/sysconfig/files/* /mnt & + +# set greeting +echo " + WELCOME TO \n (\l) + __ __ ___ __ __ __ __ __ __ + | | | || | || | | || |_| | | | + | | | || || | | | / |__| + | |___ | || | || |_| | / _ __ + |______||__||__| |__| _____/ |__| |__| |__| + + Diskless Workstation (v4.0) (c) +">/mnt/etc/issue + +####################################################################### +# read and unify configuration options - default configuration file, +# from dhcp, ldap ... +# wait for the appearance of configuration via dhcp +# do not wait if dhcp is not used (how?) +waitfor /tmp/dhcp-done 10000 || error " Did not get any configuration \ +data via dhcp until now ..." nonfatal +waitfor /tmp/ldap-done 10000 || error " Did not get any configuration \ +data via dhcp until now ..." nonfatal +. /etc/machine-setup + +####################################################################### +# set localization +if [ -z "$country" ] ; then + msg "servconfig" "No configuration for localization found in config file. \ +Using default\ncountry setting '${DEFAULTCOUNTRY}' defined in $0." + country=${DEFAULTCOUNTRY} +fi +localization $country + +####################################################################### +# dns and ip configuration +# hostname of the machine +echo "$host_name" >/proc/sys/kernel/hostname +echo -e "# /etc/hosts - file generated by\n#\t$0:\n#\t$date\ +\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\ +127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\ +fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\ +\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\ +ipv6-allhosts\n" >/mnt/etc/hosts +echo -e "$clientip\t$host_name.$domain $host_name\n" >>/mnt/etc/hosts + +# set up domainname and resolving +test -n "$domain_name" && \ + echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\ +#\t$date\n#options timeout:1 attempts:1 rotate\n\ +search "$domain_name >/mnt/etc/resolv.conf +test -n "$domain_name_servers" && { + for nameserver in $domain_name_servers; do + echo nameserver $nameserver >>/mnt/etc/resolv.conf; + done; } + +####################################################################### +# initial boot scripts +# delete and create runlevel links for initial booting (SuSE, Debian, +# ...) +case ${DISTRO} in + suse*|debian*|ubuntu*) + for i in ${RCDIRS} ${INITBOOTD} ; do + rm -f /mnt/etc/$i/* + done + count=10 + for i in ${INITSCRIPTS}; do + count=`expr $count + 1` + revcnt=`expr 41 - $count` + ln -sf /etc${INITDIR}/$i /mnt/etc/init.d/boot.d/S${count}$i + ln -sf /etc${INITDIR}/$i /mnt/etc/init.d/boot.d/K${revcnt}$i + done + ;; + gentoo*) + ;; +esac + + +####################################################################### +# +# boot.local +if [ -n "$bootlocal_script" ]; then + echo -e "# entries added by $0:\n#\t$date\n\n\ +$bootlocal_script" >> /mnt/etc/${INITDIR}/boot.local +fi + +# setup nis configuration if needed +if [ "x$nis_domain" != "x" ] && [ "x$nis_servers" != "x" ] ; then + echo $nis_domain >/mnt/etc/defaultdomain + echo -e "# /etc/yp.conf - file generated by $0:\n\ +#\t$date\n\nypserver "$nis_servers >/mnt/etc/yp.conf + strinfile "+::::::" /mnt/etc/passwd || echo "+::::::" >>/mnt/etc/passwd +fi + +####################################################################### +# basic (non network) services + +# at daemon +config_atd "14" "04" + +# configuration of cron services +[ "x$crontab_entries" != "x" ] && \ + echo -e "$crontab_entries" >> /mnt/etc/crontab +config_cron "16" "04" + +####################################################################### +# network(ed) services + +# network time service (ntp) configuration file +if [ -n "$ntp_servers" ]; then + echo -e "# /etc/ntp.conf - file generated by $0: \ +$date\n" >/mnt/etc/ntp.conf; + for ntpserver in $ntp_servers; do + echo server $ntpserver >>/mnt/etc/ntp.conf; + done +fi +# copy timezone file defined with language settings +[ -z "$TZ" ] && TZ="$timezone" +cp /mnt/usr/share/zoneinfo/${TZ} /mnt/etc/localtime 2>/dev/null || \ + error " No such timezone data file (needed for ntp time service \ +configuration)." nonfatal +config_ntp 07 14 + +# secure shell server +config_sshd 12 10 + +# simple network management protocol agent +config_snmp 24 02 + +####################################################################### +# X11/GUI stuff +if [ "x$start_x" != "xno" ] ; then + # creating directories commonly needed for X11 in all distros + # rest should be done via config_x11 function (distro specific) + for i in /var/lib/xkb/ \ + /etc/X11/xdm \ + /etc/X11/sessions \ + /var/X11R6/bin \ + /tmp/.ICE-unix \ + /tmp/.X11-unix; do testmkd /mnt/$i; done + chmod a+rwxt /mnt/tmp/.ICE-unix + chmod a+rwxt /mnt/tmp/.X11-unix + echo "" > /mnt/etc/X11/xdm/Xservers + # define additional sessions offered to the user (via dhcp/ldap config) + descsession + # write available X display manager to /etc/X11/xdm/Xaccess + [ -n "$x_display_manager" ] && \ + echo -e "# /etc/X11/xdm/Xaccess - file generated by $0: \ +$date\n*\n%hostlist\t$x_display_manager\n*\t\tCHOOSER %hostlist"\ + >/etc/X11/xdm/Xaccess + + # define type of X session + dsx="no" + init="#7:5:respawn:/usr/X11R6/bin/X vt7 -quiet" + case "$start_x" in + yes|YES|direct|DIRECT|query|QUERY) + # direct connection onto the own displaymanager, which + # should be enabled then + [ "x$start_xdmcp" = "xno" ] && $start_xdmcp="yes" + init="" + dsx="yes" + xdmcp="false" + echo -e "# /etc/X11/Xservers - file generated by \ +$0: $date\n:0 local /usr/X11R6/bin/X :0 vt07\n" >/mnt/etc/X11/xdm/Xservers + ;; + broadcast|BROADCAST) + # the client will XDMCP broadcast and choose first available + # X11 server + [ "x$start_xdmcp" = "xgdm" ] || init="$init -broadcast" + ;; + indirect|INDIRECT) + # the client will try to XDMCP connect list of X11 servers + if [ "x$start_xdmcp" = "xgdm" ] ; then + init="" + else + init="$init -indirect $host_name" + fi + [ "x$start_xdmcp" = "xno" ] && start_xdmcp="yes" + xdmcp="true" + ;; + *) + # fixme!! not optimal for fast start + # no display manager needed in kiosk mode + # in this mode you have to provide the type of X session to start + [ x$start_xdmcp != "x" ] || start_xdmcp="no"; + init="#7:5:respawn:/var/X11R6/bin/kiosk /dev/tty7" + echo -e "#!/bin/sh\n# /var/X11R6/bin/kiosk - file generated by $0: \ +$date\nresmgr login nobody tty7\nresmgr grant nobody desktop\n\ +chown nobody /dev/dsp*\n\ +su -c 'xinit /etc/init.d/startgui $start_x -- vt7 -quiet' -l nobody &>/dev/null\n\ +resmgr revoke nobody\nresmgr logout tty7\nkillall X\nsleep 2" \ + >/mnt/var/X11R6/bin/kiosk + chmod a+x /mnt/var/X11R6/bin/kiosk & + ;; + esac + # enable runlevel 5 (X11 gui under SuSE linux) + # grep -v -e "7:[35]" /etc/inittab > /etc/inittab.new + # [ -z "$init" ] || { + echo -e "# entry made by $0 $date\n$init" >> /mnt/etc/inittab +fi + +# setup requested display manager +if [ "x$start_xdmcp" != "xno" ] ; then + testmkd /mnt/var/lib/xdm/authdir/authfiles + testmkd /mnt/var/run/xdmctl + if [ "$start_xdmcp" = "yes" ] ; then + start_xdmcp=kdm + fi + case "$start_xdmcp" in + wdm|WDM) + # anywhere in use!? + ;; + esac + # setup xdm (as fallback) in any case + echo -e "# /etc/X11/xdm/xdm-config - file generated by\n\ +#\t$0: $date\n\nDisplayManager.errorLogFile:\t/var/log/xdm.errors\n\ +DisplayManager.pidFile:\t\t/var/run/xdm.pid\n\ +DisplayManager.authDir:\t\t/var/lib/xdm\n\ +DisplayManager.keyFile:\t\t/etc/X11/xdm/xdm-keys\n\ +DisplayManager.servers:\t\t/etc/X11/xdm/Xservers\n\ +DisplayManager.accessFile:\t/etc/X11/xdm/Xaccess\n\ +DisplayManager.willing:\t\tsu nobody -c /etc/X11/xdm/Xwilling\n\ +DisplayManager.*.authName:\tMIT-MAGIC-COOKIE-1\n\ +DisplayManager.*.authComplain:\tfalse\n\ +DisplayManager.*.setup:\t\t/etc/X11/xdm/Xsetup\n\ +DisplayManager.*.chooser:\t/etc/X11/xdm/RunChooser\n\ +DisplayManager.*.startup:\t/etc/X11/xdm/Xstartup\n\ +DisplayManager.*.session:\t/etc/X11/xdm/Xsession\n\ +DisplayManager.*.reset:\t\t/etc/X11/xdm/Xreset" >/mnt/etc/X11/xdm/xdm-config + [ "$xdmcp" = "false" ] && echo -e \ + "DisplayManager.requestPort:\t0\n" >>/mnt/etc/X11/xdm/xdm-config + config_dm +fi -- cgit v1.2.3-55-g7522