diff options
-rwxr-xr-x | theming/openslx/bootsplash2/bin/splashy | bin | 0 -> 1888220 bytes | |||
-rwxr-xr-x | theming/openslx/bootsplash2/bin/splashy_update | bin | 0 -> 4320 bytes | |||
-rw-r--r-- | theming/openslx/bootsplash2/etc/splashy/config.xml | 12 | ||||
-rw-r--r-- | theming/openslx/bootsplash2/etc/splashy/themes/openslx/blank.ttf | 0 | ||||
-rw-r--r-- | theming/openslx/bootsplash2/etc/splashy/themes/openslx/openslx.png | bin | 0 -> 125032 bytes | |||
-rw-r--r-- | theming/openslx/bootsplash2/etc/splashy/themes/openslx/theme.xml | 138 | ||||
-rwxr-xr-x | theming/openslx/bootsplash2/init | 862 | ||||
-rwxr-xr-x | theming/openslx/bootsplash2/mkdxsinitrd | 667 | ||||
-rw-r--r-- | theming/openslx/bootsplash2/snapshot.png | bin | 0 -> 80867 bytes |
9 files changed, 1679 insertions, 0 deletions
diff --git a/theming/openslx/bootsplash2/bin/splashy b/theming/openslx/bootsplash2/bin/splashy Binary files differnew file mode 100755 index 00000000..eceb6785 --- /dev/null +++ b/theming/openslx/bootsplash2/bin/splashy diff --git a/theming/openslx/bootsplash2/bin/splashy_update b/theming/openslx/bootsplash2/bin/splashy_update Binary files differnew file mode 100755 index 00000000..810de9f4 --- /dev/null +++ b/theming/openslx/bootsplash2/bin/splashy_update diff --git a/theming/openslx/bootsplash2/etc/splashy/config.xml b/theming/openslx/bootsplash2/etc/splashy/config.xml new file mode 100644 index 00000000..16080a07 --- /dev/null +++ b/theming/openslx/bootsplash2/etc/splashy/config.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Automatically generated by splashy_config. Do not edit --> +<splashy> + <!-- themes directory: conventional path /etc/splashy/themes --> + <themes>/etc/splashy/themes</themes> + <!-- current theme could be relative the themes defined above or full path --> + <current_theme>openslx</current_theme> + <!-- full path to theme to fall back in case of problems. DO NOT CHANGE --> + <default_theme>/etc/splashy/themes/openslx</default_theme> + <pid>/etc/splashy/splashy.pid</pid> + <fifo>/dev/.initramfs/splashy.fifo</fifo> +</splashy> diff --git a/theming/openslx/bootsplash2/etc/splashy/themes/openslx/blank.ttf b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/blank.ttf new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/blank.ttf diff --git a/theming/openslx/bootsplash2/etc/splashy/themes/openslx/openslx.png b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/openslx.png Binary files differnew file mode 100644 index 00000000..1f61180c --- /dev/null +++ b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/openslx.png diff --git a/theming/openslx/bootsplash2/etc/splashy/themes/openslx/theme.xml b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/theme.xml new file mode 100644 index 00000000..6b78ba67 --- /dev/null +++ b/theming/openslx/bootsplash2/etc/splashy/themes/openslx/theme.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Automatically generated by splashy_config. Do not edit --> +<splashy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://splashy.alioth.debian.org/schemas/1.1/themes.xsd"> + <info> + <!-- theme name is case sensitive. use directory name --> + <name>openslx</name> + <version>0.1</version> + <description>...</description> + <urls>http://</urls> + <author>Author <author@mail.com></author> + </info> + <progressbar> + <!-- here are tags to set the bar... x coordinate, + y coordinate, width and height are for the progress bar. + Remember that x, y, width and height are expressed in percentage --> + <dimension> + <x>5</x> + <y>95</y> + <width>90</width> + <height>1</height> + </dimension> + <!-- here you can set the color of the progressbar... + set the amount of red, green, blue and alpha channel. + Remember that the max value is 255 and the minumun value is 0--> + <color> + <red>255</red> + <green>139</green> + <blue>0</blue> + <alpha>0</alpha> + </color> + <!-- whether or not you want a border around the progressbar. default: no --> + <border> + <enable>no</enable> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + <alpha>0</alpha> + </color> + </border> + <!-- here you can set the color of the progressbar background + set the amount of red, green, blue and alpha channel. + Remember that the max value is 255 and the minumun value is 0--> + <background> + <color> + <red>62</red> + <green>93</green> + <blue>114</blue> + <alpha>0</alpha> + </color> + </background> + <direction> + <boot>forward</boot> + <shutdown>backward</shutdown> + <resume>forward</resume> + <suspend>backward</suspend> + </direction> + <visibility> + <boot>yes</boot> + <shutdown>yes</shutdown> + <resume>yes</resume> + <suspend>yes</suspend> + </visibility> + </progressbar> + <!-- conventional path: /etc/splashy/themes + theme-name --> + <background> + <boot>openslx.png</boot> + <shutdown>openslx.png</shutdown> + <resume>openslx.png</resume> + <suspend>openslx.png</suspend> + <errorimg>openslx.png</errorimg> + <!-- resolution of the images. this value affects where + the progressbar will be drawn. If VALUE <= 0, then percentages + of the screen width and hight will be assumed --> + <dimension> + <!-- NOTE: x and y are not used by splashy --> + <x>0</x> + <y>0</y> + <width>0</width> + <height>0</height> + </dimension> + </background> + <textbox> + <!-- whether you want the textbox always + shown or no. If no, it will be shown only on error, + see autoverboseonerror --> + <enable>no</enable> + <!-- here are tags to set the text area... x coordinate, + y coordinate, width and height are for the text area. + Remember that x, y, width and height are expressed in percentage + or pixel units --> + <dimension> + <x>24</x> + <y>45</y> + <width>71</width> + <height>45</height> + </dimension> + <!-- here you can set the color of the text area... + set the amount of red, green, blue and alpha channel. + Remember that the max value is 255 and the minumun value is 0--> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + <alpha>10</alpha> + </color> + <!-- whether or not you want a border around the progressbar. default: no --> + <border> + <enable>no</enable> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + <alpha>0</alpha> + </color> + </border> + <text> + <!-- font file to use, path relative to theme --> + <font> + <file>blank.ttf</file> + <height>2</height> + </font> + <!-- here you can set the color of the text/font... + set the amount of red, green, blue and alpha channel. + Remember that the max value is 255 and the minumun value is 0--> + <color> + <red>62</red> + <green>93</green> + <blue>114</blue> + <alpha>0</alpha> + </color> + </text> + </textbox> + <autoverboseonerror>no</autoverboseonerror> + <fadein>no</fadein> + <fadeout>no</fadeout> +</splashy> diff --git a/theming/openslx/bootsplash2/init b/theming/openslx/bootsplash2/init new file mode 100755 index 00000000..f6bb30af --- /dev/null +++ b/theming/openslx/bootsplash2/init @@ -0,0 +1,862 @@ +#!/bin/sh +# Copyright (c) 2003 - 2006 - RZ Uni Freiburg +# Copyright (c) 2006, 2007 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# +# Main script for new type of initial ramdisk for OpenSLX linux stateless +# clients version 4 + +############################################################################# +# device files get their own filesystem (to be move mounted later) +devdir="/dev" +mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir} + +# create basic device files an directories in dev (for most hardware related +# devices mdev should handle that) +for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \ + "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \ + "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \ + "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \ + "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \ + "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \ + "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \ + "/dev/fb0 c 29 0" "/dev/bootsplash p" "/dev/xconsole p"; do + mknod $i +done +mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev + +# source functions file common for all distros, messages contains all error +# and info output (for some reason the error output is not produced properly +# - crash) + +# how do the localization here? There is not yet a country-Variable +. /etc/messages +. /etc/functions || ( echo -e $init_mff && sleep 100 ) +. /etc/distro-functions || ( echo -e $init_dff && sleep 100 ) +# distro specific configuration settings (several file and directory +# variables) +. /etc/sysconfig/config || ( echo -e $init_dscf && sleep 100 ) +# configuration settings for this slx system's environment +. /etc/sysconfig/slxsystem.conf 2>/dev/null || ( echo -e ${init_sscf} && \ + sleep 100 ) +# initramfs-setup configuration (common settings for all clients using a +# certain InitRamFS generated by slxmkramfs/mkdxsinitrd) +[ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null + +export PATH=/bin:/sbin:/usr/bin/:/usr/sbin +export date="${slxconf_date}" + +export DEBUGLEVEL=0 +export KERNEL="${slxconf_kernver}" +export NWMODULES="${slxconf_listnwmod}" +export DISTRO_NAME="${slxconf_distro_name}" +export DISTRO_VER="${slxconf_distro_ver}" +export SYSTEM_NAME="${slxconf_system_name}" +export SLXVERSION="${slxconf_slxver}" + +# do not use dnbd cache file +nodnbdcache="yes" + +# set a default LAN interface, might be modified for WLAN or on machines with +# more than one ethernet card built in +nwif="eth0" + +# mount the important standard directories +[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc +[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys + +# fixme: shut down if script fails +trap "exec (sleep 30; echo o>/proc/sysrq-trigger)" \ + SIGHUP SIGINT SIGPIPE SIGTERM + +# if no kernel version is set, try to get it directly from /proc +if [ -z $KERNEL ] ; then + KERNEL=$(cat /proc/version) + KERNEL=${KERNEL#*version } + KERNEL=${KERNEL% (*) (*} +fi +# set defaults for some important variables, might be overwritten via +# kernel commandline +tmpfssize="50%" +cowsize="50%" +rwdir=/dev/shm +nfsro="nfs" + +# load usb modules for keyboard (reenable usb keyboards, otherwise the +# admin has to wait until second run of hwsetup late in stage3) +hwautocfg pre + +# run pre init script and user defined preinit.local, copied by mkdxsinitrd +# from /var/lib/openslx/config/... in stage2 +preinit +[ -x /bin/preinit.local ] && /bin/preinit.local + +# start device auto discovery service - busybox (or distro specific function) +mdev -s + +# switch off the several configuration methods, will be switched on +# according to kernel commandline settings +echo "noldap" > /tmp/ldap-done + +# External configuration file retrieval (per tftp) must be done, as otherwise +# we will never get the machine-setup file. By default, we try a predefined +# standard path (.../tftpboot/client-config/ ...) +file="yes" + +# splashy stuff +nosplash=0 + +# read kernel commandline +read KCMDLINE < /proc/cmdline +export KCMDLINE +# read the system wide machine-setup and then the kernel commandline +for opts in $(sed "s/#.*//" /etc/initramfs-setup) ${KCMDLINE} ; do + case ${opts} in + # localization + country=*) + COUNTRY=${opts#country=} + echo -e "\n# localization information gotten via kernel command line \ +in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup + ;; + # single token for debugging ... + debug) + DEBUGLEVEL=1;; + # ... or a specified debug level + debug=*) + DEBUGLEVEL=${opts#debug=} + [ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ + echo "** SLX init started near $(sysup)" + ;; + # essid for WLAN boot (experimental, might be moved to a module component + # in later versions + essid=*) + essid=${opts#essid=} + ;; + # if configuration should not be gathered by dhcp client + nodhcp) + nodhcp="yes" + echo "nodhcp" >/tmp/dhcp-done + ;; + nofile) + unset file + echo "nofile" >/tmp/file-done + ;; + # if ldap configuration should be triggered + ldap) + ldap="yes" + rm /tmp/ldap-done + ;; + # ldap configuration with host and port to contact (base) + ldap=*) + ldap="yes" + rm /tmp/ldap-done + ;; + # file source with tftp server and file location on the server + file=*|file) + if [ "${opts}" != "file" ] ; then + fileprot=$(uri_token ${opts#file=} prot) + fileserv=$(uri_token ${opts#file=} server) + filepath=$(uri_token ${opts#file=} path) + fi + ;; + # if ld.so.cache should be generated; should be switched on when composing + # rootfs from more than one source + ldsc) + ldsc="yes";; + # simple union of base ro rootdir with tempfs on top + unionfs) + unionfs=1;; + # additional source to unify root filesystem with; the top layer will be + # the tempfs + unionfs=*) + unionfs=1 + uniondirs=${opts#unionfs=} + # most probably it is a good idea to run ldconfig, so enable it + ldsc="yes" + ;; + # same for AUFS; alternative to unionfs + aufs) + aufs=1;; + aufs=*) + aufs=1 + uniondirs=${opts#aufs=} + # most probably it is a good idea to run ldconfig, so enable it + ldsc="yes" + ;; + # if cowloop should be used, only ontop of network block device and in + # combination with classical fs, like ext2 useful + cowloop=*) + cowloop=1 + #cowsize=${opts#cowloop=} + ;; + # rootfs will void the variables (d)nbdroot, nfsroot ... + # fixme: allow multiple rootfs sources to be unioned!? + # if strinstr " " "$rootfs" ... + rootfs=*) + rootfs=${opts#rootfs=} + rootfs=${rootfs#\"} + rootfs=${rootfs%%\"} + srvproto=$(uri_token $rootfs prot) + case $srvproto in + nfs) + # nfsroot consists now of two different parts + nfspath=$(uri_token $rootfs path) + nfsserver=$(uri_token $rootfs server) + echo -e "\n# nfs root information gotten via kernel command \ +line in $0\n#nfsroot=\"${nfsserver}:${nfspath}\"\n" >> /etc/machine-setup + ;; + *nbd*) + bldmod=$srvproto + # get settings for nbd-client, filesystem equals to path in URI + # notation (remove leading slash from filesystem at the end) + bldhost=$(uri_token $rootfs server) + bldport=$(uri_token $rootfs port) + bldrfst=$(uri_token $rootfs path) + bldrfst=${bldrfst#/*} + ;; + aoe) + echo "Not implemented yet" + bldmod= + ;; + iscsi) + echo "Not implemented yet" + bldmod= + #iscsiserver=$(uri_token $rootfs server) + #iscsiport=$(uri_token $rootfs port) + #iscsitarget=$(uri_token $rootfs path) + ;; + lbdev) + # use a local device for mounting root block device with given + # filesystem, e.g. rootfs=device://sda2/squashfs + bldmod="sata_sil sd_mod" + blddev=$(uri_token $rootfs server) + bldfst=$(uri_token $rootfs path) + bldfst=${bldfst#/*} + ;; + esac + ;; + # size of cache dnbd should use within ram + dcsize=*) + dnbdcachesize=${opts#dcsize=};; + # ip configuration client-ip:server-ip:gateway:netmask + ip=*) + ipinfo=${opts#ip=};; + # deprecated: nfs server and path (will be removed soon) + nfsroot=*) + nfsroot=${opts#nfsroot=} + echo -e "\n# nfs root information gotten via kernel command line in \n\ +$0\n# deprecated: please use rootfs=nfs://...\nnfsroot=\"${nfsroot}\"\n" \ +>> /etc/machine-setup + ;; + # size of tempfs if not max. 50% of RAM should be used + tmpfssize=*) + tmpfssize=${opts#tmpfssize=};; + # vendor code identifier for dhcp requests, that way odlx clients could + # be distinguished from other (dhcp) clients + vci=*) + vci=${opts#vci=};; + xenbr) + xenbr=1;; + # splashy stuff + nosplash) + nosplash=1;; + esac +done + +# splashy stuff +[ ${DEBUGLEVEL} = 0 -a ${nosplash} = 0 ] && /bin/splashy boot 2>/dev/null + +# at this point a timer should be started to ensure an automated reboot +# or halt of the machine if SLX init does not succeed (e.g. missing kernel +# module for the network adaptor) +if [ ${DEBUGLEVEL} -lt 3 -o ${DEBUGLEVEL} = 8 ] ; then + cat<<EOF > /bin/watchdog +#!/bin/ash +echo \$$ > /tmp/watchdogpid +[ ! -f /proc/version ] && mount -n -t proc proc /proc +sleep 120 2> /dev/null +echo "o" > /proc/sysrq-trigger +EOF + chmod u+x /bin/watchdog + watchdog & +fi + +# check if at least one type of IP configuration is availabe +if [ -n "$nodhcp" -a -z "$ldap" -a -z "$ipinfo" ] ; then + echo -e "# You did not specify any advanced configuration mode for your \ +clients. You\n# might want to add the token 'dhcp' for DHCP configuration, \ +'file(=source)'\n# for config file get via TFTP or 'ldap(=source)' for LDAP \ +configuration to\n# your kernel command line." >> /etc/machine-setup + if strinfile "clientip" /etc/initramfs-setup ; then + # IP configuration seems to be present in machine-setup file + # TODO: FIX this, as it will clobber all kernel-cmdline values! + . /etc/initramfs-setup + ipinfo="ip=$clientip:$serverip:$gateway:$subnet_mask" + else + error "$init_errip" + fi +fi +# for ldap configuration at least basic IP setup is needed to contact the +# server +[ -n "$nodhcp" -a -n "$ldap" -a -z "$ipinfo" ] && error "$init_errldap" +# set debug level and logfile +if [ $DEBUGLEVEL -eq 20 ] ; then + echo "** Setting debuglevel to ${DEBUGLEVEL} at $(sysup)" +else + echo "Setting debuglevel to ${DEBUGLEVEL}" +fi +export MODPRV=" " +export LOGFILE +if [ "${DEBUGLEVEL}" -gt 0 -a "${DEBUGLEVEL}" != 8 ] ; then + # if LOGFILE should be used within initial ramdisk add '/mnt' in front + # of the variable + LOGFILE="/var/log/slx-boot.log" + echo "1 4 1 7" >/proc/sys/kernel/printk + [ "${DEBUGLEVEL}" -ge 2 ] && MODPRV="-v" + [ "${DEBUGLEVEL}" -gt 3 -a "${DEBUGLEVEL}" -le 10 ] && { + set -x + # and the kernel too + echo "7 7 7 7" >/proc/sys/kernel/printk; } + [ "${DEBUGLEVEL}" -gt 10 -a "${DEBUGLEVEL}" -le 20 ] && set +x +else + # switch off most of kernel debug output + echo "0 0 0 0" >/proc/sys/kernel/printk + # modprobe should stay quiet + MODPRV="-q" + LOGFILE="/dev/null" + # redirect console (after /dev/null is available, and /dev mounted) + [ "${DEBUGLEVEL}" != 8 ] && exec < /dev/console > /dev/null 2>&1 +fi +# load network adaptor modules, check for WLAN specific settings and check +# for multiple ethernet interfaces (not implemented yet) +hwautocfg nwmod +if [ -n "${essid}" ] ; then + # WLAN setup will most probably change the network interface name stored in + # nwif (to wlan0 or something like that) + wlanlinksetup + #echo "Starting shell for testing of WLAN setup procedure" + #/bin/ash +else + # check here for the active ethernet link + ip link show dev eth1 >/dev/null 2>&1 && error "$init_2eif" nonfatal +fi + +# set up loopback networking +[ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)" +ip link set dev lo up +ip addr add 127.0.0.1/8 dev lo +ip link set dev $nwif up || error "$init_noeth" +macaddr=$(ip link show dev $nwif|sed -n "/ether [0-9e-f]\{2\}:.*/p" \ + |sed -e "s/.*ether //;s/ .*//") + +# XEN bridge config +[ -n "$xenbr" ] && xenbr_config + +# analyze ip information from the kernel command line and put parts +# of it into several variables +if [ -n "$ipinfo" ] ; then + getip () { + local val="$ipinfo:"; i=$(($1 - 1)); + while [ $i -gt 0 ] ; do + val=${val#*:} ; i=$(($i - 1)); + done; + echo $val|sed "s/:.*//"; } + clientip=$(getip 1) + serverip=$(getip 2) + gateway=$(getip 3) + subnet_mask=$(getip 4) + echo -e "# ip configuration written by $0 script\nclientip=$clientip\n\ +subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip" \ + >>/etc/machine-setup + # set static ip address + ip addr add $clientip/$(nm2pref $subnet_mask) dev $nwif + ip route add default via $gateway +else + noipyet="yes" +fi +# get configuration data via dhcp (with vendor code identifier if present +# in ${vci} from kernel command line or machine-setup) ... +[ -z "$nodhcp" ] && rundhcp ${vci} & +if [ -n "$noipyet" ] ; then + waitfor /tmp/dhcp-done 20000 + if [ -f /etc/machine-setup ] ; then + . /etc/machine-setup + [ -f /tmp/confviadhcp ] && . /tmp/confviadhcp + [ -z "$clientip" -o -z "$subnet_mask" -o -z "$gateway" \ + -o -z "$broadcast_address" ] && error "$init_errdhcp" + ip addr add $clientip/$(nm2pref $subnet_mask) broadcast $broadcast_address \ + dev $nwif + ip route add default via $gateway + else + if [ -n "$file" -a "$srvproto" = "lbdev" ] ; then + error "$init_erripcfg" nonfatal + else + error "$init_erripcfg" + fi + fi +fi +# check if serverip is set as variable @@@serverip@@@ +sed "s,@@@serverip@@@,$serverip," -i /etc/machine-setup +[ $DEBUGLEVEL -eq 20 ] && echo "** finished ip config at $(sysup)" +# ... or ldap if available (in background) +[ -n "$ldap" ] && ldapconf & +# ... or via tftp file get (in background) +[ -n "$file" ] && fileget & + +# if root filesystem should be imported via local or a network block device +if [ -n "${bldmod}" ] ; then + # load block device driver(s) if needed + for module in ${bldmod} ; do + modprobe ${MODPRV} ${module} || error "$init_errbld" + done + [ -x /bin/mdev ] && mdev -s + [ -z "$bldrfst" ] && bldrfst=squashfs + bldhost=$(checkip $bldhost) + if [ $DEBUGLEVEL -eq 20 ] ; then + echo "** starting setup of ${bldmod} at $(sysup)" + else + echo "Stateless client using ${bldmod} on $bldhost:$bldport with $bldrfst" + fi + # fixme: check for fs in /proc/filesystems before trying to load the module + modprobe ${MODPRV} ${bldrfst} || error "$init_errbld" nonfatal + + case "${srvproto}" in + # network block device present in standard kernel + nbd) + RDEV=/dev/nbd0 + waitfor "${RDEV}" 20000 || error "$init_nbddev" + i=0 + while ! nbd-client $bldhost $bldport ${RDEV} ; do + usleep 100000 + i=$(($i + 1)) + if [ $i -ge 1000 ] ; then + error "$init_nbds"; break + fi + done + usleep 100 + echo noop > /sys/block/nbd0/queue/scheduler + # switch off unneeded block read ahead + echo "0" > /sys/block/nbd0/queue/read_ahead_kb + ;; + # dnbd2 by Vito Di Leo + dnbd2) + RDEV=/dev/vnbd0 + waitfor "${RDEV}" 20000 || error "$init_nbddev" + # check for others in machine-setup and then kernel cmdline + rootfs="$(sed -n "/rootfs=/p" /etc/machine-setup|sed "s,rootfs=,,;s,\",,g") " + [ -z "$rootfs" ] && \ + rootfs="$(cat /proc/cmdline|sed "s,.*rootfs=\",,;s,\".*,,") " + i=0 + while [ "x$bldhost" != "x" ]; do + echo $bldhost $bldport > /sys/block/vnbd0/server${i}/sock + i=$(($i + 1)) + rootfs=${rootfs#* } + bldsp=$(echo ${rootfs}|sed "s, .*,,") + bldhost=$(uri_token $bldsp server) + bldport=$(uri_token $bldsp port) + done + # quickhack, should be read in from URI + echo 1 > /sys/block/vnbd0/config/vid + echo 1 > /sys/block/vnbd0/config/rid + echo noop > /sys/block/vnbd0/queue/scheduler + i=0 + while [ $(cat /sys/block/vnbd0/config/running) != 1 ] ; do + echo 1 > /sys/block/vnbd0/config/running + usleep 5000 + i=$(($i + 1)) + if [ $i -ge 1000 ] ; then + error "$init_dnbd2s"; break + fi + done + # echo "0" > /sys/block/vnbd0/queue/read_ahead_kb + ;; + # dnbd by Thorsten Zitterell + dnbd) + # quickhack + RDEV=/dev/dnbd0 + if [ -z $nodnbdcache ] ; then # variable not really used yet + mkdir /dnbd + mount -n -o 'size=10%' -t tmpfs tmpfs /dnbd + ( cat /dev/zero > /dnbd/cache 2>/dev/null || echo "ok" >/tmp/cache ) & + clientopt="-c /dnbd/cache" + waitfor /tmp/cache 10000 + fi + [ $(echo $bldhost|sed "s,\..*,,") -ge 224 ] && \ + ip route add 224.0.0.0/4 dev $nwif + waitfor /dev/dnbd0 10000 || error "$init_nbddev" + echo "dnbd-client -b $bldhost -d $RDEV $clientopt" + while ! dnbd-client -b $bldhost -d $RDEV $clientopt ; do + usleep 10000 + done + # problem with squashfs and cfq scheduler + echo noop > /sys/block/dnbd0/queue/scheduler + echo 0 > /sys/block/dnbd0/queue/read_ahead_kb + ;; + lbdev) + # using clients local block device (disk partition is to be specified) + RDEV=/dev/$blddev + ;; + esac + RWRO="ro" + if [ -n "${cowloop}" -a -x /bin/cowdev ] ; then + modprobe ${MODPRV} cowloop || { + error "$init_loadcow" nonfatal + unset cowloop; } + [ -x /bin/mdev ] && mdev -s + fi + if [ -n "${cowloop}" ] ; then + if [ -n "${unionfs}" -o -n "${aufs}" ] ; then + error "$init_cownobld" + unset unionfs aufs + fi + echo "Using Copy-on-Write block device for rw access" + mount -n -t tmpfs -o size=${cowsize} ramfs ${rwdir} + mkdir /dev/cow && mknod /dev/cow/ctl b 241 255 + usleep 200 + ln -s /dev/cowloop0 /dev/cow/0 + # fixme - cowdev depending on blockdev choosen above ... + cowdev -a /dev/nbd0 ${rwdir}/nbd.cow + usleep 200 + RWRO="rw" + RDEV=/dev/cow/0 + # run ldconfig if not switched off via kernel command line + ldcfg + else + # use normal UnionFS behaviour because rootfs is not NFS + unset nfsro + fi + # finally mount the configured network/local block device + for i in 0 5000 20000 100000 500000 1000000 ; do + usleep $i + mount -n -t $bldrfst -o $RWRO $RDEV /mnt 2>/dev/null && break + done + [ $DEBUGLEVEL -eq 20 ] && echo "** finished blockdev setup stuff at $(sysup)" +elif [ -n ${iscsiserver} ] ; then + [ $DEBUGLEVEL -eq 20 ] && echo "** started setting up iSCSI initiator at \ +$(sysup)" + #if [ -n ${iscsitarget} ] ; then + # echo "InitiatorName=${iscsitarget}"|sed "s,@@@serverip@@@,$serverip," \ + # >/etc/initiatorname.iscsi + #else + # discovery + #fi + #echo -e "node.startup = automatic">/etc/iscsid.conf + #iscsid -c /etc/iscsid.conf + # the cowloop part has to be moved (option for iscsi devices too) + # and should be generalized for nbd, dnbd, iscsi +fi + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 20" 2>/dev/null + +# if no type of root filesystem is passed via kernel command line try +# information gathered from dhcp process (only valid for nfs) +if [ -z "${bldmod}" -a -z "${bldhost}" -a -z "${nfsroot}" ] ; then + # information has to be read from dhcp and ldap configuration + cfgcomplete +fi +# mount nfs rootfs +if [ -z "${bldmod}" -a -z "${bldserver}" ] ; then + [ $DEBUGLEVEL -eq 20 ] && echo "** started nfs mount" + # read in extended machine-setup + . /etc/machine-setup + # prefer nfsserver and nfspath from kernel commandline over the information + # gotten from dhcp server + if [ -n "${nfsserver}" -a -n "${nfspath}" ] ; then + # check if nfsserver is set as variable @@@serverip@@@ + nfsserver=$(checkip $nfsserver) + nfsroot=${nfsserver}:${nfspath} + else + # the root_path should contain server ip and path in nfsroot notation + nfsroot=${root_path} + fi + for proto in tcp udp fail; do + [ $proto = "fail" ] && { error "$init_nfs"; break; } + mount -n -t nfs -o ro,nolock,${proto} ${nfsroot} /mnt && break + done + [ $DEBUGLEVEL -eq 20 ] && echo "** finished nfs mount at $(sysup)" +fi + +# get the complete collection of kernel modules available +mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \ + error "$init_moddir" +# start hardware configuration as background process if not a special +# debuglevel (21) is used for the option of manual hwautocfg start +if [ ${DEBUGLEVEL} = 21 ] ; then + echo "You can run 'hwautocfg main &' manually now ..." + /bin/sh +else + [ $DEBUGLEVEL -eq 20 ] && echo "** started hwautocfg in background at \ +$(sysup)" + hwautocfg main & +fi + +union_type="" +# try to use unionfs for rw access if available +if [ -n "${unionfs}" ]; then + modprobe ${MODPRV} unionfs && union_type="UnionFS" + if [ -z "$union_type" ]; then + error "$init_loadufs" nonfatal + unset unionfs + # if unionfs is not available, check for aufs and inform user + modprobe ${MODPRV} -n aufs && error $init_noufs_butaufs + fi +fi +# try to use aufs for rw access if available +if [ -n "${aufs}" ]; then + modprobe ${MODPRV} aufs && union_type="AUFS" + if [ -z "$union_type" ]; then + error "$init_loadaufs" nonfatal + unset aufs + # if aufs is not available, check for unionfs and inform user + modprobe ${MODPRV} -n unionfs && error $init_noaufs_butufs + fi +fi + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 30" 2>/dev/null + +# setup of client root filesystem dependent on the availability of UnionFS +if [ -n "${unionfs}" -o -n "${aufs}" ] ; then + echo "Using ${union_type} for rw access" + mkdir -p ${rwdir}/union ${rwdir}/uniontmp /rorootfs + mount -n -t tmpfs none ${rwdir}/uniontmp + # hack for handling unionfs with patched run-init + mount -n --move /mnt /rorootfs + if [ "$union_type" == "UnionFS" ]; then + mount -n -t unionfs -o dirs=${rwdir}/uniontmp:/rorootfs=${nfsro}ro \ + none /mnt + elif [ "$union_type" == "AUFS" ]; then + mount -n -t aufs -o br:/${rwdir}/uniontmp:/rorootfs=ro none /mnt + fi + mkdir -p /mnt/uniontmp + mount -n --move ${rwdir}/uniontmp /mnt/uniontmp + chmod 0755 /mnt/uniontmp /mnt + # run ldconfig if switched on via kernel command line (token ldsc) or + # triggered by unionized root filesystem + ldcfg + # runlevel directories should contain no links + for i in ${D_RCDIRS} ${D_INITBOOTD} ; do + rm -f /mnt/etc/$i/* 2>/dev/null + done +elif [ -z "${cowloop}" ] ; then + echo "Using bind mounts to ramdisk for rw access" + mount -n -t tmpfs -o size=${tmpfssize} ramfs ${rwdir} + for path in ${D_BINDMPTS} ; do + mkdir -p ${rwdir}/${path} >/dev/null 2>&1 + mount -n --bind ${rwdir}/${path} /mnt/${path} + [ ${DEBUGLEVEL} -gt 1 -a ${DEBUGLEVEL} != 8 ] && \ + echo "Created ${rwdir}/${path} and mounted it to /mnt/$path" + done + # see above ... + ldcfg + # save the RO directories mentioned in the distro-specific + # config to a temporary directory. They will lateron be restored + for path in ${D_RODIRSINRW}; do + if [ -d /mnt/${path} ] ; then + list=${path}" "${list} + # exclude them from etc copy process too + echo ${path}|sed -e "s,/root/,," >>/tmp/etc.exclude + mkdir -p /root/${path} >/dev/null 2>&1 + mount -n --bind /mnt/${path} /root/${path} >/dev/null 2>&1 + fi + done + for path in /etc/${D_SYSCONFDIR} ${D_DIRINBINDMNT} ${list}; do + mkdir -p ${rwdir}/${path} + done + testmkd ${rwdir}/var/tmp + chmod a+rwxt ${rwdir}/var/tmp >/dev/null 2>&1 + # exclude all sysv runlevel link stuff + for i in ${D_RCDIRS} ${D_INITBOOTD} ; do + echo "*$i/*" >>/tmp/etc.exclude + done + # add list of files to be excluded and common excludes to the filter list + echo -e "${D_ETCEXCL}\n@@@COMETCEXCL@@@" >>/tmp/etc.exclude + # if ld.so.cache is to be generated then do not copy the file + [ -n "${ldsc}" ] && echo -e "ld.so.cache*" >>/tmp/etc.exclude + # for tar exclude lists might be used, more difficult for cp + cd /mnt + tar -X /tmp/etc.exclude -cp etc/*|tar -xp -C ${rwdir} 2>/dev/null + cd / + mount -n --bind ${rwdir}/etc /mnt/etc + mount -n --bind ${rwdir}/var /mnt/var + # get the "covered" mounts back into filesystem structure + for path in ${list}; do + mount -n --move /root/$path /mnt/$path #>>$LOGFILE 2>&1 + done + #rm -rf /root/* >/dev/null 2>&1 + # run some specific stuff !? +fi + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 40" 2>/dev/null + +# script for stuff to execute during early bootup +d_mkrlscript init boot.slx "Running configuration postponed from InitRamFS" +echo "fs complete at $(sysup)" >/tmp/fscmpl + +# write debug file information after filesystem setup completed +echo -e "# /etc${D_SYSCONFDIR}/logfile - file created by $0 (initramfs \ +from $date)\n#\n# logfile \ +for linux diskless client specific debugging output\nLOGFILE=\"$LOGFILE\"\n#\ +\n# debug level\nDEBUGLEVEL=\"$DEBUGLEVEL\"" \ + > /mnt/etc/${D_SYSCONFDIR}/logfile || error "$init_errlog" + +# run distribution independent and dependent configuration of files and +# services (offer debug shell in runlevel 22) +if [ ${DEBUGLEVEL} = 22 ] ; then + /bin/sh +else + servconfig & +fi + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 50" 2>/dev/null + +for path in @@@COMDIRINDXS@@@ ${D_DIRINDXS} ${D_DIRINBINDMNT} ; do + testmkd /mnt/${path} +done +# Needed writable subdirs nested in readonly subdirs of writable one +for path in ${D_RWDIRSINRO}; do + mount -n -t tmpfs none /mnt/${path} +done +for i in /var/run/utmp /var/log/wtmp /var/log/lastlog /etc/mtab ; do + echo -n > /mnt/$i +done +chown 65534:0 /mnt/var/lib/nobody +# /proc/bus/usb might be deprecated in newer kernels ... +echo -e "# /etc/fstab - file generated by $0 (initramfs from $date)\n#\ +\tDirk von \ +Suchodoletz, dirk@goe.net\n\nrootfs\t\t/\t\trootfs\t\tro\t\t 0 0\n\ +proc\t\t/proc\t\tproc\t\tdefaults\t 0 0\ninitramdevs\t/dev\t\ttmpfs\ +\t\trw\t\t 0 0\ndevpts\t\t/dev/pts\tdevpts\t\tmode=0620,gid=5\t 0 0" \ + >/mnt/etc/fstab || error "$init_fstab" +echo -e "rootfs / rootfs rw 0 0\ninitramdevs /dev tmpfs rw\ + 0 0" > /mnt/etc/mtab + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 60" 2>/dev/null + +# copy library cache if generated +if [ -n "${ldsc}" ] ; then + # creating library cache takes a while ... + if waitfor /tmp/ldcfg 50000 ; then + test -s /mnt/tmp/ld.so.cache && \ + mv /mnt/tmp/ld.so.cache /mnt/etc/ld.so.cache + else + error "$init_errldcfg" + fi +else + error "$init_infldcfg" nonfatal +fi +# wait a while for hardware setup to complete and copy stuff to stage4 +waitfor /tmp/hwcfg 20000 || error "$init_errhw" +[ -f /tmp/scanner-udev ] && cat /tmp/scanner-udev \ + >> /mnt/etc/udev/rules.d/04-scanner.rules +# wait for completion of Xorg configuration and finalize it +waitfor /tmp/xready 10000 || error "$init_errxorg" nonfatal +mv /etc/xorg.conf /mnt/${D_XF86CONFFILE} +# wait a while for services setup to complete +waitfor /tmp/svcfg 10000 || error "$init_errsw" +# IP configuration is complete and should not be updated automatically +killall -9 dhcpcd dhclient udhcpc 2>/dev/null +# copy machine configuration file into stage4 filesystem +mv /etc/machine-setup /mnt/etc + +# if uniondirs is not set yet, maybe the unions were given via machine-setup +if [ -z "$uniondirs" ]; then + if [ "$union_type" == "AUFS" ]; then + # does it contain "://"? + if [ "$aufs" != "${aufs#*://}" ]; then + uniondirs="$aufs" + fi + elif [ "$union_type" == "UnionFS" ]; then + # does it contain "://"? + if [ "$unionfs" != "${unionfs#*://}" ]; then + uniondirs="$unionfs" + fi + fi +fi +# if locations are given that should be unioned with the fs root, do it +if [ -n "$uniondirs" ]; then + include_in_fsroot_union "$union_type" "$uniondirs" +fi + +# check for any plugin-specific runlevel scripts and run them, if found: +if [ -d /initramfs/plugin-init.d ]; then + for plugin_starter in /initramfs/plugin-init.d/*; do + [ $DEBUGLEVEL -gt 0 ] && \ + echo "Running plugin starter $plugin_starter ..." + /bin/sh $plugin_starter + done +fi + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 70" 2>/dev/null + +# post init for some distro specific +postinit +[ -s /initramfs/postinit.local ] && { + mv /initramfs/postinit.local /bin/postinit.local; + chmod u+x /bin/postinit.local; } +[ -f /bin/postinit.local ] && { + [ $DEBUGLEVEL -gt 0 ] && \ + echo "Running postinit.local - if boot stops here, check the script!" + /bin/postinit.local; } + +# start a debug shell in higher debug levels +[ $DEBUGLEVEL -gt 2 -a $DEBUGLEVEL != 8 ] && /bin/sh + +# unmount the bind mounted modules directory +export ticks +for ticks in 0 1 2 5 10 20 30; do + sleep $ticks && umount -n /lib/modules/${KERNEL} 2>/dev/null && break + error "$init_wait" nonfatal +done + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 80" 2>/dev/null + +mount 2>/dev/null | grep /lib/modules/${KERNEL} >/dev/null 2>&1 \ + && error "$init_errumnt" +# check for inittab file (might fail for new style init -> upstart) +test -f /mnt/etc/inittab || test -d /mnt/etc/event.d || error "$init_erritab" +# close runlevel script for stuff to execute during early bootup +d_mkrlscript close boot.slx "" +# put /tmp into stage4 mtab and add stuff to stage4 fstab +sed -n "s,/mnt,,;/\/tmp /p" /proc/mounts >> /mnt/etc/mtab +[ -f /tmp/fstab ] && cat /tmp/fstab >> /mnt/etc/fstab +# preparations to leave initramfs - umounting ... +umount -n /sys || error "$init_errsys" nonfatal +umount -n /proc/bus/usb >/dev/null 2>&1 +chmod 1777 /mnt/dev/shm /mnt/tmp /mnt/tmp/scratch 2>/dev/null +mount -n --move /dev /mnt/dev + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 90" 2>/dev/null + +# kill hwautocfg, servconfig +killall -9 hwautocfg servconfig 2>/mnt/dev/null +# runtimer +[ $DEBUGLEVEL -eq 8 -o $DEBUGLEVEL -eq 20 ] && \ + echo "** SLX init ended near $(sysup)" +# kill the watchdog (autopoweroff, if stage3 init never finishes) +[ -f /tmp/watchdogpid ] && kill $(cat /tmp/watchdogpid) 2>/mnt/dev/null +umount -n /proc +# unset old environment variables +unset client debug date initrd ip bldroot nfsroot rootfs ticks vci vga +unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \ + SLXVERSION UDEVD_EXPECTED_SEQNUM PATH + +# splashy stuff +[ $DEBUGLEVEL = 0 ] && /bin/splashy_update "progress 100" 2>/dev/null + +# new style of pivoting (switch_root or run-init) +exec /bin/switch_root -c dev/console /mnt /sbin/init || error "$init_runinit" diff --git a/theming/openslx/bootsplash2/mkdxsinitrd b/theming/openslx/bootsplash2/mkdxsinitrd new file mode 100755 index 00000000..9f64c524 --- /dev/null +++ b/theming/openslx/bootsplash2/mkdxsinitrd @@ -0,0 +1,667 @@ +#!/bin/bash +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# +# Main script for generating the InitRamFS of OpenSLX clients, to constitute +# the Stage3 boot stadium + +# debug level of script itself +DEBUG=1 +# debug level of the initramfs (to trigger the addition of specific +# binaries and kernel modules) +IRFSDEBUG=1 +COMETCEXCL="XF86Config*\nissue*\nmtab*\nfstab*\n" +COMDIRINDXS="/tmp/scratch /var/lib/nobody" + +# distro specific settings read from configuration file +# D_SYSCONFDIR - system wide configuration settings in /etc - sysconfig in +# SuSE and RedHat, default in Debian and Ubuntu, conf.d in Gentoo +# D_ETCEXCL - list of files, wildcards to be excluded from /etc when using +# bind mounts +# D_DIRINBINDMNT - lists of directories to be created in bind mounted rw +# part of the client filesystem +# D_RODIRSINRW - ReadOnly Directories in RW part of filesystem to save on +# TempFS usage +# D_DIRINDXS - directories in client filesystem which should be present +# anyhow +# D_BINDMNT - any code which is specific in bind mount environment +# D_RCDIRS - runlevel directories relative to /etc +# D_HWMODTOIGNORE - + +# just ensure that variables are set and the user gets an idea if +# something fails +D_SYSCONFDIR="<set in ~/distro-config/distro file>" +D_ETCEXCL="<set in ~/distro-config/distro file>" +D_BINDMPTS="<set in ~/distro-config/distro file>" +D_DIRINBINDMNT="<set in ~/distro-config/distro file>" +D_RODIRSINRW="<set in ~/distro-config/distro file>" +D_DIRINDXS="<set in ~/distro-config/distro file>" +D_BINDMNT="<set in ~/distro-config/distro file>" +D_INITDIR="<set in ~/distro-config/distro file>" +D_INITBOOTD="<set in ~/distro-config/distro file>" +D_RCDIRS="<set in ~/distro-config/distro file>" +D_RCDIRSINRW="<set in ~/distro-config/distro file>" +D_INITSCRIPTS="<set in ~/distro-config/distro file>" +D_XF86CONFFILE="<set in ~/distro-config/distro file>" +D_XORGBIN="<set in ~/distro-config/distro file>" +D_XFONTPATH="<set in ~/distro-config/distro file>" +D_DEFAULTCOUNTRY="<set in ~/distro-config/distro file>" +# read in the global settings +SLX_CONFIG_PATH=@@@SLX_CONFIG_PATH@@@ +SLX_SHARE_PATH=@@@SLX_BASE_PATH@@@/share +[ -f $SLX_SHARE_PATH/settings.default ] && \ + . $SLX_SHARE_PATH/settings.default +[ -f $SLX_CONFIG_PATH/settings ] && \ + . $SLX_CONFIG_PATH/settings + +######################################################################### +# End of global variable declaration, nothing needed to be changed at +# default below that line + +testmkd () { + test -d $1 || mkdir -p $1 >/dev/null 2>&1 +} + +usage() +{ + echo -e "mkdxsinitrd [-C] [-dh] [-k kernel version] [-i path/file] \ +[-f module(s)] [-n module(s)] [-m module(s)] -r path [-s theme]\n\ +[-c initramfs-setup] -S system_name" + echo "OPTIONEN" + echo " -C create special initramfs for CD/DVD syslinux demo mode" + echo " -c location of initramfs configuration file (initramfs-setup)" + echo " -d use ISC dhclient instead of udhcpcd of busybox" + echo " -h show usage information" + echo " -k kernel version" + echo " -i path/file optional information where to write initramfs file" + echo " -f list of blockdev/filesystem modules" + echo " -n list of network adaptor modules" + echo " -m list of misc modules not covered by -f or -n" + echo " -r path to stage1 root (vendor OS, e.g. /var/opt/openslx/stage1/suse-..." + echo " -S name of the system for which the initramfs is built" + echo " -s theme (for splash)" + echo " -t tpm support (client security)" + echo " -w enable WLAN support. Put WLAN kernel drivers to the network module" + echo " list" + exit 0 +} + +# check needed things for installation +precheck() { + # check if running as root + if [ "`id -u`" != "0" ]; then + echo -e "\nYou don't have the needed permission. Please rerun as root user!\n" + exit 1 + fi + # Check for correct settings of SLX-Variables + if [ "x" == "x$SLX_BASE_PATH" ]; then + if [ "x$SLX_CONFIG_PATH" == "x@@@SLX_CONFIG_PATH@@@" ]; then + echo "Please make sure you install the Open SLX Software properly," + echo "i.e. install it using the provided Makefile. Thanks." + else + echo "Essential configuration is missing. Please verify" + echo "existence and correctness of $SLX_SHARE_PATH/settings.default" + fi + exit 1 + fi +} + +# replaces which command to find executables inside ROOTDIR +binfinder() +{ +local PROGRAM="$1" +local RET=1 +for ELEMENT in bin sbin usr/bin usr/sbin usr/local/bin \ + usr/local/sbin usr/bin/X11; do + if [ -f "${ROOTDIR}/$ELEMENT/$PROGRAM" ] && \ + [ -x "${ROOTDIR}/$ELEMENT/$PROGRAM" ]; then + printf '%s\n' "${ROOTDIR}/$ELEMENT/$PROGRAM" + RET=0 + break + fi +done +return $RET +} + +# copy some binary to given destination. Takes binary in $1 and +# destination in $2 +cobi() +{ +local DEST=$2 +local FPTB=`binfinder $1` +if [ -z ${FPTB} ] ; then + return 1; +elif [ -L ${FPTB} ] ; then + # do not copy the link but the binary the link points to + local LINKDEST=`ls -la ${FPTB} | sed -e "s,.* ,,"` + case $LINKDEST in + /*) FPTB=${ROOTDIR}${LINKDEST} + ;; + *) ;; + esac + cp ${FPTB} ${INSTDIR}/${DEST} +else + cp ${FPTB} ${INSTDIR}/${DEST} +fi +slxldd --root-path=${ROOTDIR} ${FPTB} >>${INSTDIR}/tmp/libraries +return 0 +} + +# replace copy +repco() +{ +local FILENAME=$1 +DATE=`date +%m-%d-%Y` +# do not forget to define all variables which should be replaced within +# the start and configuration scripts. All comment lines will be deleted. +if [ -d ${SLX_SHARE_PATH}/initramfs/${FILENAME} ] ; then + testmkd ${INSTDIR}/${FILENAME} +else + if file ${SLX_SHARE_PATH}/initramfs/${FILENAME}| grep "ELF" &>/dev/null ; then + cp ${SLX_SHARE_PATH}/initramfs/${FILENAME} ${INSTDIR}/${FILENAME} + elif [ -L ${SLX_SHARE_PATH}/initramfs/${FILENAME} ] ; then + cp -a ${SLX_SHARE_PATH}/initramfs/${FILENAME} ${INSTDIR}/${FILENAME%/*} + else + if [ -z ${SLX_VERSION} ] ; then + SLX_VERSION=$(slxversion) + fi + sed -e "s,@@@INSTDIR@@@,${INSTDIR},g;s,@@@KERNVER@@@,${KERNVER},g" \ + -e "s,@@@DISTRO_NAME@@@,${DISTRO_NAME},g" \ + -e "s,@@@DISTRO_VER@@@,${DISTRO_VER},g" \ + -e "s,@@@NETIF@@@,${NET_IF},g" \ + -e "s,@@@NWMODULES@@@,${NWMODULES},g" \ + -e "s,@@@COMDIRINDXS@@@,${COMDIRINDXS},g" \ + -e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \ + -e "s,@@@DATE@@@,${DATE},g;/^#[^!].*/d" \ + ${SLX_SHARE_PATH}/initramfs/${FILENAME} >> ${INSTDIR}/${FILENAME} + # ugly hack for creating a general slx config file instead of "patching" + # the stage3 init + echo -e "slxconf_date=${DATE}\nslxconf_kernver=${KERNVER}\n\ +slxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro_name=${DISTRO_NAME}\n\ +slxconf_distro_ver=${DISTRO_VER}\nslxconf_system_name=${SYSTEM_NAME}\n\ +slxconf_slxver=\"${SLX_VERSION}\"" \ > ${INSTDIR}/etc/sysconfig/slxsystem.conf + sed -e "s,^#!/bin/sh,#!/bin/ash," -i ${INSTDIR}/${FILENAME} + fi +fi +} + +copy_distro_stuff() { + # copy first the default distro dependent configuration (variables) and + # function files, then append to each the distro/version specific file + # variables, functions set in default might that way be overwritten by + # definitions in distro/version specific files + cat ${SLX_SHARE_PATH}/distro-specs/$1/config-default >${INSTDIR}/etc/sysconfig/config + cat ${SLX_SHARE_PATH}/distro-specs/$1/config-$2 >>${INSTDIR}/etc/sysconfig/config + #[ -f $SLX_SHARE_PATH/settings.default ] && \ + # cat $SLX_SHARE_PATH/settings.default >>${INSTDIR}/etc/sysconfig/config + #[ -f $SLX_CONFIG_PATH/settings ] && \ + # cat $SLX_CONFIG_PATH/settings >>${INSTDIR}/etc/sysconfig/config + cat ${SLX_SHARE_PATH}/distro-specs/$1/functions-default >${INSTDIR}/etc/distro-functions + cat ${SLX_SHARE_PATH}/distro-specs/$1/functions-$2 >>${INSTDIR}/etc/distro-functions + # would be cool not to copy .svn here ... + # fixme!! works only for etc directories. If dir exists then next copy places + # file into the existing dir + cp -a distro-specs/$1/files-default ${INSTDIR}/etc/sysconfig/files 2>/dev/null + # ... so remove them afterwards ... + find ${INSTDIR}/etc/sysconfig/files \ + -regex ".*/\..*" -exec rm -rf {} 2>/dev/null \; +} +# copy kernel modules even if links (first parameter is source, second +# destination and third source prefix) +modcp () { +if [ -L $1 ] ; then + cp $3/$(readlink $1) $2 +else + cp $1 $2 +fi +} +# This function makes the directory of this script to the present working +# directory +# Does also work when called by symbolic links (even for nested links). +goto_script_dir() +{ + [ $DEBUG -ge 2 ] && echo "Aufgerufen wurde $0, checking if it is a link" + calleddetails=`ls -l $0` # get the file flags (e.g. lrwxrwxrwx) + [ $DEBUG -ge 2 ] && echo $calleddetails + + calleddir=${0%/*} # Strip the filename from path + [ $DEBUG -ge 2 ] && echo "Wechsele ins Verzeichnis des aufgerufenen scripts/links ($calleddir)" + cd $calleddir + + while index=`expr index "$calleddetails" "l"`; + [ $index -eq 1 ]; do + + [ $DEBUG -ge 2 ] && echo "It is a link" + target=`echo $calleddetails | awk '{print $NF}'` + [ $DEBUG -ge 2 ] && echo "The target of the link is: $target" + hasslash=`expr index "$target" "/"` + if [ $hasslash -ne 0 ]; then + targetpath=${target%/*} # extract the pathname + [ $DEBUG -ge 2 ] && echo "Following link to $targetpath" + cd $targetpath + else + [ $DEBUG -ge 2 ] && echo "It is in the same directory as the link" + fi + targetfile=`basename $target` + [ $DEBUG -ge 2 ] && echo "The target file of the link is: $targetfile" + calleddetails=`ls -l $targetfile` # get the file flags (e.g. lrwxrwxrwx) + [ $DEBUG -ge 2 ] && echo $calleddetails + done + [ $DEBUG -ge 2 ] && pwd + +} + +# add a bootsplash image to the initial ramdisk, only SuSE at the moment +# theming +add_theme() { + +#theme="${theme}" +#themes_dir="${SLX_SHARE_PATH}/themes/${theme}/bootsplash" + +# kdm/Xdialog theme +cp -a ${themes}* ${INSTDIR}/usr/share/themes +} + + +######################################################################### +# End of function declaration + +while getopts :Cdhk:c:i:r:o:s:f:n:m:S:tu:wI:a: a ; do + case $a in + \:|\?) + case $OPTARG in + c) echo "-c requires location of initramfs-setup file";; + k) echo "-k requires kernel version parameter";; + i) echo "-i requires initramfs path parameter";; + f) echo "-f requires file system module (list) parameter";; + n) echo "-n requires network module (list) parameter";; + m) echo "-m requires misc module (list) parameter";; + r) echo "-r requires root dir parameter";; + s) echo "-s may require theme name";; + I) echo "-I requires network interface parameter";; + S) echo "-S requires the system name";; + V) echo "-V requires an executable to run inside linuxrc";; + *) echo "Unknown option: -$OPTARG" + echo "Try mkinitrd -h";; + esac + exit 1 + ;; + C) cdboot=1;; + c) CLCONFFILE=$OPTARG;; + d) use_dhclient=1;; + k) KERNVER=$OPTARG;; + i) INITRD_PATH=$OPTARG;; + f) FSMODULES=$OPTARG;; + n) NWMODULES=$OPTARG;; + m) MISCMODULES=$OPTARG;; + r) ROOTDIR=$OPTARG;; + s) theme=$OPTARG;; + S) SYSTEM_NAME=$OPTARG;; + t) use_tpm=1;; + w) enable_wlan=1;; + d) IRFSDEBUG=$OPTARG;; + l) local_init_script="$OPTARG";; # use for pre/postinit.local? + h) usage;; + esac +done +shift $(expr $OPTIND - 1) + + +######################################################################### +# End of parameter, argument interpretation + +# Check for superuser id +precheck +#Change to the directory this script is located in +goto_script_dir + +if [ -z "$ROOTDIR" ] ; then + echo "No ROOTDIR given - please use the -r flag! Exiting..." + exit 1 +fi +if [ -z "$SYSTEM_NAME" -a -z "$cdboot" ] ; then + echo "No system name given - please use the -S flag! Exiting..." + exit 1 +fi +# set temporary setup directory, clean it and setup basic directory +# structure +if [ -z "$INSTDIR" ] ; then + INSTDIR=/tmp/slx-tmpramfs +fi +rm -rf ${INSTDIR} +mkdir -p ${INSTDIR}/{dev,proc,tmp,mnt,root,bin,sys,lib} +mkdir -p ${INSTDIR}/var/{lib,run} ${INSTDIR}/var/lib/nfs/state +ln -s /bin ${INSTDIR}/sbin +mkdir -p ${INSTDIR}/usr/share +# needed for KNOPPIX hwsetup tool not to be confused with ${D_SYSCONFDIR} +mkdir -p ${INSTDIR}/etc/sysconfig + +# slx init or cdboot init +if [ -z "$cdboot" ] ; then + # set DISTRO_NAME & DISTRO_VER from ROOTDIR: + VENDOR_OS=$(basename $ROOTDIR) + DISTRO_NAME=${VENDOR_OS%%-*} + # select distro type + DISTRO_VER=${VENDOR_OS#*-} + # drop distro type, keep from version onwards + DISTRO_VER=${DISTRO_VER%%-*} + # remove any optional stuff after version + DISTRO_VER=${DISTRO_VER%%_*} + # remove any architecture specification after version + copy_distro_stuff ${DISTRO_NAME} ${DISTRO_VER} + + # initial ramdisk scripts: init, functions, servconfig, hwautocfg, ... + # copy and replace variable names + for dirs in `find ${SLX_SHARE_PATH}/initramfs/* ! -regex ".*/\..*"` ; do + repco ${dirs##*initramfs/} + done + chmod 755 ${INSTDIR}/init \ + ${INSTDIR}/bin/{servconfig,hwautocfg,screenres,dhcpmkconfig} +else + cp ${SLX_SHARE_PATH}/cdboot/init ${INSTDIR}/init + chmod 755 ${INSTDIR}/init +fi + +# quickhack architecture detection of target system +if [ -d ${ROOTDIR}/lib64 ] ; then + ARCH=x86_64 +else + ARCH=i586 +fi + +# copy the proper busybox depending on architecture (i586 for 32bit and +# x86_64 for 64bit) +# fixme: At the moment the busybox does not support ext2 filesystem tools +cp ${SLX_SHARE_PATH}/busybox/busybox.${ARCH} ${INSTDIR}/bin/busybox +slxldd --root-path=${ROOTDIR} ${INSTDIR}/bin/busybox >>${INSTDIR}/tmp/libraries +for bbins in [ ar arping ash bunzip2 cat chmod chown chroot cp cpio cut \ + date dd df dmesg du echo env expr fdisk free grep gunzip hwclock \ + insmod id ip kill killall ln ls lsmod mdev mkdir \ + mknod mkswap modprobe mount mv nice ping printf ps rdate \ + rm rmmod sed sleep sort swapoff swapon switch_root tar test tftp \ + time touch tr udhcpc umount uptime usleep vconfig vi wget zcat zcip; do + ln -fs /bin/busybox ${INSTDIR}/bin/$bbins +done +# fake the sh link in busybox environment +echo -e "#!/bin/ash\n/bin/ash \$@" > ${INSTDIR}/bin/sh +chmod a+x ${INSTDIR}/bin/sh + +# binaries useful for debugging purposes +if [ $IRFSDEBUG -gt 2 ] ; then + for bbins in \ + strace + do + cobi ${bbins} bin || echo "Program ${bbins} not found" + done +fi + +# slx init or cdboot init +if [ -z "$cdboot" ] ; then + # one of the dhcp clients (do we really need any other dhcp client?) + if [ -n "${use_dhclient}" ] ; then + if binfinder dhclient ; then + cobi dhclient bin + if [ "$DISTRO_NAME" = "ubuntu" ] ; then + #Dhclient auf Ubu 6.10 streikt ohne libnss_compat + echo "/lib/libnss_compat.so.2" >> ${INSTDIR}/tmp/libraries + echo "/lib/libnsl.so.1" >> ${INSTDIR}/tmp/libraries + fi + else + echo "dhclient is not available" + fi + fi + + # if nbd or dnbd is used as clients root filesystem + if [ -n "${FSMODULES}" ] ; then + for i in ${FSMODULES}; do + case "$i" in + dnbd) + cobi dnbd-client bin + ;; + nbd) + cobi nbd-client bin + ;; + esac + done + fi + # if tpm should be used within InitRamFS ... + if [ -n "${use_tpm}" ] ; then + MISCMODULES="${MISCMODULES} tpm" + # copy the other stuff + fi + # if unionfs + cobi unionctl bin &>/dev/null || \ + echo "Program unionctl not found; could be ignored ..." + + # if cowloop + cobi cowdev bin &>/dev/null || \ + echo "Program cowdev not found; could be ignored ..." + + # if iscsi (or just with modules)?? + # cobi iscsiadm iscsid bin &>/dev/null || \ + # echo "Program iscsid not found; could be ignored ..." + + # distro specific additional stuff + case "${DISTRO_NAME}" in + debian*) + cp ${ROOTDIR}/lib/libnss_compat.so.2 ${INSTDIR}/lib;; + esac + # add libpci.so to the libraries, as we are going to copy it manually: + slxldd --root-path=${ROOTDIR} ${SLX_SHARE_PATH}/initramfs/lib/libpci.so.2 \ + >>${INSTDIR}/tmp/libraries +else + # fast kernel switch tool + cobi kexec bin +fi + +# if wlan should be supported in stage3 +if [ -n "${enable_wlan}" ] ; then + cobi iwconfig bin +fi + +# now copy all libraries that have been determined to be required: +# first we handle all 64-bit libs... +for lib in $(fgrep /lib64/ ${INSTDIR}/tmp/libraries 2>/dev/null|sort -u); do + if ! [ -d ${INSTDIR}/lib64 ] ; then + mkdir ${INSTDIR}/lib64 + fi + cp ${lib} ${INSTDIR}/lib64 +done +# ...now copy 32-bit libs: +for lib in $(fgrep -v /lib64/ ${INSTDIR}/tmp/libraries 2>/dev/null|sort -u); do + cp ${lib} ${INSTDIR}/lib +done +rm -f ${INSTDIR}/tmp/libraries + +# add kernel modules and dependency files +if [ -z "$KERNVER" ] ; then + KERNVER=$(ls -l ${ROOTDIR}/boot/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//") +fi +if [ -z "$KERNVER" ] ; then + KERNVER=$(ls -l ${ROOTDIR}/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//") +fi +# if no vmlinuz found, go for vmlinuz-x.yz.uv... +if [ -z "$KERNVER" ] ; then + KERNVER=$(ls -lt ${ROOTDIR}/boot/vmlinuz* | grep vmlinuz | \ + sed -n "1,1s/.*vmlinuz-//p") + echo "No vmlinuz-link found. Using kernel version "$KERNVER +fi + +if [ -z "$KERNVER" ] ; then + echo "No kernel version set or detected - please use the -k flag! Exiting..." + exit 1 +fi +if [ -z "$INITRD_PATH" ] ; then + INITRD_PATH="/tmp/slxinitramfs.gz" +fi +if [ -z "$NWMODULES" ] ; then + #NWMODULES="forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32 8139too 8139cp" + NWMODULES="forcedeth e1000 e100 tg3 3c59x via-rhine r8169 pcnet32 b44 8139too" +fi +# slx init or cdboot init +if [ -z "$cdboot" ] ; then + # base filesystem modules + if [ -z "$FSMODULES" ] ; then + FSMODULES="nbd squashfs nfs" + fi + # put all needed modules into initial ramdisk + mkdir -p ${INSTDIR}/lib/modules/${KERNVER} + for module in af_packet unix ${NWMODULES} ${FSMODULES} ${MISCMODULES} \ + ${DEBUGMODULES} usbcore hid usbhid uhci-hcd ohci-hcd; do + mod=$(cd /${ROOTDIR}; find "lib/modules/${KERNVER}" -name ${module}.ko \ +2>/dev/null) + + if [ -n "$mod" ] ; then + mpath=${INSTDIR}/${mod%/*} + mkdir -p ${mpath} + # specific function which can follow a link + modcp ${ROOTDIR}/$mod ${mpath} ${ROOTDIR} + # fixmee!! selection of dependent modules could be handled a little bit + # more clever + rdirprefix="${ROOTDIR}/lib/modules/${KERNVER}/kernel" + ddirprefix="${INSTDIR}/lib/modules/${KERNVER}/kernel" + case "$module" in + e100|8139too|via-rhine|sis900|epic100|sundance|8139cp|eepro100|pcnet32) + cp ${rdirprefix}/drivers/net/mii.ko \ + ${ddirprefix}/drivers/net &>/dev/null + ;; + # WLAN module block + #ipw3945|...) + # cp ${rdirprefix}/net/wireless ... + #;; + ath_pci) + for wlanmodule in ath_rate_sample ath_hal wlan wlan_scan_sta ; do + mod=$(cd /${ROOTDIR}; find "lib/modules/${KERNVER}" \ + -name ${wlanmodule}.ko 2>/dev/null) + mkdir -p ${INSTDIR}/${mod%/*} + # specific function which can follow a link + modcp ${ROOTDIR}/$mod ${INSTDIR}/${mod%/*} ${ROOTDIR} + done + ;; + # for unsupported WLAN devices + ndiswrapper) + cp -a ${ROOTDIR}/etc/ndiswrapper ${INSTDIR}/etc + ;; + nfs) + # create directory structure for modules needed and copy them + # to the proper place (as expected by modprobe/modules.dep) + mkdir -p ${ddirprefix}/net/sunrpc + mkdir -p ${ddirprefix}/fs/lockd ${ddirprefix}/fs/nfs_common + cp ${rdirprefix}/net/sunrpc/sunrpc.ko \ + ${ddirprefix}/net/sunrpc &>/dev/null + cp ${rdirprefix}/fs/lockd/lockd.ko \ + ${ddirprefix}/fs/lockd &>/dev/null + cp ${rdirprefix}/fs/nfs_common/nfs_acl.ko \ + ${ddirprefix}/fs/nfs_common &>/dev/null + ;; + ext3) + # needed for ext2 support + mkdir -p ${ddirprefix}/fs/jbd + cp ${rdirprefix}/fs/jbd/jbd.ko \ + ${ddirprefix}/fs/jbd + ;; + netloop) + # needed for xen stuff + cobi brctl bin &>/dev/null || \ + echo "Program brctl not found; could be ignored ..." + mkdir -p ${ddirprefix}/drivers/xen/netback + mkdir -p ${ddirprefix}/net/bridge + cp ${rdirprefix}/drivers/xen/netback/netloop.ko \ + ${ddirprefix}/drivers/xen/netback &>/dev/null + cp ${rdirprefix}/net/bridge/bridge.ko \ + ${ddirprefix}/net/bridge &>/dev/null + ;; + iscsi_tcp) + # iscsi modules + # cobi cobi iscsiadm iscsid bin &>/dev/null + #mkdir -p ${ddirprefix}/drivers/scsi + #for i in scsi_mod scsi_transport_iscsi libiscsi iscsi_tcp; do + # cp ${rdirprefix}/drivers/scsi/$i.ko + # ${ddirprefix}/drivers/scsi + #done + ;; + tpm) + # tpm module stuff + ;; + sata_sil|sata_nv|sata_via) + # serial ata local disk support + mkdir -p ${ddirprefix}/drivers/scsi ${ddirprefix}/drivers/ata + cp ${rdirprefix}/drivers/scsi/{scsi,sd}_mod.ko \ + ${ddirprefix}/drivers/scsi + cp ${rdirprefix}/drivers/ata/libata.ko ${ddirprefix}/drivers/ata + ;; + esac + fi + done + # copy user-supplied preinit files. The client specific one overwrites the + # system default one. postinit.local may be part of fileget tgz (in stage3) + for cfg in default/initramfs/preinit.local \ + ${SYSTEM_NAME}/initramfs/preinit.local \ + default/initramfs/postinit.local \ + ${SYSTEM_NAME}/initramfs/postinit.local ; do + test -f ${SLX_PRIVATE_PATH}/config/$cfg && \ + cp ${SLX_PRIVATE_PATH}/config/$cfg ${INSTDIR}/bin + done + # custom hardware configuration files pcitable.local and Cards.local + # fixme!! New source for these files (instead of templates)! + if [ -f ${SLX_SHARE_PATH}/templates/pcitable.local ] ; then + cat ${SLX_SHARE_PATH}/templates/pcitable.local > \ + ${INSTDIR}/usr/share/hwdata/pcitable.new + cat ${INSTDIR}/usr/share/hwdata/pcitable >>\ + ${INSTDIR}/usr/share/hwdata/pcitable.new + mv ${INSTDIR}/usr/share/hwdata/pcitable.new \ + ${INSTDIR}/usr/share/hwdata/pcitable + fi + if [ -f ${SLX_SHARE_PATH}/templates/Cards.local ] ; then + cat ${SLX_SHARE_PATH}/templates/Cards.local > \ + ${INSTDIR}/usr/share/hwdata/Cards.new + cat ${INSTDIR}/usr/share/hwdata/Cards >>\ + ${INSTDIR}/usr/share/hwdata/Cards.new + mv ${INSTDIR}/usr/share/hwdata/Cards.new \ + ${INSTDIR}/usr/share/hwdata/Cards + fi +else + # just copy the several ethernet drivers + mkdir -p ${INSTDIR}/lib/modules/${KERNVER}/kernel/drivers/net + for module in af_packet unix ${NWMODULES} mii ; do + mod=$(cd /${ROOTDIR}; find "lib/modules/${KERNVER}" -name ${module}.ko \ +2>/dev/null) + mpath=${INSTDIR}/${mod%/*} + mkdir -p ${mpath} + # specific function which can follow a link + modcp ${ROOTDIR}/$mod ${mpath} ${ROOTDIR} + done +fi + +cp ${ROOTDIR}/lib/modules/${KERNVER}/modules.* \ + ${INSTDIR}/lib/modules/${KERNVER} + +# add the common default client configuration file - just to ensure to +# have all major variables defined. +echo "## common settings for clients sharing an InitRamFS" \ + > ${INSTDIR}/etc/initramfs-setup +if [ -n "${CLCONFFILE}" ] ; then + cat ${CLCONFFILE} >>${INSTDIR}/etc/initramfs-setup + echo "Using ${CLCONFFILE}" +elif [ -n "$cdboot" ] ; then + echo -e "ramfs_nicmods=\"${NWMODULES}\"\nramfs_kernver=\"${KERNVER}\"" \ + >>${INSTDIR}/etc/initramfs-setup +fi +echo "## end of common initramfs-setup" >>${INSTDIR}/etc/initramfs-setup + +######################################################################### +# End of file copy procedures + +[ -n "${theme}" ] && add_theme + +# finally create the compressed initial ramdisk cpio archive +pushd . > /dev/null 2>&1 + cd ${INSTDIR} + find . ! -name "*~" | cpio -H newc --create | gzip -9 > $INITRD_PATH +popd > /dev/null 2>&1 + diff --git a/theming/openslx/bootsplash2/snapshot.png b/theming/openslx/bootsplash2/snapshot.png Binary files differnew file mode 100644 index 00000000..df53b05e --- /dev/null +++ b/theming/openslx/bootsplash2/snapshot.png |