diff options
Diffstat (limited to 'scripts/tcos-bottom')
-rwxr-xr-x | scripts/tcos-bottom/01download_settings | 27 | ||||
-rwxr-xr-x | scripts/tcos-bottom/04hwclock | 19 | ||||
-rwxr-xr-x | scripts/tcos-bottom/05inittcos | 52 | ||||
-rwxr-xr-x | scripts/tcos-bottom/06start_acpi | 12 | ||||
-rwxr-xr-x | scripts/tcos-bottom/10ldconfig | 78 | ||||
-rwxr-xr-x | scripts/tcos-bottom/22intel | 28 | ||||
-rwxr-xr-x | scripts/tcos-bottom/25startx | 128 | ||||
-rwxr-xr-x | scripts/tcos-bottom/35services | 52 | ||||
-rwxr-xr-x | scripts/tcos-bottom/40initsound | 101 | ||||
-rwxr-xr-x | scripts/tcos-bottom/55checksumoff | 34 | ||||
-rwxr-xr-x | scripts/tcos-bottom/55mount_listener | 37 | ||||
-rwxr-xr-x | scripts/tcos-bottom/56tcosxmlrpc | 33 | ||||
-rwxr-xr-x | scripts/tcos-bottom/57devices | 74 | ||||
-rwxr-xr-x | scripts/tcos-bottom/60installer | 46 | ||||
-rwxr-xr-x | scripts/tcos-bottom/70wakeonlan | 37 | ||||
-rwxr-xr-x | scripts/tcos-bottom/72ntpdate | 24 | ||||
-rwxr-xr-x | scripts/tcos-bottom/75print | 35 | ||||
-rwxr-xr-x | scripts/tcos-bottom/78cpufreq | 22 | ||||
-rwxr-xr-x | scripts/tcos-bottom/80shell | 60 |
19 files changed, 899 insertions, 0 deletions
diff --git a/scripts/tcos-bottom/01download_settings b/scripts/tcos-bottom/01download_settings new file mode 100755 index 0000000..a9de132 --- /dev/null +++ b/scripts/tcos-bottom/01download_settings @@ -0,0 +1,27 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /scripts/functions +# if break=download_settings STOP here +maybe_break download_settings + +. /conf/tcos.conf +. /conf/tcos-run-functions + +MYIP=$(awk -F"=" '/^ip=/ {print $2}' /tmp/net.data) + +download_file /tcos/conf/${MYIP}.conf /conf/mysettings.conf +if [ $? -eq 0 ]; then + log_begin_msg "Download personalized settings ${MYIP}.conf" + log_end_msg 0 +else + log_begin_msg "No personalized settings to download" + log_end_msg 0 +fi + +exit 0 diff --git a/scripts/tcos-bottom/04hwclock b/scripts/tcos-bottom/04hwclock new file mode 100755 index 0000000..27f4068 --- /dev/null +++ b/scripts/tcos-bottom/04hwclock @@ -0,0 +1,19 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +# fixme, don't work as expected +exit 0 + +quiet=n +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + +log_begin_msg "Setting clock based on hardware clock" + hwclock --localtime --hctosys +log_end_msg $? + +exit 0 diff --git a/scripts/tcos-bottom/05inittcos b/scripts/tcos-bottom/05inittcos new file mode 100755 index 0000000..3ec628d --- /dev/null +++ b/scripts/tcos-bottom/05inittcos @@ -0,0 +1,52 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + +# if break=inittcos STOP here +maybe_break inittcos + + +# Loop over every line in /etc/modules. +# patch from Roberto IbaƱez +grep '^[^#]' /etc/modules | \ +while read module args; do + [ "$module" ] || continue + modprobe "$module" "$args" >> /tmp/initramfs.debug 2>&1 +done + + +# load modules +if [ -x /usr/bin/pcimodules ]; then + for mod in $(pcimodules) ; do + modprobe -s -k "$mod" >> /tmp/initramfs.debug 2>&1 & + done +fi +# detect Xorg kernel module and driver +# pcimodules --class 0x30000 --classmask 0xffff00 | grep -v fb$ + + + +if [ "$(which loadkeys)" ]; then + _log "INITTCOS loading keymap" + log_begin_msg "Loading default server keymap" + [ -e /etc/console/boottime.kmap.gz ] && loadkeys -q /etc/console/boottime.kmap.gz >> /tmp/initramfs.debug 2>&1 & + [ -e /etc/console-setup/cached.kmap.gz ] && loadkeys -q /etc/console-setup/cached.kmap.gz >> /tmp/initramfs.debug 2>&1 & + [ -e /etc/console-setup/boottime.kmap.gz ] && loadkeys -q /etc/console-setup/boottime.kmap.gz >> /tmp/initramfs.debug 2>&1 & + log_end_msg $? +else + _log "INITTCOS not loading default keymap" +fi + + + + + +exit 0 diff --git a/scripts/tcos-bottom/06start_acpi b/scripts/tcos-bottom/06start_acpi new file mode 100755 index 0000000..c5ff993 --- /dev/null +++ b/scripts/tcos-bottom/06start_acpi @@ -0,0 +1,12 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + + +quiet=n + +[ -x /sbin/startacpid ] && /sbin/startacpid > /var/log/acpid.log 2>&1 + +exit 0 diff --git a/scripts/tcos-bottom/10ldconfig b/scripts/tcos-bottom/10ldconfig new file mode 100755 index 0000000..acdbe6b --- /dev/null +++ b/scripts/tcos-bottom/10ldconfig @@ -0,0 +1,78 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /scripts/functions +# if break=ldconfig STOP here +maybe_break ldconfig + + +. /conf/tcos.conf +. /conf/tcos-run-functions + + +# update lib cache +log_begin_msg "Updating lib cache" + /usr/sbin/ldconfig >> /tmp/initramfs.debug 2>&1 & +log_end_msg $? + +# needed for ssh login +grep ^export /conf/tcos.conf > /root/.profile + +# mount /dev/shm +# if not mounted +# this causes to break browsers and italc +mkdir -p /dev/shm +mount -t tmpfs shmfs /dev/shm >>/tmp/initramfs.debug 2>&1 + +# italc 1.0.0 new version +if [ -x /sbin/startica ]; then + ln -s /sbin/startica /sbin/startivs +fi + + +if [ -z "$(which Xorg)" ]; then + _log "LDCONFIG Xorg not found" + log_failure_msg "Xorg not found" + log_end_msg 1 + exit 0 +fi + + + + _log "LDCONFIG Updating links in Xorg 7.x mode" + [ ! -e /usr/lib/libGLcore.so.1 -a -e /usr/lib/libGLcore.so ] && ln -sf /usr/lib/libGLcore.so /usr/lib/libGLcore.so.1 + [ ! -e /usr/lib/libGL.so.1 -a -e /usr/lib/libGL.so.1.2 ] && ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1 + [ ! -e /usr/lib/libGL.so -a -e /usr/lib/libGL.so.1 ] && ln -sf /usr/lib/libGL.so.1 /usr/lib/libGL.so + [ ! -e /usr/lib/libGLU.so.1 -a -e /usr/lib/libGLU.so ] && ln -sf /usr/lib/libGLU.so /usr/lib/libGLU.so.1 + mkdir -p /usr/share/X11/ + ln -s /etc/X11/rgb.txt /usr/share/X11/rgb.txt + ln -s /usr/share/X11/xkb /etc/X11/xkb + mkdir -p /usr/X11R6 >> /tmp/initramfs.debug 2>&1 + ln -s /usr/bin /usr/X11R6/bin >> /tmp/initramfs.debug 2>&1 + + mkdir -p /var/lib/xkb + ln -s /var/lib/xkb /etc/X11/xkb/compiled + ln -s /usr/bin/xkbcomp /etc/X11/xkb/xkbcomp + + # make links in keymap rules + [ ! -e /usr/share/X11/xkb/rules/xfree86 ] &&\ + ln -s /usr/share/X11/xkb/rules/base /usr/share/X11/xkb/rules/xfree86 + [ ! -e /usr/share/X11/xkb/rules/xfree86.lst ] &&\ + ln -s /usr/share/X11/xkb/rules/base.lst /usr/share/X11/xkb/rules/xfree86.lst + [ ! -e /usr/share/X11/xkb/rules/xfree86.xml ] &&\ + ln -s /usr/share/X11/xkb/rules/base.xml /usr/share/X11/xkb/rules/xfree86.xml + + [ ! -e /usr/share/X11/xkb/rules/xorg ] &&\ + ln -s /usr/share/X11/xkb/rules/base /usr/share/X11/xkb/rules/xorg + [ ! -e /usr/share/X11/xkb/rules/xorg.lst ] &&\ + ln -s /usr/share/X11/xkb/rules/base.lst /usr/share/X11/xkb/rules/xorg.lst + [ ! -e /usr/share/X11/xkb/rules/xorg.xml ] &&\ + ln -s /usr/share/X11/xkb/rules/base.xml /usr/share/X11/xkb/rules/xorg.xml + + +exit 0 diff --git a/scripts/tcos-bottom/22intel b/scripts/tcos-bottom/22intel new file mode 100755 index 0000000..51c5f51 --- /dev/null +++ b/scripts/tcos-bottom/22intel @@ -0,0 +1,28 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n +. /conf/tcos.conf + +[ "$TCOS_XORG_VIDEO_DRIVER" = "fullauto" ] && exit 0 +[ "$TCOS_XORG_VIDEO_DRIVER" = "xorgauto" ] && exit 0 + +test_intel=0 +test_intel=$(get_vga_vendor 8086) + +if [ -e /usr/lib/xorg/modules/drivers/intel_drv.so ] && [ "$test_intel" = "1" ]; then + # force intel driver (intel don't like VESA) + configurexorg --newsettings --xdriver=intel +fi + + + + + + + +exit 0 + diff --git a/scripts/tcos-bottom/25startx b/scripts/tcos-bottom/25startx new file mode 100755 index 0000000..3a7c0a9 --- /dev/null +++ b/scripts/tcos-bottom/25startx @@ -0,0 +1,128 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions +. /conf/tcos-modules.conf + +# set limits in memory +. /bin/set-limits + + +# if break=startx STOP here +maybe_break startx + + +modprobe -q mousedev 2>&1 >> /tmp/initramfs.debug +modprobe -q psmouse 2>&1 >> /tmp/initramfs.debug +modprobe -q agpgart 2>&1 >> /tmp/initramfs.debug + + + +# Create magic cookie +# http://www.xs4all.nl/~zweije/xauth-6.html +# cookie=$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | awk '{print $1}' |sed -e 's/^/add :0 . /') +# cookie=$(mcookie) +# xauth -f /root/.Xauthority -q ${cookie} + +if [ ! -f $XAUTHORITY ]; then + value=0 + log_begin_msg "Creating magic cookie for X" + _log "STARTX creating cookie..." + #MYIP=$(awk -F"=" '/^ip=/ {print $2}' /tmp/net.data) + MYIP=$(getinfo.sh -i NETWORK_IP) + cookie=$(mcookie || value=1) + xauth -f $XAUTHORITY -q add :0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1 + xauth -f $XAUTHORITY -q add localhost:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1 + xauth -f $XAUTHORITY -q add localhost.localdomain:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1 + xauth -f $XAUTHORITY -q add $(hostname):0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1 + xauth -f $XAUTHORITY -q add ${MYIP}:0 MIT-MAGIC-COOKIE-1 $cookie 2>> /tmp/initramfs.debug || value=1 + # for new LTSPFS + echo $cookie > /var/run/ltspfs_token + #xauth list >> /tmp/initramfs.debug + _log "STARTX end cookie" + log_end_msg $value +fi + + +# read some settings from cmdline +# DOCUMENTME xdriver=foo | set default X driver (auto, vesa , via, vmware, ...) +xdriver=$(read_cmdline_var "xdriver" "") + +# DOCUMENTME xres=bar | set default X resolution (1024x768, 800x600, 640x480, ...) +xres=$(read_cmdline_var "xres" "") + +XORG_CFG_APPEND="" +if [ "${xdriver}" != "" ]; then + XORG_CFG_APPEND="${XORG_CFG_APPEND} --xdriver=${xdriver}" +fi + +if [ "${xres}" != "" ]; then + XORG_CFG_APPEND="${XORG_CFG_APPEND} --xres=${xres}" +fi + +if [ ! -f /etc/X11/xorg.conf ]; then + # generate xorg.conf + log_begin_msg "Generating xorg.conf" + configurexorg --verbose --newsettings ${XORG_CFG_APPEND} --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug + log_end_msg $? +else + log_begin_msg "xorg.conf exists, no overwrite" + log_end_msg $? +fi + + +# DOCUMENTME startx=X | set default X session (R=remote L=local N=none, F=freenx, S=sshX) +startx=$TCOS_XORG_TYPE + +if [ $(cat /conf/mysettings.conf | wc -l) -gt 1 ] ;then + startx_type=$(grep ^xsession /conf/mysettings.conf | awk -F "=" '{print $2}' | sed s/'"'/''/g ) + case $type in + XDMCP) + startx=R + ;; + local) + startx=L + ;; + sshX) + startx=S + ;; + FreeNX) + startx=F + ;; + rDesktop) + startx=W + ;; + esac +fi + + +# always overwrite with cmdline +startx=$(read_cmdline_var "startx" "${startx}") + + +if [ "$startx" = "L" ] ; then + ln -s /sbin/startlocalx /sbin/startx + startlocalx & +elif [ "$startx" = "R" ] ; then + ln -s /sbin/startremotex /sbin/startx + startremotex & +elif [ "$startx" = "F" ] ; then + ln -s /sbin/startnx /sbin/startx + startnx & +elif [ "$startx" = "S" ] ; then + ln -s /sbin/startsshx /sbin/startx + startsshx & +elif [ "$startx" = "W" ] ; then + ln -s /sbin/startrdesktop /sbin/startx + startrdesktop & +fi + + +exit 0 diff --git a/scripts/tcos-bottom/35services b/scripts/tcos-bottom/35services new file mode 100755 index 0000000..1eb61d1 --- /dev/null +++ b/scripts/tcos-bottom/35services @@ -0,0 +1,52 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + + +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + +# if break=inittcos STOP here +maybe_break services + + + +if [ "$(which dropbear)" ] ; then + # need read from /dev/urandom not /dev/random + # http://www.nomis52.net/?section=projects§2=netgear&page=dropbear + # ugly hack or recompile with #define DROPBEAR_RANDOM_DEV "/dev/urandom" + mv /dev/random /dev/random.old + ln -s /dev/urandom /dev/random + + _log "INITTCOS starting dropbear ssh daemon" + log_begin_msg "Starting dropbear SSH daemon" + ln -s /var/run/dropbear /etc/dropbear/superwise >> /tmp/initramfs.debug 2>&1 + ln -s /var/log/dropbear /etc/dropbear/log/main >> /tmp/initramfs.debug 2>&1 + ln -s /var/run/dropbear.log /etc/dropbear/log/superwise >> /tmp/initramfs.debug 2>&1 + dropbear -p 22 -E -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key 2> /tmp/sshd.log + log_end_msg $? + + rm -f /dev/random + mv /dev/random.old /dev/random + + +else + _log "INITTCOS not starting dropbear ssh server" +fi + + +if [ "$(which inetd)" ] && [ -e /etc/inetd.conf ] ; then + _log "INITTCOS starting inetd daemon" + log_begin_msg "Starting inetd" + inetd + log_end_msg $? +else + _log "INITTCOS not starting inetd" +fi + +exit 0 diff --git a/scripts/tcos-bottom/40initsound b/scripts/tcos-bottom/40initsound new file mode 100755 index 0000000..bce1879 --- /dev/null +++ b/scripts/tcos-bottom/40initsound @@ -0,0 +1,101 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + + +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + +. /bin/set-limits + +# if break=initsound STOP here +maybe_break initsound + +TCOS_DISABLE_SOUND=$(read_cmdline_var "nosound" "0") + +if [ "${TCOS_SOUND}" = "0" -o "${TCOS_DISABLE_SOUND}" = "1" ]; then + log_begin_msg "Sound disabled" + log_end_msg 1 + exit 0 +fi + + +# check if soundcard is avalaible +if [ ! -e /proc/asound ] && [ ! -e /dev/dsp ] ; then + _log "INITSOUND /proc/asound and /dev/dsp don't exists, need other kernel modules!!!" + log_failure_msg "No soundcard found" + log_end_msg 1 + exit 0 +fi + +# DOCUMENTME volume=XX% | set master and pcm volume levels to value passed (0%-100% or integer from 1 to 31) +TCOS_VOLUME=$(read_cmdline_var "volume" "${TCOS_VOLUME}") + +if [ -e /dev/dsp ] && [ ! -e /proc/asound ]; then + export TCOS_SOUND_OSS=1 + echo "TCOS_SOUND_OSS=1" >> /conf/tcos.conf + + log_begin_msg "OSS detected, try to search another sound device with ALSA support" + log_end_msg 1 + exit 0 +fi + +if [ -n "$TCOS_PULSEAUDIO" ]; then + log_begin_msg "Init sound server (PulseAudio)" + _log "INITSOUND starting pulseaudio" + startpulseaudio 2> /var/log/pulseaudio.log & + log_end_msg $? +fi + +TCOS_VOLUME_MIC=75 + +# setting volumes, set after sound server initialization +log_begin_msg "Setting audio levels to ${TCOS_VOLUME}%" + _log "INITSOUND Setting volume to ${TCOS_VOLUME}" + tmixer -c 0 sset 'Front' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Front' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'PCM' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'PCM' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Mono' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Mono' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Front' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Front' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Digital' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Master Digital' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic' ${TCOS_VOLUME_MIC} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Front Mic' ${TCOS_VOLUME_MIC} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Rear Mic' ${TCOS_VOLUME_MIC} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Front Mic' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Rear Mic' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic Boost (+20dB)' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic Boost' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Rear Mic Boost' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Front Mic Boost' off >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic Boost (+20dB)' 0% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Mic Boost' 0% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Rear Mic Boost' 0% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Front Mic Boost' 0% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Headphone' ${TCOS_VOLUME} >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Headphone' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Speaker' on >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture' cap >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,0' cap >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,1' cap >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,2' cap >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,3' cap >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture' 90% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,0' 90% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,1' 90% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,2' 90% >> /tmp/initramfs.debug 2>&1 + tmixer -c 0 sset 'Capture,3' 90% >> /tmp/initramfs.debug 2>&1 +log_end_msg 0 + +exit 0 diff --git a/scripts/tcos-bottom/55checksumoff b/scripts/tcos-bottom/55checksumoff new file mode 100755 index 0000000..cb41a61 --- /dev/null +++ b/scripts/tcos-bottom/55checksumoff @@ -0,0 +1,34 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf +. /scripts/functions +. /conf/tcos-run-functions + +rxtxoff=$(read_cmdline_var "rxtxoff" "0") + +if [ ${rxtxoff} = 1 ]; then + # get list of network interfaces + TCOS_NET_DEVS=$(ls /sys/class/net/|grep -v -e lo -e sit0 -e wmaster -e vmnet -e pan) + + # search for network interfaces with link ok status + for dev in $TCOS_NET_DEVS; do + # have link ??? + if [ -e /sys/class/net/$dev/carrier ] && \ + [ "$(cat /sys/class/net/$dev/carrier 2>/dev/null)" = 1 ] && \ + [ "$(/sbin/ethtool $dev| grep -c "Wake-on: g")" = "1" ] ; then + _log "55checksumoff disabling rx, tx protocol checksum on ifaces..." + /sbin/ethtool -K $dev rx off tx off >> /tmp/initramfs.debug 2>&1 + fi + done +fi + + + +exit 0 + diff --git a/scripts/tcos-bottom/55mount_listener b/scripts/tcos-bottom/55mount_listener new file mode 100755 index 0000000..779c39c --- /dev/null +++ b/scripts/tcos-bottom/55mount_listener @@ -0,0 +1,37 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n +. /conf/tcos-run-functions + + +# enable tcos-udev.sh events +mkdir -p /var/run/ +touch /var/run/tcos-udev.run + + +nodevices=$(read_cmdline_var "nodevices" "0") +if [ "${nodevices}" = "1" ]; then + _log "Devices disabled from cmdline" + exit 0 +fi + +if [ "$(configctl.sh --get TCOS_DISABLE_USB)" = "1" ] || \ + [ "$(configctl.sh --get TCOS_DISABLE_IDE)" = "1" ]; then + _log "Devices disabled" + exit 0 +fi + +if [ -x /usr/sbin/listener-daemon.sh ]; then + /usr/sbin/listener-daemon.sh > /var/log/listener-daemon.log 2>&1 & +fi + + +if [ -x /usr/sbin/cdrom-mount ]; then + /usr/sbin/cdrom-mount > /var/log/cdrom-mount.log 2>&1 & +fi + +exit 0 diff --git a/scripts/tcos-bottom/56tcosxmlrpc b/scripts/tcos-bottom/56tcosxmlrpc new file mode 100755 index 0000000..100acd1 --- /dev/null +++ b/scripts/tcos-bottom/56tcosxmlrpc @@ -0,0 +1,33 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + + +# if break=xmlrpc STOP here +maybe_break xmlrpc + +# DOCUMENTME noxmlrpc | disable tcosxmlrpc daemon +noxmlrpc=$(read_cmdline_var "noxmlrpc" "0") +if [ ${noxmlrpc} = 1 ]; then + _log "START-XMLR-PC xmlrpc disabled from cmdline" + exit 0 +fi + + +# start daemon +log_begin_msg "Starting tcosxmlrpc server" + _log "START-XMLRCP starting startxmlrpc...." + startxmlrpc & +log_end_msg $? + + + +exit 0 + diff --git a/scripts/tcos-bottom/57devices b/scripts/tcos-bottom/57devices new file mode 100755 index 0000000..a577e63 --- /dev/null +++ b/scripts/tcos-bottom/57devices @@ -0,0 +1,74 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + + +. /scripts/functions +. /conf/tcos.conf +. /conf/tcos-run-functions + +. /bin/set-limits + +# rewrite /etc/fstab from NFS +if [ "$(cat /tmp/less_ram)" != "0" ]; then + export NO_UDEV=1 + /scripts/tcos-top/50fstab + unset NO_UDEV +fi + +nodevices=$(read_cmdline_var "nodevices" "0") +if [ ${nodevices} = 1 ]; then + _log "Devices disabled from cmdline" + exit 0 +fi + + +if [ ${TCOS_USB} ]; then + # load floppy from /lib/extramodules + [ -e /lib/extramodules/ide-floppy.ko ] && insmod /lib/extramodules/ide-floppy.ko & + [ -e /lib/extramodules/floppy.ko ] && insmod /lib/extramodules/floppy.ko & + + MODULES="scsi_mod sd_mod sr_mod isofs vfat usbcore ehci-hcd ohci-hcd uhci-hcd usb-storage" + log_begin_msg "Loading usb modules" + for mod in ${MODULES}; do + _log "INITTCOS Loading module ${mod}" + modprobe -q $mod >> /tmp/initramfs.debug 2>&1 & + done + log_end_msg 0 +else + _log "INITTCOS usb support disabled" +fi + + + +# if break=ltspfs STOP here +maybe_break ltspfs + +# DOCUMENTME noltspfs | disable ltspfs daemon +noltspfs=$(read_cmdline_var "noltspfs" "0") +if [ ${noltspfs} = 1 ]; then + _log "LTSPFS ltspfs disabled from cmdline" + exit 0 +fi + +################################################### +# http://wiki.ltsp.org/twiki/bin/view/Ltsp/LtspFS # +################################################### + +if [ "$TCOS_REMOTEFS" = "ltspfs" ]; then + if [ -x "$(which ltspfsd)" ] ; then + # start ltspfsd daemon + log_begin_msg "Start ltspfs daemon" + _log "LTSPFS Starting ltspfs daemon" + ltspfsd + log_end_msg $? + fi +fi # end of TCOS_REMOTEFS=ltspfs + + + +exit 0 diff --git a/scripts/tcos-bottom/60installer b/scripts/tcos-bottom/60installer new file mode 100755 index 0000000..e5fa1e9 --- /dev/null +++ b/scripts/tcos-bottom/60installer @@ -0,0 +1,46 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /scripts/functions +. /conf/tcos-run-functions + + +# try to exec installer +INSTALLER=$(read_cmdline_var "installer" "0") + +# try to exec installer-update +INSTALLER_UPDATE=$(read_cmdline_var "installer-update" "0") + +if [ "${INSTALLER}" = "1" ]; then + chvt 1 + # launch installer + #clear + /sbin/installer.sh + echo "" + echo "Installer done. You can reboot now or connect server." + echo "" + echo " for reboot/poweroff exec => reboot poweroff" + echo " for connect to server exec => startremotex" + echo "" + sh +elif [ "${INSTALLER_UPDATE}" = "1" ]; then + chvt 1 + # launch installer + #clear + /sbin/installer.sh --update + echo "" + echo "Installer update done. You can reboot now or connect server." + echo "" + echo " for reboot/poweroff exec => reboot poweroff" + echo " for connect to server exec => startremotex" + echo "" +fi + + + +exit 0 diff --git a/scripts/tcos-bottom/70wakeonlan b/scripts/tcos-bottom/70wakeonlan new file mode 100755 index 0000000..d562864 --- /dev/null +++ b/scripts/tcos-bottom/70wakeonlan @@ -0,0 +1,37 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf +. /scripts/functions +. /conf/tcos-run-functions + +if [ -z "$TCOS_WAKEONLAN" ]; then + exit 0 +fi + + +# get list of network interfaces +TCOS_NET_DEVS=$(ls /sys/class/net/|grep -v -e lo -e sit0 -e wmaster -e vmnet -e pan) + +# search for network interfaces with link ok status +for dev in $TCOS_NET_DEVS; do + # have link ??? + if [ -e /sys/class/net/$dev/carrier ] && \ + [ "$(cat /sys/class/net/$dev/carrier 2>/dev/null)" = 1 ] && \ + [ "$(/sbin/ethtool $dev| grep -c "Wake-on: g")" = "1" ] ; then + _log "70WAKEONLAN Enabling WOL in $dev iface..." + [ -x /sbin/ethtool ] && \ + /sbin/ethtool -s $dev wol g >> /tmp/initramfs.debug 2>&1 + fi +done + + + + +exit 0 + diff --git a/scripts/tcos-bottom/72ntpdate b/scripts/tcos-bottom/72ntpdate new file mode 100755 index 0000000..aa54b8f --- /dev/null +++ b/scripts/tcos-bottom/72ntpdate @@ -0,0 +1,24 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf + +if [ -z "$TCOS_NTPDATE" ]; then + exit 0 +fi + + +/usr/bin/ntpdate $TCOS_NTPDATE_SERVER >> /tmp/initramfs.debug 2>&1 +if [ $? = 0 ]; then + # save clock in BIOS + hwclock --systohc >> /tmp/initramfs.debug 2>&1 +fi + + +exit 0 + diff --git a/scripts/tcos-bottom/75print b/scripts/tcos-bottom/75print new file mode 100755 index 0000000..7e20685 --- /dev/null +++ b/scripts/tcos-bottom/75print @@ -0,0 +1,35 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf +. /scripts/functions +. /conf/tcos-run-functions + +. /bin/set-limits + +if [ $TCOS_PRINTER ]; then + + LP="" + [ -e /dev/lp0 ] && LP=/dev/lp0 + [ -e /dev/lp1 ] && LP=/dev/lp1 + [ -e /dev/usblp0 ] && LP=/dev/usblp0 + [ -e /dev/usb/lp0 ] && LP=/dev/usb/lp0 + + if [ "${LP}" = "" ]; then exit 0; fi + + if [ -e /usr/bin/p910nd ]; then + + mkdir -p /var/lock/p910nd + /usr/bin/p910nd -f $LP > /var/log/p910nd.log 2>&1 & + + fi + + +fi + +exit 0 diff --git a/scripts/tcos-bottom/78cpufreq b/scripts/tcos-bottom/78cpufreq new file mode 100755 index 0000000..36fa135 --- /dev/null +++ b/scripts/tcos-bottom/78cpufreq @@ -0,0 +1,22 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf + + +if [ "$TCOS_CPUFREQ" = "1" ]; then + + modprobe acpi-cpufreq + modprobe cpufreq_powersave + if [ -e /sys/devices/system/cpu/cpu0/cpufreq ]; then + echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + fi + +fi + +exit 0 diff --git a/scripts/tcos-bottom/80shell b/scripts/tcos-bottom/80shell new file mode 100755 index 0000000..afd3a0d --- /dev/null +++ b/scripts/tcos-bottom/80shell @@ -0,0 +1,60 @@ +#!/bin/sh +# +if [ "$1" = "prereqs" ]; then + exit 0 +fi + +quiet=n + +. /conf/tcos.conf +. /scripts/functions +. /conf/tcos-run-functions + + +# kill bootchart +if grep -q bootchartd /proc/cmdline ; then + [ -x /sbin/tcos-bootchartd ] && /sbin/tcos-bootchartd stop +fi + +TCOS_TTY=$(read_cmdline_var "ttys" "${TCOS_TTY}") + +export PS1="($(whoami)@$(hostname)) # " + +grep -q " startx=N " /proc/cmdline && chvt 1 + +# empty memory cache +# from http://linux-mm.org/Drop_Caches +sync +echo 3 > /proc/sys/vm/drop_caches + +# no clear +#clear + + +while [ ${TCOS_TTY} -ge 1 ]; do + if [ ${TCOS_TTY} = 1 ] ; then + if [ "${TCOS_TTY1_PROTECTED}" = "1" ]; then + rungetty tty${TCOS_TTY} + else + echo "" + echo "" + echo "Press enter to activate this console..." + read enter + sh + fi + else + rungetty tty${TCOS_TTY} & + fi + + TCOS_TTY=$((TCOS_TTY -1)) +done + + + + + +while [ 1 ]; do + sh +done + +exit 0 |