diff options
Diffstat (limited to 'initramfs/initrd-stuff/bin')
-rwxr-xr-x | initramfs/initrd-stuff/bin/ddcprobe | bin | 0 -> 28376 bytes | |||
-rwxr-xr-x | initramfs/initrd-stuff/bin/dhcpmkconfig | 68 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/bin/hwautocfg | 461 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/bin/hwsetup | bin | 0 -> 123832 bytes | |||
-rwxr-xr-x | initramfs/initrd-stuff/bin/run-init | bin | 0 -> 10832 bytes | |||
-rwxr-xr-x | initramfs/initrd-stuff/bin/screenres | 226 | ||||
-rwxr-xr-x | initramfs/initrd-stuff/bin/servconfig | 521 |
7 files changed, 1276 insertions, 0 deletions
diff --git a/initramfs/initrd-stuff/bin/ddcprobe b/initramfs/initrd-stuff/bin/ddcprobe Binary files differnew file mode 100755 index 00000000..132a1671 --- /dev/null +++ b/initramfs/initrd-stuff/bin/ddcprobe diff --git a/initramfs/initrd-stuff/bin/dhcpmkconfig b/initramfs/initrd-stuff/bin/dhcpmkconfig new file mode 100755 index 00000000..ded4caaa --- /dev/null +++ b/initramfs/initrd-stuff/bin/dhcpmkconfig @@ -0,0 +1,68 @@ +#!/bin/sh +# +# universal (distro independent) IP configuration writer for several dhcp +# clients used within OpenSLX initramfs. The result is written in unified +# form to the /etc/machine-setup file +# +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 03-09-2006 +# Lars Mueller, 23-06-2006 +# Oliver Tappe, 23-06-2006 +# +# (c) 2006 - RZ Universitaet Freiburg + +# client variable should be exported via calling function +cfgfile="/tmp/confviadhcp" +cfgmsg="\n## Configuration written by $0" +infomsg="# --> You are using $dhcl. With this client you are not \ +able to\n# transfer any vendor specific, self defined dhcp options. If \ +this is\n# intended, use dhclient instead or get them via tftp (to be \ +enabled\n# via kernel command line)." +# heavy debugging output in level 3 and above ... and on 13 +#FIXME: DEBUGLEVEL is not propagated to this file (at least for Ubuntu) +[ -z "$DEBUGLEVEL" ] && DEBUGLEVEL=0 +[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 13 ] && \ + set -x +case $0 in + *dhcpcd*) + dhcl="dhcpcd"; echo -e "$cfgmsg\n$infomsg" >>/tmp/confviadhcp + sed -e "s,',\",g;s,IPADDR,clientip,;s,NETMASK,subnet_mask," \ + -e "s,GATEWAY,gateway,;s,BROADCAST,broadcast_address," \ + -e "s,HOSTNAME,host_name,;s,DOMAIN,domain_name," \ + -e "s,ROOTPATH,root_path,;s,DNS,domain_name_servers," \ + -e "s,NTPSERVERS,ntp_servers,;s,DHCPSID,serverip," \ + -e "s,WINSSERVERS,netbios_name_servers," \ + -e "s,NETWORK,network," \ + -e "s,DHCP..ADDR.*,,;s,.*TIME=.*,,;s,CL.*,,;/^$/d" \ + -e "s,INTER.*,,;s,DHCPSNAME.*,," /var/lib/dhcp/dhcpcd-eth0.info \ + >>$cfgfile + ;; + *dhclient*) + if [ $reason = "BOUND" ] ; then + echo -e "$cfgmsg\n# --> You are using dhclient. If you wish to \ +transfer other vendor/user\n# specific variables, you have to add \ +them in functions and in\n# dhcpmkconfig script or use tftp (to be \ +enabled via kernel command\n# line)." >>$cfgfile + set | sed -n -e '/^new/p' | sed \ + -e "s,^new_,,;s,fixed_address,clientip," \ + -e "s,routers,gateway,;s,dhcp_server_identifier,serverip," \ + -e "s,.*_t[iy][mp]e.*,,;s,.*_message_.*,,;/^$/d" \ + -e "s,language=,country=,;s,ip_address,clientip," \ + >>$cfgfile + fi + ;; + *pump*) + dhcl="pump"; echo -e "$cfgmsg\n$infomsg" >>$cfgfile + ;; + *udhcpc*) + dhcl="udhcpc"; echo -e "$cfgmsg\n$infomsg" >>$cfgfile + unset infomsg HOME IFS mask lease interface + set | sed \ + -e "s,^P.*,,;s,ntpsrv,ntp_servers,;s,ip,clientip," \ + -e "s,serverid,serverip,;s,subnet,subnet_mask," \ + -e "s,router,gateway,;s,hostname,host_name," \ + -e "s,dns,domain_name_servers,;s,domain,domain_name," \ + -e "s,broadcast,broadcast_address,;s,dhc.*,,;/^$/d" \ + >>$cfgfile + ;; +esac + diff --git a/initramfs/initrd-stuff/bin/hwautocfg b/initramfs/initrd-stuff/bin/hwautocfg new file mode 100755 index 00000000..edf77430 --- /dev/null +++ b/initramfs/initrd-stuff/bin/hwautocfg @@ -0,0 +1,461 @@ +#!/bin/sh +# +# universal (distro independent) hardware autoconfiguration script for +# OpenSLX linux diskless clients, using hwconfig from knoppix as base tool +# +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 03-09-2006 +# +# (c) 2003 - 2006 - RZ Universitaet Freiburg +# (c) 2006 - OpenSLX.org + +# local functions used within hwautocfg +displaysetup () { +# (temporary) configuration file +local xfc=$1 +# define some defaults +local HSYNCRANGE="31.5-63.5" +local VSYNCRANGE="60-90" +local DEFAULTMODES='"1024x768" "800x600" "640x480"' +local DEFAULTCOLORDPT=24 +# set variables representing the xorg.conf sections (version 6.9.x) +local Module='\tLoad\t\t"dbe"\n +\tLoad\t\t"extmod"\n +\tLoad\t\t"type1"\n +\tLoad\t\t"speedo"\n +\tLoad\t\t"freetype"\n +\tLoad\t\t"v4l"' +local ServerFlags='\tOption\t\t"AllowMouseOpenFail"\n +\tOption\t\t"blank time"\t\t"5"\n +\tOption\t\t"standby time"\t\t"10"\n +\tOption\t\t"suspend time"\t\t"15"\n +\tOption\t\t"off time"\t\t"20"' +local Files='\tRgbPath\t\t"/usr/X11R6/lib/X11/rgb"\n +\tModulePath\t"/etc/X11/modules"\n +\tModulePath\t"/usr/X11R6/lib/modules"\n +\tFontPath\t"/usr/X11R6/lib/X11/fonts/misc/:unscaled"\n +\tFontPath\t"/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"\n +\tFontPath\t"/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"' +local InputDevice='\tIdentifier\t"Keyboard1"\n +\tDriver\t\t"keyboard"\n +\tOption\t\t"XkbRules"\t\t"xfree86"\n +\tOption\t\t"XkbLayout"\t\t"XKEYBOARD"\n +\tOption\t\t"XkbModel"\t\t"pc105"' +local InputMouseDef='\tIdentifier "Mouse1"\n +\tDriver\t\t"mouse"\n +\tOption\t\t"Protocol"\t\t"imps/2"\n +\tOption\t\t"Device"\t\t"/dev/input/mice"\n +\tOption\t\t"Emulate3Buttons"\n +\tOption\t\t"ZAxisMapping"\t\t"4 5"\n +\tOption\t\t"Buttons"\t\t"3"' +local InputMouseSyn='\tIdentifier "Mouse1"\n +\tDriver\t\t"synaptics"\n +\tOption\t\t"Protocol"\t\t"explorerps/2"\n +\tOption\t\t"Device"\t\t"/dev/input/mice"\n +\tOption\t\t"Emulate3Buttons"\t"on"\n +\tOption\t\t"Buttons"\t\t"5"\n +\tOption\t\t"InputFashion"\t\t"Mouse"\n +\tOption\t\t"SHMConfig"\t\t"on"\n +\tOption\t\t"ZAxisMapping"\t\t"4 5"' +local Monitor='\tIdentifier "Default"\n +\tModelName\t"MODEL"\n +\tOption\t\t"CalcAlgorithm"\t"CheckDesktopGeometry"\n +\tHorizSync\tHS\n +\tVertRefresh\tVS\n +\tOption\t"DPMS"\t\t"true"' +local Device='\tIdentifier\t"StdGraphics"\n +\tVendorName\t"XDESC"\n +\tDriver\t\t"XMODULE"' +local Screen='\tIdentifier\t"Screen 1"\n +\tDevice\t\t"StdGraphics"\n +\tMonitor\t\t"Default"\n +\tDefaultColorDepth CDP' +local ServerLayout='\tIdentifier\t"Simple Layout"\n +\tScreen\t\t"Screen 1"\n +\tInputDevice\t"Keyboard1"\t"CoreKeyboard"\n +\tInputDevice\t"Mouse1"\t"CorePointer"\n +\tOption\t\t"BlankTime"\t"5"\n +\tOption\t\t"StandbyTime"\t"10"\n +\tOption\t\t"SuspendTime"\t"20"\n +\tOption\t\t"OffTime"\t"30"' +local DRI='\tGroup\t\t"video"\n +\tMode\t\t0666' + +# displayvars may overwrite the above settings +displayvars + +if [ -n "$hw_graphic" ] ; then + DRV=${hw_graphic% *} + CDP=${hw_graphic##* } + if [ -z "$DRV" ] ; then error "$hcfg_gfxdrv" nonfatal + XMODULE=vesa + fi +fi +if [ -z "$CDP" ] ; then error "$hcfg_gfxcdp" nonfatal + CDP=${DEFAULTCOLORDPT} +fi + +if [ -n "$hw_monitor" ] ; then + # just cut all starting from k(Hz) ... + HS=${hw_monitor%k*} + VS=${hw_monitor%Hz*} + [ "${hw_monitor}" == "$VS" ] && VS=${hw_monitor%hz*} + VS=${VS##* } + SCR_MODES="\"${hw_monitor##* }\"" +else + # gather information about the monitor capabilities + screenres > /tmp/screenres + VERTSR=`cat /tmp/screenres | sed -n \ + '/Vertical Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` + HORISR=`cat /tmp/screenres | sed -n \ + '/Horizontal Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` + HS=$HORISR + VS=$VERTSR + # compute max resolution + SCR_MODES=`cat /tmp/screenres | sed -n \ + '/Recommended Screen Modes:/s/[^"]*\(.*\)/\1/p'` +fi + +if [ -z "$HS" ] ; then #error "$hcfg_hfrq" nonfatal + HS=${HSYNCRANGE} +fi +if [ -z "$VS" ] ; then #error "$hcfg_vfrq" nonfatal + VS=${VSYNCRANGE} +fi +if [ -z "$SCR_MODES" ] ; then #error "$hcfg_res" nonfatal + SCR_MODES=${DEFAULTMODES} +fi +monmanual=yes + +# check for special X driver (fglrx, nvidia, ...) +check_glx + +# finally write config file +echo -e "#\n# autogenerated X hardware configuration by $0\n# \ +Dirk von Suchodoletz <dirk@goe.net>, $date" >$xfc +echo -e "# DO NOT EDIT THIS FILE BUT '$0' INSTEAD!\n#" \ + >>$xfc +for section in Files ServerFlags Module InputDevice Monitor \ + Screen Device ServerLayout DRI ; do + echo "Section \"$section\"" >>$xfc + case "$section" in + Files) + echo -e ${Files} >>$xfc + # check for 64bit CPU/installation (fixme!!) + [ -n "$amd64" ] && \ + echo '"\tModulePath\t"/usr/X11R6/lib64/modules"\n' >>$xfc + for i in ${D_XFONTPATH} ; do + echo -e "\tFontPath\t\"$i/\"" >>$xfc ; done + ;; + ServerFlags) + echo -e ${ServerFlags} >>$xfc + ;; + Device) + echo -e ${Device} | \ + sed -e "s,XMODULE,${XMODULE}," -e "s%XDESC%${XDESC}%" >>$xfc + # write TV config - no problem, if no TV is connected + [ -n "$TVOUT" ] && echo -e $TVOUT >>$xfc + [ x$DRV = "xs3virge" ] && \ + echo -e "\tOption\t\t\"XVideo\" \"Off\"\n" >>$xfc + [ x$DRV = "xnvidia" ] && { + echo -e "\tOption\t\t\"NvAGP\" \"3\"" >>$xfc + echo -e "\tOption\t\t\"NoLogo\" \"1\"" >>$xfc ; } + ;; + Module) + echo -e ${Module} >>$xfc + #[ "x$DRM" = "xyes" ] && \ + echo -e "\tLoad\t\t\"dri\"" >>$xfc + [ x$GLX != "xno" ] && \ + echo -e "\tLoad\t\t\"glx\"" >>$xfc + ;; + Monitor) + echo -e ${Monitor} | \ + sed -e "s,HS,${HS},g" -e "s,VS,${VS},g" >>$xfc + ;; + InputDevice) + echo -e ${InputDevice} | sed -e "s,XKEYBOARD,${XKEYBOARD},g" \ + >>$xfc + [ "${XKEYBOARD}" = "de" ] && \ + echo -e '\tOption\t\t"XkbVariant"\t\t"nodeadkeys"' >>$xfc + echo -e "EndSection\n\nSection \"$section\"" >>$xfc + # if special synaptics touchpad was detected and specific driver + # is present + if strinfile "synaptics" /tmp/hwsetup.info && \ + test -e /mnt/usr/X11R6/lib/modules/input/synaptics_drv.o ; then + echo -e $InputMouseSyn >>$xfc + else + echo -e $InputMouseDef >>$xfc + fi + ;; + Screen) + echo -e ${Screen} | sed -e "s,CDP,${CDP}," >>$xfc + for BPP in 15 16 24 + do echo -e '\tSubSection "Display"\n\t\tDepth\t'\ + $BPP'\n\t\tModes\t'$SCR_MODES'\n\tEndSubSection' >>$xfc + [ $BPP = "$CDP" ] && break + done + ;; + ServerLayout) + echo -e ${ServerLayout} >>$xfc + ;; + DRI) + echo -e ${DRI} >>$xfc + ;; + esac + echo -e "EndSection\n" >>$xfc +done +} + +####################################################################### +# script starts here + +# functions common for all distros +. /etc/functions +# functions common for all distros, messages contains all error and +# info output +. /etc/messages +# load distro specific configuration variables and functions. distro +# specific functions may overwrite functions defined in /etc/functions +. /etc/sysconfig/config +. /etc/distro-functions + +# script run timer +[ $DEBUGLEVEL -eq 8 ] && echo "** HW setup started at $(sysup)" + +# heavy debugging output in level 3 and above and specific for 11 +[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 11 ] && \ + set -x + +# set X11 configuration file +if [ -n "${D_XF86CONFFILE}" ] ; then + D_XF86CONFFILE="/mnt/${D_XF86CONFFILE}" +else + D_XF86CONFFILE="/mnt/etc/X11/xorg.conf" + error "$hcfg_xcfg" nonfatal +fi + +# USB core is needed for presence of /proc/bus/usb +modprobe ${MODPRV} usbcore & + +# "drivers" (pseudo, placeholder strings, ...) to exclude from loading +# depending on distro more hw modules have to be excluded too. use the +# D_HWMODTOIGNORE for that purpose +DRIVERLIST=" disabled unknown ignore pcspkr synaptics keybdev kanotix\ + ${D_HWMODTOIGNORE} " +# driver blacklist (real modules which fail to load) +DRIVERLIST=${DRIVERLIST}"hw_random genericwheelusb " +# hack for pseudo modules (not to load) hopefully "usbcore" is present +# as a module, might be exchanged with any other existing ... +for i in $DRIVERLIST ; do + echo -e "alias\t$i\tusbcore" >> /etc/modprobe.conf +done + +# load kernel module for ps2 mice +[ -f /lib/modules/${KERNEL}/kernel/drivers/input/mouse/psmouse.ko ] && \ + modprobe ${MODPRV} psmouse + +# and map the mousehandler to /dev/input/mice +[ -f /lib/modules/${KERNEL}/kernel/drivers/input/mousedev.ko ] && \ + modprobe ${MODPRV} mousedev + +# start the knoppix hardware autodetection tool +( hwsetup -v > /tmp/hwsetup.info && echo "hwsetup" > /tmp/hwrun1 ) & + +# ACPI configuration - at least not needed with SuSE 9.3/10.0 +# needed for other distros? + +# AGP configuration (agpgart and chipset specific driver) +modprobe ${MODPRV} agpgart || \ + modprobe ${MODPRV} agpgart agp_try_unsupported=1 + +# wait for /tmp/hwsetup.info to appear +waitfor /tmp/hwrun1 50000 || \ + error "$hcfg_hwsetup" +# load ide drivers first, takes a while to initialize +for DRIVER in cmd64x hpt366 piix slc90e66 cs5520 it821x rz1000 \ + triflex aec62xx cs5530 ns87415 sc1200 trm290 alim15x3 \ + cy82c693 opti621 serverworks via82cxxx amd74xx pdc202xx_new \ + siimage atiixp hpt34x pdc202xx_old sis5513; do + strinfile " ${DRIVER}" /tmp/hwsetup.info && { + IDE="yes" + modprobe ${MODPRV} ${DRIVER} & + DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } +done +# check for IDE/SCSI (SATA) +for DRIVER in ata_piix sata_via sata_nv sata_sil sata_sis sata_svw \ + sata_sx4 sata_uli sata_vsc sata_qstor sata_promise sata_mv; do + strinfile " ${DRIVER}" /tmp/hwsetup.info && { + #SCSIIDE="yes" + modprobe ${MODPRV} ${DRIVER} & + DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } +done +# check for USB, pcmcia and ieee1394 hardware drivers +for DRIVER in ohci-hcd uhci-hcd ehci-hcd ohci1394; do + strinfile " ${DRIVER}" /tmp/hwsetup.info && { + USB="yes" + modprobe ${MODPRV} ${DRIVER} + DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } +done +# load usbhid (for USB keyboard/mouse) or remove usbcore module if USB +# not present +if [ -n "$USB" ] ; then + modprobe ${MODPRV} usbhid & +else rmmod usbcore +fi +# remove unneeded network card modules +for DRIVER in ${NWMODULES}; do + strinfile " ${DRIVER}" /tmp/hwsetup.info || { + rmmod ${DRIVER} & + DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } +done +# check for PCMCIA / cardbus stuff +for DRIVER in yenta_socket i82365 pd6729 tcic; do + strinfile ${DRIVER} /tmp/hwsetup.info && { + modprobe ${MODPRV} ${DRIVER} + DRIVERLIST="${DRIVERLIST} ${DRIVER}" + PCMCIA="yes"; } +done +# should we check for card reader modules too? + +if [ -n "${PCMCIA}" ] ; then + modprobe ${MODPRV} ds +fi +# sound card setup (alsa and oss compatibility drivers) +if [ -f /etc/sysconfig/sound ] ; then + . /etc/sysconfig/sound +else DRIVER="snd-dummy" +fi +# problem with a specific module not disabled (via above trick) when +# busybox is used +# rmmod snd_atiixp_modem snd_atiixp +modprobe ${MODPRV} ${DRIVER} +DRIVERLIST="${DRIVERLIST} ${DRIVER} " +modprobe ${MODPRV} snd-pcm-oss +modprobe ${MODPRV} snd-mixer-oss + +# rerun the knoppix hardware autodetection tool for USB and ide devices +# like dvd or harddisk - wait a few seconds so hopefully the ide driver +# is initialized +test -f /proc/bus/usb/devices || mount -n -t usbfs usbfs /proc/bus/usb +[ -n "$IDE" ] && modprobe -q ide_generic 2>/dev/null +usleep 10 && hwsetup -v > /tmp/hwsetup.info +# remaining drivers listed in /tmp/hwsetup.info +cat /tmp/hwsetup.info| while read LINE ; do + if strinstr "driver:" "${LINE}"; then + DRIVER=${LINE##driver: } + if ! strinstr " ${DRIVER} " "${DRIVERLIST}"; then + strinstr "Card:" "${DRIVER}" || strinstr "ps/2" "${DRIVER}" || { + modprobe ${MODPRV} ${DRIVER} & + usleep 8; } + DRIVERLIST="${DRIVERLIST} ${DRIVER}" + fi + fi +done +# check if USB mouse and/or keyboard is connected and remove usbhid if +# not +strinfile "genericwheelusb" /tmp/hwsetup.info || \ + (strinfile "keybdev" /tmp/hwsetup.info || rmmod usbhid) + +# load IDE high level drivers +if [ -n "$IDE" ] ; then + # you might want to check /etc/sysconfig/floppy for more info + strinfile "ZIP" /tmp/hwsetup.info && modprobe ${MODPRV} ide-floppy + strinfile "CDROM" /tmp/hwsetup.info && modprobe ${MODPRV} ide-cd + strinfile "HD" /tmp/hwsetup.info && modprobe ${MODPRV} ide-disk +fi + +# not rather precise ... +if strinfile "SCSI" /tmp/hwsetup.info ; then + strinfile "CDROM" /tmp/hwsetup.info && { modprobe ${MODPRV} sr_mod; + modprobe ${MODPRV} sg; } + strinfile "HD" /tmp/hwsetup.info && modprobe ${MODPRV} sd_mod + strinfile "SCANNER" /tmp/hwsetup.info && \ + echo -e 'KERNEL=="sg*",\t\tNAME="%k", GROUP="disk", MODE="666"' \ + >> /mnt/etc/udev/rules.d/04-scanner.rules +fi +# fixme - psmouse entladen, falls nicht vorhanden + +# configure some variables from configuration file - wait for dhcp or ldap +# confiurator to complete +cfgcomplete +. /etc/machine-setup + +# run localizator and configure keyboard and console fonts +DEFKEYTABLE="de-latin1-nodeadkeys" +localization $country +if [ -z "${KEYTABLE}" ] ; then + error "$hcfg_keyb" nonfatal + KEYTABLE=${DEFKEYTABLE} +fi + +# run X11 / Xorg configurator if no xorg.conf file was provided by +# ConfigTGZ (check for /rootfs/${D_XF86CONFFILE#/mnt}) +if [ -f /rootfs${D_XF86CONFFILE#/mnt} ] ; then + echo "ready" > /tmp/xready +else + . /etc/sysconfig/xserver >/dev/null 2>&1 || error "$hcfg_hwsetup" nonfatal + ( displaysetup /etc/xorg.conf; echo "ready" > /tmp/xready ) & +fi + +# get idea of availabe harddisk partitions, put swap partitions into +# (/mnt)/etc/fstab and format and mount partitions of type 44 (unknown) +for hd in $(cat /tmp/hwsetup.info|sed -n -e '/HD$/,/device:/p'| \ + sed -n -e '/device:/p' | sed -e 's/device: //') ; do + fdisk -l /dev/$hd| sed -n "/^\/dev\//p" > /tmp/hd_part + for hdpartnr in $(cat /tmp/hd_part | \ + sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do + echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> /tmp/fstab + done + # we use special non assigned partition type (id44) for harddisk scratch + # space, thus no normal filesystem will be incidentally deleted or + # corrupted + for hdpartnr in $(cat /tmp/hd_part | \ + sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do + # ext2fs_check_if_mount message supressed + ( mkfs.ext2 -Fq $hdpartnr 2>/dev/null + umount /mnt/tmp 2>/dev/null + # if mounting of temp partion fails fall back to tmpfs on /tmp + mount -n -o nocheck,noexec $hdpartnr /mnt/tmp 2>/dev/null || \ + mount -n -t tmpfs none /mnt/tmp + echo "$hdpartnr is mounted to /tmp" > /tmp/tmpready ) & + echo -e "$hdpartnr\t/tmp\t\text2\t\tdefaults\t 0 0" >> /tmp/fstab + part44=yes + break + done + # put detected linux partitions into /etc/fstab with "noauto" + for hdpartnr in $(cat /tmp/hd_part | \ + sed -n -e "/ 83 /p"|sed -e "s/[[:space:]].*//") ; do + mkdir -p /mnt/media/${hdpartnr#/dev/*} 2>/dev/null + echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\ +noexec\t 0 0" >> /tmp/fstab + done +done +# determine if tmp preparation should wait for format/mount or not +[ -z "$part44" ] && echo "finished" > /tmp/tmpready + +# wait for completion of clients root filesystem in /mnt +waitfor /tmp/fscmpl 40000 +[ -f /tmp/fstab ] && cat /tmp/fstab >> /mnt/etc/fstab + +# add entries to initialize keytable and consolefont to boot.ld +# postpone some commands into normal bootup environment +echo -e "\t# entries added by $0: $date" >> /mnt/etc/${D_INITDIR}/boot.ld +[ -n "${KEYTABLE}" ] && keytable +[ -n "${CONSOLE_FONT}" ] && consolefont + +# finalize X configuration +# only if X is link itself (normally to /var/X11R6/bin/X) check!! +link=`ls -l /mnt/usr/X11R6/bin/X 2>/dev/null` +if strinstr "/var/X11R6" "$link" ; then + testmkd /mnt/var/X11R6/bin + for i in /usr/X11R6/bin/Xorg /usr/X11R6/bin/XFree86 ; do + [ -e "/mnt/$i" ] && { ln -sf $i /mnt/var/X11R6/bin/X; break; } + done +fi +# wait for completion of Xorg configuration +waitfor /tmp/xready 10000 +cp /etc/xorg.conf ${D_XF86CONFFILE} + +# script run timer +[ $DEBUGLEVEL -eq 8 ] && echo "** HW setup finished at $(sysup)" + +echo "finished" > /tmp/hwcfg diff --git a/initramfs/initrd-stuff/bin/hwsetup b/initramfs/initrd-stuff/bin/hwsetup Binary files differnew file mode 100755 index 00000000..1b6ab300 --- /dev/null +++ b/initramfs/initrd-stuff/bin/hwsetup diff --git a/initramfs/initrd-stuff/bin/run-init b/initramfs/initrd-stuff/bin/run-init Binary files differnew file mode 100755 index 00000000..556caeb6 --- /dev/null +++ b/initramfs/initrd-stuff/bin/run-init diff --git a/initramfs/initrd-stuff/bin/screenres b/initramfs/initrd-stuff/bin/screenres new file mode 100755 index 00000000..4a9f5fd9 --- /dev/null +++ b/initramfs/initrd-stuff/bin/screenres @@ -0,0 +1,226 @@ +#!/bin/sh +# +# Author(s): Felix Endres +# Dirk von Suchodoletz, 04-07-2006 +# +# Copyright: (c) 2006 - RZ Universitaet Freiburg +# +# Description: +# +# This script gives information about recommended display modes for the +# attached monitor + +# The script tries to guess whether the attached monitor is a lcd or +# a crt based on age, display size and pixel size. +# For CRTs the script tries to determine which screen modes are +# convenient to work with: +# - High resolutions are not recommended for small displays, because +# everything on the screen would be too tiny. +# - The highest resolution is not recommended if the refresh rate is +# not known or lower than 80 Hz +# - Though the mode 1400x1050 never shows up in the ddc info, it is +# Recommended as a replacement for 1600x1200 if that one is not. +# + +## For CRTs determine recommended screen modes #################################################### + +# enable debugging in higher debug levels +[ -z "$DEBUGLEVEL" ] && DEBUGLEVEL=0 +[ $DEBUGLEVEL -gt 1 ] && DEBUG="yes" +# heavy debugging output in level 3 and above ... +[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 14 ] && set -x + +# Define some default output values if the script fails to find better values +# Empty defaults, s.t. hwautocfg defines the defaults +default_horiz_freq_range_khz="" #"31.5-63.5" +default_vert_freq_range_hz="" #"60-90" +default_recommended_screen_modes="" #'"1024x768" "800x600" "640x480"' + + +calculate_max_horizontal_freq () { + highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)".*/\1/p'` + [ -z $highest_resolution ] && return # if the highest resolution can not be extracted, the frequency can not be calculated + freq_for_highest_res=`sed -n /$highest_resolution'/s/[^@]*@\([0-9]\{2,3\}\).*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p` + if [ -z "$freq_for_highest_res" ]; then + #Search for a number followed by the term "Hz" in the same line as the highest resolution + freq_for_highest_res=`sed -n /$highest_resolution'/s/.*[^a-zA-Z0-9]\([0-9]\{2,3\}\)[ \t]*[Hh][Zz].*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p` + fi + [ -n "$DEBUG" ] && echo " # Vertical Frequency for highest resolution.: $freq_for_highest_res" + if [ -z "$freq_for_highest_res" ]; then + [ -n "$DEBUG" ] && echo "Vertical Frequency not available. Calculation not possible. Return default value." + horiz_freq_range_khz=$default_horiz_freq_range_khz + return + fi + + highest_res_line_count=` echo $highest_resolution | sed -n 's/.*[0-9]*x//p'` + [ -n "$DEBUG" ] && echo " # of lines in highest res.: $highest_res_line_count" + horiz_freq_khz=$(( $highest_res_line_count * $freq_for_highest_res / 950)) # 950 = 0,95 * 1000 (invisible range * Kilohertz) + [ -n "$DEBUG" ] && echo " Assumed Horizontal Frequency: $horiz_freq_khz" + horiz_freq_range_khz="31.5-$horiz_freq_khz" +} +determine_recommended_crt_modes () { + ## Introduce the standard resolution 1400x1050 as it is seldom in the list the monitors output, though supported + [ -n "$DEBUG" ] && echo "Screen Modes: $screen_resolutions" + if [ -z "`echo $screen_resolutions|sed -n /1400/p`" ]; then + [ -n "$DEBUG" ] && echo "Inserting 1400x1050 (if 1600x.... is present" + # Insert "1400x1050" after 1600x.... (of course only if a 1600er res. is there because 1400x1050 would otherwise be listed) + screen_resolutions=`echo $screen_resolutions|sed 's/\(.*"1600x[0-9]*"\)\(.*\)/\1 "1400x1050"\2/'` + fi + # For CRTs check if the highest frequency can be displayed with reasonable refresh rate (> 80Hz) + highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)" .*/\1/p'` + #Search for an @ in the same line as the highest resolution; FIXME: Sort only considers the vertical resolution + freq_for_highest_res=`sed -n /$highest_resolution'/s/[^@]*@\([0-9]\{2,3\}\).*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p` + #echo $freq_for_highest_res + if [ -z "$freq_for_highest_res" ]; then + #Search for a number followed by the term "Hz" in the same line as the highest resolution + freq_for_highest_res=`sed -n /$highest_resolution'/s/.*[^a-zA-Z0-9]\([0-9]\{2,3\}\)[ \t]*[Hh][Zz].*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p` + fi + # Assure that the highest resolution is removed if we do not know at what refresh rate it is displayed + # Chances are it would be flickering at that resolution + if [ -z "$freq_for_highest_res" ]; then + freq_for_highest_res=75 # Assume 75 Hz to be the least a monitor is able to do. + fi + # Cut the first resolution if it is displayed with less than 85Hz + # It's assumed here, that the second best resolution will be displayed with > 85Hz + if [ $freq_for_highest_res -lt 85 ]; then + screen_resolutions=` echo $screen_resolutions | sed -n 's/"[0-9x]*" \(.*\)/\1/p'` + fi + define_max_recommended_horizontal_pixel_count # sets max_wanted_resolution +# max_wanted_resolution="$?" + [ -n "$DEBUG" ] && echo " The screen is too small for resolutions greater than ${max_wanted_resolution}x...." + # Fetch the first resolution in the list + new_highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)" .*/\1/p'` + [ -n "$DEBUG" ] && echo " new highest resolution: $new_highest_resolution" + new_highest_horizontal_resolution=`echo $new_highest_resolution | sed -n 's/\([0-9]*\)x.*/\1/p'` + [ -n "$DEBUG" ] && echo " new_highest_horizontal_resolution: $new_highest_horizontal_resolution" + while [ $new_highest_horizontal_resolution -gt $max_wanted_resolution ]; do + # Cut the highest resolution because the display size is to small for it to be convenient + screen_resolutions=` echo $screen_resolutions | sed -n 's/"[0-9x]*" \(.*\)/\1/p'` + new_highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)".*/\1/p'` + [ -n "$DEBUG" ] && echo " new highest resolution: $new_highest_resolution" + new_highest_horizontal_resolution=`echo $new_highest_resolution | sed -n 's/\([0-9]*\)x.*/\1/p'` + [ -n "$DEBUG" ] && echo " new_highest_horizontal_resolution: $new_highest_horizontal_resolution" + done + ########## +} + +define_max_recommended_horizontal_pixel_count () { + ## To high resolutions are not wanted on small screens ##################################### + # For 15 inch and below + if [ $screen_size_in_qcm -lt 704 ]; then max_wanted_resolution=1024 + # For 15" to 17" + elif [ $screen_size_in_qcm -lt 918 ]; then max_wanted_resolution=1280 + # For 17" to 19" + elif [ $screen_size_in_qcm -gt 1121 ]; then max_wanted_resolution=1400 + else max_wanted_resolution=50000 # Accept any resolution on Monitors above 19" + fi + [ -n "$DEBUG" ] && echo " Max. recommended resolution: $max_wanted_resolution" + #return $max_wanted_resolution +} + + +#TODO command line arguments processing (--help --defaults) +tmp_ddcprobe_output=$1 +if [ -z $tmp_ddcprobe_output ]; then + tmp_ddcprobe_output=/tmp/ddcprobe_output + ddcprobe | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" \ + > ${tmp_ddcprobe_output} +fi +# fixme: parameter I is not compatible with busybox - how to circumvent? +failed=`sed -n '/edid.*failed/p' ${tmp_ddcprobe_output}` +if [ -n "$failed" ]; then + echo "Error: Display seems to be incapable of providing DDC Information" + # Print Defaults OPTIMIZEME: The defaults could be command line parameters + echo "Recommended Screen Modes: $default_recommended_screen_modes" + echo "Horizontal Frequency Range (kHz): $default_horiz_freq_range_khz" + echo "Vertical Frequency Range (Hz): $default_vert_freq_range_hz" + exit 1; +fi +screen_size_in_qcm=$((`sed -n "s/screen.*size[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\).*/\1 * \2/p" ${tmp_ddcprobe_output}`)) +max_pixels=$((`echo "\`sed -n '/edid/,$s/.*[ \t]\([0-9]\{3,4\}\)x\([0-9]\{3,4\}\).*/\2 * \1/p' ${tmp_ddcprobe_output}|sort -rn| sed -n 1p\`"`)) +manufacturing_year=`sed -n 's/manufact.*\([12][90][0-9][0-9]\).*/\1/p' ${tmp_ddcprobe_output}` + +[ -n "$DEBUG" ] && echo "Maximal Resolution: $max_pixels" +# 640x400 (below) +if [ -z $screen_size_in_qcm ] || [ -z $manufacturing_year ] || [ 256000 -gt $max_pixels ] ; then + echo "Error: Display seems to be incapable of providing all relevant DDC Information" + # Print Defaults OPTIMIZEME: The defaults could be command line parameters + echo "Recommended Screen Modes: $default_recommended_screen_modes" + echo "Horizontal Frequency Range (kHz): $default_horiz_freq_range_khz" + echo "Vertical Frequency Range (Hz): $default_vert_freq_range_hz" + exit 1; +fi + +## Determine probabilitiy for TFT ########################################### +pix_per_qcm=$(($max_pixels/$screen_size_in_qcm)) +echo "Display size: $screen_size_in_qcm qcm" +echo "Max Pixels per qcm: $pix_per_qcm" +echo "Manufacturing year: $manufacturing_year" +# Set probability for having an LCD by means of age and size +# 15" ~ 30.6cm x 23cm +# 17" ~ 34cm x 27cm (17,1") +# 19" ~ 38,6cm x 29cm +# if older than 1998 it is most probably not a LCD +if [ $manufacturing_year -lt 1998 ] ;then tft_probability=1 +# if older than 2002 is probably no LCD, especially if larger than 15" +elif [ $manufacturing_year -lt 2002 ];then + if [ $screen_size_in_qcm -gt 704 ]; then tft_probability=1 + else tft_probability=20 + fi +# if older than 2003 is maybe no LCD, yet for sure if larger than 17" +elif [ $manufacturing_year -lt 2003 ];then + if [ $screen_size_in_qcm -gt 918 ]; then tft_probability=5 + else tft_probability=40 + fi +# if older than 2005 is probable an LCD, but not if larger than 19" +elif [ $manufacturing_year -lt 2005 ];then + if [ $screen_size_in_qcm -gt 1121 ]; then tft_probability=10 + else tft_probability=60 + fi +# in 2005 few people would buy a (new) CRT +elif [ $manufacturing_year -lt 2006 ];then tft_probability=90 +# after 2006 nobody would buy a new CRT +else tft_probability=99 +fi +if [ $pix_per_qcm -gt 1599 ]; then tft_probability=$(($tft_probability - 15)) +else tft_probability=$(($tft_probability + 15)) +fi +if [ -n "$DEBUG" ];then + echo -ne "Is a TFT: " + if [ $tft_probability -ge 50 ]; then + echo -n "true" + else echo -n "false" + fi + echo " ($tft_probability)" +fi + +# Find the lines with two times 3 to 4 digits delimited by an x. Print with the two values reverted, so sort sorts w.r.t the 2nd value. Then swap back +# Minor problem: If two Modes are found in a line, the second one is used. +screen_resolutions=`sed -n '/edid/,$s/\(.*[ \t]\)*\([0-9]\{3,4\}\) *x *\([0-9]\{3,4\}\).*/\3 x \2/p' ${tmp_ddcprobe_output}| sort -rn | sort -rnu | sed -n 's/\([0-9]\{3,4\}\) x \([0-9]\{3,4\}\).*/"\2x\1"/p' ` +screen_resolutions=`echo $screen_resolutions` +echo "Supported Screen Modes: $screen_resolutions" + + + +######## Vertical and horizontal frequency ranges ######### +# find a line with the word range and and numbers with a minus in the middle (e.g 123-321) +frequency_ranges=`sed '/range/!d;s/[^0-9]*\([1-9][0-9]\)[ \t]*-[ \t]*\([1-9][0-9]*\)[^0-9]*\([1-9][0-9]*\)[ \t]*-[ \t]*\([1-9][0-9]*\).*/\1-\2 \3-\4/' ${tmp_ddcprobe_output}` + +set -- $frequency_ranges # split into $1 und $2 +if [ -z "$frequency_ranges" ] && [ $tft_probability -lt 50 ]; then + calculate_max_horizontal_freq # gives us $horiz_freq_range_khz + horiz_freq_range="$horiz_freq_range_khz" +else horiz_freq_range=$1 +fi +######################################## + + +if [ $tft_probability -lt 50 ]; then + determine_recommended_crt_modes; +fi + +echo "Recommended Screen Modes: $screen_resolutions" + +#Fixme: How to Calculate the Vertical Refresh rate? +echo "Horizontal Frequency Range (kHz): $horiz_freq_range" +echo "Vertical Frequency Range (Hz): $2" diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig new file mode 100755 index 00000000..9e592a23 --- /dev/null +++ b/initramfs/initrd-stuff/bin/servconfig @@ -0,0 +1,521 @@ +#!/bin/sh +# +# universal (distro independent) configuration script for OpenSLX linux +# diskless clients (executed in stage3 within initial ramfs). The file- +# system is setup when servconfig starts +# +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 03-09-2006 +# Michael Janczyk <mj0>, 12-09-2006 +# Lars Mueller <lm@OpenSLX.com>, 23-06-2006 +# Oliver Tappe <ot@OpenSLX.com>, 23-06-2006 +# +# (c) 2006 - RZ Universitaet Freiburg +# (c) 2006 - OpenSLX.ORG Project + +# check for configuration files to source + +# functions common for all distros, messages contains all error and +# info output +. /etc/messages +. /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/${D_SYSCONFDIR}/logfile + +# script run timer +[ $DEBUGLEVEL -eq 8 ] && echo "** SW setup started at $(sysup)" + +# heavy debugging output in level 3 and below 8 ... +[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 12 ] && \ + set -x + +####################################################################### +# copy distro specific scripts, programs, libraries and configs +cp -a /etc/sysconfig/files/* /mnt 2>/dev/null & +# boot.local file (different for several distros) +[ -f "/etc/boot.local" -a -n "${D_BOOTLOCAL}" ] && { + echo "# added by $0 (initramfs from $date)" >> /mnt/etc/${D_BOOTLOCAL} + cat /etc/boot.local >> /mnt/etc/${D_BOOTLOCAL} +} + +####################################################################### +# read and unify configuration options - default configuration file, +# from dhcp, ldap ... +# wait for the appearance of configuration from several sources +cfgcomplete +. /etc/machine-setup +[ $DEBUGLEVEL -eq 8 ] && echo "** Config info is complete at $(sysup)" + +# copy additional configuration and var files and directories +# admins can place there files in /var/lib/openslx/config/... +# to be packed during stage2 into (/srv/dxs)/tftpboot/client-config...) +# ... in the near future ... +cp -a /rootfs/* /mnt 2>/dev/null + +# set greeting and add information on booted system (distro) +len=$(expr length $DISTRO) +dstr="$DISTRO)" +while [ $len -le 16 ] ; do + dstr="$dstr " + len=$(expr $len + 1) +done +len=$(expr length $host_name) +while [ $len -le 30 ] ; do + space="$space " + len=$(expr $len + 1) +done +echo " + WELCOME TO $space \n (\l) + _____ ______ ______ __ __ _______ __ __ __ + / _ | _ | ___| | | | | ____| | | | | | + | | | | |_| | |_ | | | | |___ | | / / + | | | | ___/| _| | | ____ | | | | + | |_| | | | |___| | | | ____| | |___ / / + _____/|__| |______|__| |__| |_______|______|__| |__| + + Diskless Workstation (v4.1/$dstr (c) <OpenSLX.ORG project> +">/mnt/etc/issue + +####################################################################### +# vmware stuff first part: two scenarios +# * VM images in /usr/share/vmware - then simply link +# * VM images via additional mount (mount source NFS, NBD, ...) +if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then + # get source of vmware image server (get type, server and path) + if [ -n "${imgsrv}" ] ; then + vmimgprot=$(uri_token $imgsrv prot) + vmimgserv=$(uri_token $imgsrv server) + vmimgpath="/$(uri_token $imgsrv path)" + # on DHCP config systems vmware image server might be coded into the + # $vmware variable + elif strinstr "/" "$vmware" ; then + vmimgprot=$(uri_token $vmware prot) + vmimgserv=$(uri_token $vmware server) + vmimgpath="/$(uri_token $vmware path)" + fi + if [ -n "${vmimgserv}" ] ; then + testmkd /mnt/var/lib/vmware + case "${vmimgsprot}" in + *nbd) + ;; + *) + # we expect nfs mounts here ... + nfsmnt ${vmimgserv}:${vmimgpath} /mnt/var/lib/vmware || { + error "${scfg_nfs}" nonfatal; noimg=yes; } + ;; + esac + # if only the path is given expect a local source within exported + # system (allow compatibility to older 3.X versions) + elif [ -n "${vmimgpath}" ] ; then + ln -s ${vmimgpath} /mnt/var/lib/vmware 2>/dev/null + fi +fi + +####################################################################### +# set localization +if [ -z "$country" ] ; then + error "$scfg_country" nonfatal + country="${D_DEFAULTCOUNTRY}" +fi +localization "${country}" + +####################################################################### +# setup passwd and shadow for local system users like root, bin, daemon +# and nobody if no user/admin provided passwd exists ... +# the root password provided by machine-setup is used only if no passwd +# file is provided (default case) +if [ ! -f /rootfs/etc/passwd ] ; then + basepasswd +fi + +####################################################################### +# 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, +# ...) +initial_boot + +####################################################################### +# +# run distro specific configuration function +config_distro + + +####################################################################### +# +# boot.local +if [ -n "$bootlocal_script" ]; then + echo -e "# entries added by $0:\n#\t$date\n\n\ +$bootlocal_script" >> /mnt/etc/${D_INITDIR}/boot.local +fi + +####################################################################### +# basic (non network) services + +# at daemon - calling distro specific function config_atd +config_atd + +# configuration of cron services - calling distro specific function +# config_cron (runlevel links, directories, ...) +config_cron +[ "x$crontab_entries" != "x" ] && \ + echo -e "$crontab_entries" >> /mnt/etc/crontab + +# setup system log services - distro dependent function config_syslog +config_syslog + +# configure dbus - distro dependent function config_dreshal - handle +# all stuff regarding dependent services like dbus, resmgr, hal ... +# (check for runlevel scripts, passwd entries, directories ...) +config_dreshal + +# acpi and powersave - distro dependent function config_acpi +config_acpi + +# configure automounter +# if automounter=yes +if [ -d /mnt/misc ] ; then + echo -e "# /etc/auto.master - file generated by $0:\n\ +/misc\t/etc/auto.misc" >/mnt/etc/auto.master + echo -e "# /etc/auto.misc - file generated by $0:" >/mnt/etc/auto.misc +else + echo -e "# /etc/auto.master - file generated by $0:\n\ +/misc\t#/etc/auto.misc" >/mnt/etc/auto.master + echo -e "# /etc/auto.misc - file generated by $0:\nautomount for \ +removable devices is mostly deprecated, so /misc is not\nactivated in \ +auto.master." > /mnt/etc/auto.misc +fi +if [ -n "${automnt_src}" ] ; then + # local directory and home directory server from machine-setup + [ -z "${automnt_dir}" ] && automnt_dir="/home" + # remove leading and trailing slash + automnt_dir=${automnt_dir#/} + automnt_dir=${automnt_dir%/} + test -d /${automnt_dir} || error "$scfg_erradir" nonfatal + strinstr "/" ${automnt_dir} && error "$scfg_erratpld" nonfatal + amserv=$(uri_token $automnt_src server) + ampath=$(uri_token $automnt_src path) + echo -e "/${automnt_dir}\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${amserv}:/${ampath}/&" \ + >> /mnt/etc/auto.${automnt_dir} + # no tempfs needed if automounter operates on /home + [ "${automnt_dir}" = "home" ] && umount -t tmpfs /mnt/home 2>/dev/null + # portmapper is needed for remote NFS sources + config_portmap +fi +config_automount +# fi + +# configure bluetooth services +config_bt + +####################################################################### +# network(ed) services + +# network time service (ntp) configuration file +if [ -n "$ntp_servers" -a ! -f /rootfs/etc/ntp.conf ]; 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" +ln -snf /usr/share/zoneinfo/${TZ} /mnt/etc/localtime || \ + error "$scfg_ntptz" nonfatal +config_ntp + +# secure shell server - at the moment all clients share one "secret" +# key or the key has to be regenerated on every bootup or fetched on +# every bootup from somewhere +config_sshd + +# simple network management protocol agent +config_snmp + +# setup afs client stuff +config_afs + +####################################################################### +# NIS +# 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 + # should be last in passwd file + strinfile "+:::" /mnt/etc/passwd || echo "+::::::" >>/mnt/etc/passwd + config_nis +fi + +####################################################################### +# name service caching daemon if networked user database +config_nscd + +####################################################################### +# vmware stuff second part: setting up the environment + +# create needed directories and files +if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then + for i in /var/X11R6/bin /etc/vmware/vmnet1 /etc/vmware/vmnet8 \ + /var/run/vmware /etc/X11/sessions ; do + testmkd /mnt/$i + done + # generate a runlevel script + d_mkrlscript init vmware-prep "Starting preparation of vmware environment" + sed "s,^#.*,,;/^$/d;s,^, ," /etc/vmware-prep >> \ + /mnt/etc/${D_INITDIR}/vmware-prep + d_mkrlscript close vmware-prep "" + chmod u+x /mnt/etc/${D_INITDIR}/vmware-prep + # check here that mount finished and the important files are available + if [ "$noimg" = "yes" ] ; then + error "$scfg_vmdir" nonfatal + else + # add special sessions to the display managers session menu + # default kdm session. Xdialog with WM and VMware images + cp /mnt/var/lib/vmware/templ/runvmware \ + /mnt/var/X11R6/bin >/dev/null 2>&1 + cp /mnt/var/lib/vmware/templ/defaultwm \ + /mnt/var/X11R6/bin >/dev/null 2>&1 + cp /mnt/var/lib/vmware/templ/kursimages \ + /mnt/var/X11R6/bin >/dev/null 2>&1 + fi + config_vmware + chmod 1777 /mnt/var/run/vmware + # define a variable where gdm/kdm should look for additional sessions + export vmsessions=/var/lib/vmware/vmsessions + # create default.desktop for kdm + echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=Default\n\ +Name[de]=Standard\nExec=defaultwm\nTryExec=/var/X11R6/bin/defaultwm\n\ +Type=Application" >/mnt/etc/X11/sessions/default.desktop + rm /mnt/etc/vmware/not_configured 2>/dev/null + echo -e "#!/bin/sh\n#\n# file generated by ${0} at ${date}\ + \n# set X background\ + \nres=\$(xvidtune -show | grep -wo \"\\\".*\\\"\" | sed \"s/\\\"//g\")\ + \nif ! [ -f /var/lib/vmware/templ/corp-id/bootsplash/silent-\${res}.jpg ]; then + \n img=\$(ls /etc/bootsplash/themes/dxs/images/ | grep -m 1 \"silent\")\ + \n display -window root /var/lib/vmware/templ/corp-id/bootsplash/images/\${img}\ + \nelse\ + \n display -window root /var/lib/vmware/templ/corp-id/bootsplash/images/silent-\${res}.jpg\ + \nfi + \nstartvm=\$(echo \$0 | sed -e \"s,.*/,,\")\ + \n/var/X11R6/bin/runvmware -s \${startvm}\n"\ + > /mnt/var/X11R6/bin/desktop-session #${debug} removed + chmod 755 /mnt/var/X11R6/bin/runvmware /mnt/var/X11R6/bin/defaultwm \ + /mnt/var/X11R6/bin/desktop-session >/dev/null 2>&1 + sessions=$(ls /mnt/var/lib/vmware/vmsessions/*.desktop 2>/dev/null) + # fixme: the following part is to be tested!! + if [ -n "${sessions}" ]; then + for i in /mnt/var/lib/vmware/vmsessions/*.desktop; do + #session_name=$(cat ${i} | grep -iw "exec" \ + # | awk -F "=" '{print $2}') + session_name=$(cat ${i}|sed -n "/^[Ee]xec/p"|sed -e "s,Exec=,,") + # copy bacause of initrd + cp /mnt/var/X11R6/bin/desktop-session \ + /mnt/var/X11R6/bin/${session_name} + #ln -s /mnt/var/X11R6/bin/desktop-session \ + # /mnt/var/X11R6/bin/${session_name} + done + fi +fi + +####################################################################### +# preparation of /tmp directory (partition 44, nfs scratch, ramdisk) +# there might be the chance that we have a disk partition available, so +# wait for completion of detection, setup process +waitfor /tmp/tmpready 10000 +[ $DEBUGLEVEL -eq 8 ] && echo "** Setup of /tmp completed at $(sysup)" +# create some directories and correct permissions +tmpisdisk=$(sed -n '/\/tmp/p' /tmp/fstab 2>/dev/null) +# if there is no local disk partition for /tmp then try to mount a rw +# scratch space (if defined in $scratch) and prepared on server +if [ -n "$scratch" -a -z "$tmpisdisk" ] ; then + scrproto=$(uri_token $FILESRC prot) + scrpath=$(uri_token $FILESRC path) + testmkd /tmp/scratch + # exports have to be per client!! + case "$scrproto" in + nbd) + : + ;; + *) + tmpserv=$(uri_token $scratch server) + tmppath=$(uri_token $scratch path) + # fixme - use nfsmnt and pass info on rw + mount -t nfs -o rw,nolock,intr,nodev,soft,timeo=2,nosuid \ + ${tmpserv}:/${tmppath} /tmp/scratch >/dev/null 2>&1 && { + mkdir -p /tmp/scratch/${clientip} >/dev/null 2>&1 + umount /tmp/scratch + mount -t nfs -o rw,nolock,intr,nodev,soft,timeo=2,nosuid \ + ${tmpserv}:/${tmppath}/${clientip} /mnt/tmp >/dev/null 2>&1; } + ;; + esac +fi +chmod 1777 /mnt/tmp + +####################################################################### +# 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 \ + /var/run/xdmctl \ + /tmp/.ICE-unix \ + /tmp/.X11-unix ; do testmkd /mnt/$i; done + chmod a+rwxt /mnt/tmp/.ICE-unix /mnt/tmp/.X11-unix + echo "# file emtied by $0 during initramfs" > /mnt/etc/X11/xdm/Xservers + # define additional sessions offered to the user (via dhcp/ldap config) + # descsession -> deprecated by new vmware integration concept + # 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"\ + >/mnt/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" + ;; + *) + # 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\nwhile ps aux|grep -i kiosk|grep -v \"grep\" &>/dev/null;\ +do\n test -f /var/run/kiosk || break; sleep 3;\ndone\ntouch \ + /var/run/kiosk\nresmgr login nobody tty7\nresmgr grant nobody desktop\n\ +chown nobody /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/control*\n\ +chown -R nobody:nobody /var/lib/nobody\nsu -c 'xinit /var/X11R6/bin/startgui \ +$start_x -- vt7 -quiet' -l nobody &>/dev/null\nrm /var/run/kiosk\n\ +resmgr revoke nobody\nresmgr logout tty7\nkillall X" \ + >/mnt/var/X11R6/bin/kiosk + # early start of kiosk session if not late_dm is set + if [ "x$late_dm" != "xyes" ] ; then + echo -e "\t# kiosk start added by $0\n\t\ +/var/X11R6/bin/kiosk &>/dev/null &" >>/mnt/etc/${D_INITDIR}/boot.ld + fi + cp /etc/startgui /mnt/var/X11R6/bin + chmod a+x /mnt/var/X11R6/bin/kiosk /mnt/var/X11R6/bin/startgui + rm /mnt/var/run/kiosk 2>/dev/null + ;; + esac + 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 + # just ensure lowercase + start_xdmcp=$(echo $start_xdmcp|sed -e "y/'GKWXDM'/'gkwxdm'/") + case "$start_xdmcp" in + wdm) + # anywhere in use!? + ;; + kdm) + # config is most probably not common in all distros? + # distro specific function config_kdm + config_kdm + ;; + gdm) + # config is most probably not common in all distros? + # distro specific function config_gdm + config_gdm + ;; + *) + # setup xdm (should be the same over the several distros) + 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 + # distro specific function config_xdm (at least for runlevel links) + config_xdm + ;; + esac +fi + +# theming +mkdir -p /mnt/var/lib/openslx/themes +cp -a /usr/share/themes/kdm /usr/share/themes/Xdialog \ + /usr/share/themes/bootsplash /mnt/var/lib/openslx/themes >/dev/null 2>&1 +cp /usr/share/themes/kdm/kdmrc /mnt/etc/opt/kde3/share/config/kdm >/dev/null 2>&1 + +# script run timer +[ $DEBUGLEVEL -eq 8 ] && echo "** SW setup finished at $(sysup)" + +# servconfig finished successfully +echo "finished" > /tmp/svcfg |