Neubau für die v962 Version

git-svn-id: svn://svn.compuextreme.de/Viitor/V962/Viitor_upstart@5272 504e572c-2e33-0410-9681-be2bf7408885
This commit is contained in:
kueller 2010-01-28 13:58:15 +00:00
parent a5cdb6ebcc
commit c4fdee013e
23 changed files with 612 additions and 108 deletions

Binary file not shown.

View File

@ -14,13 +14,12 @@ author "Harald Kueller <harald.kueller@compuextreme.de>"
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
source /etc/event.d/functions
if [ -f /fastboot ]; then
echo "Fast boot, no file system check"
else
echo "Changing state of rootfs to ro"
/bin/mount -n -o remount,ro /
evaluate_retval
status_message "change / to ro ..."
if [ $? = 0 ]; then
if [ -f /forcefsck ]; then
echo -n "/forcefsck exists, forcing "

View File

@ -9,9 +9,6 @@ start on startup
description "Check if / ist nfs"
author "Harald Kueller <harald.kueller@compuextreme.de>"
# Note: there can be no previous runlevel here, if we have one it's bad
# information (we enter rc1 not rcS for maintenance). Run /etc/init.d/rc
# without information so that it defaults to previous=N runlevel=S.
console output
script
mount -t proc none /proc

431
etc/event.d/functions Executable file
View File

@ -0,0 +1,431 @@
#!/bin/bash
#Framework, welches ein komplettes Linux System aus den Sourcen erstellt
#dieses Framework wird im CVS Repository
#:pserver:cvs.compuextreme.de:/Data/cvs zur Verfügung gestellt
#
#Lage dieser Datei im Archiv: $Source: /export/Data/cvs/Viitor_sysvinit/etc/init.d/functions,v $
#
#(c) 2003 Harald Kueller, Germany
#This program is free software; you can redistribute it and/or
#modify ist under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version
#2 of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#See the GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not write to the Free Software Foundation,
#Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#InitScript zum Start des Daemons:
#Funktionen für die init scripten
#Dieses Script basiert auf der Vorlage des Linuxfromscratch Projetes
#
#Letzte Änderung von: $Author: kueller $
#Datum der letzten Änderung: $Date: 2004/03/03 12:48:07 $
#Version der Datei: $Revision: 1.12 $
#
#$Log: functions,v $
#Revision 1.12 2004/03/03 12:48:07 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.11 2002/09/30 20:32:22 kueller
#Korrektur der Funktion getmasks - bei nichtvorhandener /etc/netmasks
#bricht die Funktion mit einem [] Fehler ab. Variable FOUND wurde
#in diesem Fall nicht gesetzt. Fehler behoben
#
#Revision 1.10 2002/09/23 20:22:09 hkueller
#Anpassung der Funktionen an BASH - dazu musste jedes typeset kommando
#entfernt werden, da bash keine zahlenumrechnung kann. Durch Neue Funktion
#GetShortMask problem mit short mask angabe bei ip kommando ohne verwendung
#von umrechnungsfunktionen gelöst.
#
#Revision 1.9 2002/09/11 18:16:05 hkueller
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.8 2002/08/09 07:00:00 hkueller
#getmask vereinfacht und beschleunigt
#
#Revision 1.6 2002/05/05 14:40:08 hkueller
#mit neuem Release wandert basename von /usr/bin nach /bin. functions
#entsprechend angepasst
#
#Revision 1.5 2002/02/05 02:59:04 hkueller
#functions: getbroadcast() hinzugefuegt - gibt broadcast eines Netzes
# zurueck - Aufruf: getbroadcast <IP> <NETMASK>
# getmask erweitert - keine mask in /etc/netmasks ->
# defaultmask (Class A/B/C)
#networks: Ueberfaelliger eintrag fuer PTP entfernt
# Eintraege zur Konfiguration mit ifconfig hinzugefuegt - aber
# auskommentiert.
#
#Revision 1.4 2001/11/18 21:25:52 kueller
#Korrektur der Aufräumfunktion (sed Regulare Expression) für /etc/netmasks
#(getmask funktion)
#
#Revision 1.3 2001/11/17 23:41:35 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#
#Revision 1.2 2001/11/17 22:20:33 kueller
#Funktionen dectohex und dectobin zur Umrechnung von dezimalen IP Adressen in
#Binäre bzw. Dezimale Darstellung hinzugefügt.
#Achtung: Diese Funktione funktionieren nur in Verbindung mit der zsh oder
#eine ksh - nicht mit sh oder bash!!!!
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.2 2001/08/25 10:14:28 kueller
#
#Optische Retusche der READY und FAILED Meldungen
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
if [ "$COLUMNS" ]; then
(( COL = $COLUMNS - 10 ))
else
COL=70
fi
SET_COL="/bin/echo -en \\033[${COL}G"
NORMAL="/bin/echo -en \\033[0;39m"
SUCCESS="/bin/echo -en \\033[1;42m"
FAILURE="/bin/echo -en \\033[1;41m"
evaluate_retval()
{
if [ $? = 0 ]
then
print_status success
else
print_status failure
fi
}
status_message() {
STATUS=$?
Message=$1
if [ $# = 0 ]; then
echo "Usage: status_message <Message>"
fi
echo -n $Message
if [ $? = 0 ]; then
print_status success
else
print_status failure
fi
}
print_status()
{
if [ $# = 0 ]
then
echo "Usage: print_status {success|failure}"
exit 1
fi
case "$1" in
success)
$SET_COL
$SUCCESS
echo -n " READY "
$NORMAL
echo ""
;;
failure)
$SET_COL
$FAILURE
echo -n " FAILED "
$NORMAL
echo ""
;;
esac
}
loadproc()
{
if [ $# = 0 ]
then
echo "Usage: loadproc {program}"
exit 1
fi
base=`/bin/basename $1`
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
if [ ! -n "$pid" ]
then
$*
status_message "$* ..."
else
print_status failure
fi
}
killproc()
{
if [ $# = 0 ]
then
echo "Usage: killproc {program} [signal]"
exit 1
fi
base=`/bin/basename $1`
if [ "$2" != "" ]
then
killlevel=$2
else
nolevel=1
fi
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
if [ -n "$pid" ]
then
if [ "$nolevel" = 1 ]
then
/bin/kill -TERM $pid
if ps h $pid >/dev/null 2>&1
then
/bin/kill -KILL $pid
fi
/bin/ps h $pid >/dev/null 2>&1
if [ $? = 0 ]
then
print_status failure
else
/bin/rm -f /var/run/$base.pid
print_status success
fi
else
/bin/kill $killlevel $pid
/bin/ps h $pid >/dev/null 2>&1
if [ $? = 0 ]
then
print_status failure
else
/bin/rm -f /var/run/$base.pid
print_status success
fi
fi
else
print_status failure
fi
}
reloadproc()
{
if [ $# = 0 ]
then
echo "Usage: reloadproc {program} [signal]"
exit 1
fi
base=`/bin/basename $1`
if [ -n "$2" ]
then
killlevel=-$2
else
nolevel=1
fi
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
if [ -n "$pid" ]
then
if [ "$nolevel" = 1 ]
then
/bin/kill -SIGHUP $pid
evaluate_retval
else
/bin/kill -$killlevel $pid
evaluate_retval
fi
else
print_status failure
fi
}
statusproc()
{
if [ $# = 0 ]
then
echo "Usage: status {program}"
return 1
fi
pid=`/bin/pidof -o $$ -o $PPID -o %PPID -x $1`
if [ -n "$pid" ]
then
echo "$1 running with Process ID $pid"
return 0
fi
if [ -f /var/run/$1.pid ]
then
pid=`/usr/bin/head -1 /var/run/$1.pid`
if [ -n "$pid" ]
then
echo "$1 not running but /var/run/$1.pid exists"
return 1
fi
else
echo "$i is not running"
fi
}
getbroadcast() {
IP=$1
MASK=$2
for i in 1 2 3 4; do
IP[$i]=`echo $IP|awk -F. '{print $'$i'}'`
MASK[$i]=`echo $MASK|awk -F. '{print $'$i'}'`
(( BCAST[$i] = ${IP[$i]} | (( ${MASK[$i]} ^ 255 )) ))
done
echo ${BCAST[1]}.${BCAST[2]}.${BCAST[3]}.${BCAST[4]}
}
getnetaddr() {
IP=$1
MASK=$2
for i in 1 2 3 4; do
IPS=`echo $IP|awk -F. '{print $'$i'}'`
MASKS=`echo $MASK|awk -F. '{print $'$i'}'`
(( BCASTS = $IPS & $MASKS ))
if [ "$i" = "4" ]; then
printf "$BCASTS"
else
printf "$BCASTS."
fi
done
echo
}
getmask() {
IP=$1
FOUND=0
if [ -f /etc/netmasks ]; then
sed -e "/^#/d" /etc/netmasks |\
sed -e "/^ *$/d" >/tmp/if
while read NETADDR NETMASK; do
NETIP=`getnetaddr $IP $NETMASK`
if [ "$NETADDR" = "$NETIP" ]; then
echo $NETMASK
FOUND=1
break
fi
done </tmp/if
rm /tmp/if
fi
if [ "$FOUND" -eq "0" ]; then
Byte=`echo $IP|awk -F . '{ print $1 }'`
if [ "$Byte" -le 127 ] && [ "$Byte" -ge 1 ]; then
echo "255.0.0.0"
elif [ "$Byte" -le 191 ] && [ "$Byte" -ge 128 ]; then
echo "255.255.0.0"
elif [ "$Byte" -le 223 ] && [ "$Byte" -ge 192 ]; then
echo "255.255.255.0"
else
echo "255.255.255.255"
fi
fi
}
GetShortMask () {
IP=$1
NumIP=0
for i in 1 2 3 4; do
Byte=`echo $IP|awk -F . '{ print $'$i' }'`
if (( "$Byte" & 128 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 64 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 32 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 16 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 8 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 4 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 2 )); then
(( NumIP = $NumIP + 1 ))
fi
if (( "$Byte" & 1 )); then
(( NumIP = $NumIP + 1 ))
fi
done
echo $NumIP
}
initautomount() {
MOUNTSOURCE=$1
AUTOMOUNTSOURCE=$2
source /etc/sysconfig/autofstime
sed -e '/^#/d' |\
sed -e '/^ *$/d' >/tmp/autofs
exec 3</tmp/autofs
while read <&3 MOUNTPOINT FILE; do
echo -n "starting automount for $MOUNTPOINT ($MOUNTSOURCE)"
automount -t $TIMEOUT $MOUNTPOINT $AUTOMOUNTSOURCE,sun $FILE
status_message "automount is ..."
done
exec 3>&-
rm /tmp/autofs
}
# End /etc/init.d/functions

View File

@ -11,9 +11,12 @@ start on stopped udevstart
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/event.d/functions
if [ -f /etc/sysconfig/nodename ]; then
/bin/hostname `cat /etc/sysconfig/nodename`
status_message "Hostname set to $HOSTNAME"
else
/bin/hostname "localhost"
status_message "Hostname set to $HOSTNAME"
fi
end script

View File

@ -6,9 +6,11 @@
start on started udev
script
source /etc/init.d/functions
source /etc/event.d/functions
for RC in /etc/hotplug/*.rc; do
$RC start
done
touch /var/lock/subsys/hotplug
echo -n "starting of hotplug"
print_status success
end script

View File

@ -9,6 +9,7 @@ stop on stopping mountfs
console logged
pre-start script
WAITTIME=7
for IF in `ls -d /sys/class/net/*[^lo]`; do
DEVNAME=`basename $IF`
if [ -d /sys/class/net/$DEVNAME/wireless ]; then
@ -17,15 +18,62 @@ pre-start script
sleep 1
fi
if [ -f /usr/sbin/ethtool ]; then
if [ `ethtool $DEVNAME|grep Link|awk '{print $3}'` == "yes" ]; then
/sbin/if_up $DEVNAME
ifconfig $DEVNAME up
ZAHLER=0
if ! ethtool $DEVNAME|grep -q "No data available"; then
while [ ${ZAHLER} -le ${WAITTIME} ]; do
if [ `ethtool $DEVNAME|grep Link|awk '{print $3}'` == "yes" ]; then
(( ZAHLER++ ))
else
break
fi
sleep 1
done
fi
else
fi
ifconfig $DEVNAME up
ZAHLER=0
while [ ${ZAHLER} -le ${WAITTIME} ]; do
if [ "`cat /sys/class/net/$DEVNAME/carrier`" == "0" ]; then
(( ZAHLER++ ))
else
break
fi
sleep 1
done
end script
script
for IF in `ld -d /sys/class/net/*[^lo]`; do
DEVNAME=`basename $IF`
if [ -f /usr/sbin/ethtool ]; then
DEVSTATUS=`ethtool $DEVNAME|grep Link|awk '{print $3}'`
fi
if [ "$DEVSTATUS" == "yes" ] || [ `cat /sys/class/net/$DEVNAME/carrier` == "1" ]; then
/sbin/if_up $DEVNAME
touch /var/run/net_up
fi
done
end script
post-start script
if [ ! -f /var/run/net_up ] && [ -f /etc/nsswitch.default ]; then
cp /etc/nsswitch.files /etc/nsswitch.conf
touch /var/state/ldap_disable
else
if [ ! -f /var/run/nsswitch_done ] && [ -f /etc/nsswitch.default ]; then
cp /etc/nsswitch.default /etc/nsswitch.conf
touch /var/state/ldap_disable
fi
if [ -f /var/run/net_up ]; then
rm /var/run/net_up
fi
if [ -f /var/run/nsswitch.done ]; then
rm /var/run/nsswitch.done
fi
fi
end script
post-stop script
for IF in `ls -d /sys/class/net/*[^lo]`; do
DEVNAME=`basename $IF`

View File

@ -16,15 +16,13 @@ console logged
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
source /etc/event.d/functions
if [ -f /sbin/vgscan ]; then
echo -n "Scanning Volumes"
/sbin/vgscan >/dev/null 2>&1
evaluate_retval
status_message "Scanning of Volumes....."
for i in `vgdisplay|grep "VG Name"|awk '{print $3}'`; do
echo -n "Activating Volume $i"
vgchange -a y $i
evaluate_retval
vgchange -a -y $i
status_message "Volume Aktivation of $i ..."
done
fi
end script

View File

@ -11,16 +11,15 @@ start on started mountfs
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
source /etc/event.d/functions
if [ -f /etc/sysconfig/kbd/setkeys ]; then
echo -n "Loading Special kbd mappings"
exec 3</etc/sysconfig/kbd/setkeys
while read <&3 CODE MAP; do
setkeycodes $CODE $MAP
done
evaluate_retval
status_message "Load of Special kbd mappings..."
exec 3>&-
fi
echo -n "Loading keymap..."
/bin/loadkeys -d >/dev/null
status_message "Load Keymap ..."
end script

View File

@ -7,13 +7,14 @@ start on started udev
stop on stopping udev
pre-start script
source /etc/init.d/functions
source /etc/event.d/functions
if [ -f /etc/sysconfig/loadmods ]; then
sed -e "/^#/d" /etc/sysconfig/loadmods |
sed -e "/^ *$/d" >/tmp/loadmods
exec 3</tmp/loadmods
while read <&3 MODULE OPTIONS; do
modprobe -s $MODULE $OPTIONS
status_message "Load of KernelModule $MODULE..."
done
rm /tmp/loadmods
fi

View File

@ -12,9 +12,13 @@ console logged
# information (we enter rc1 not rcS for maintenance). Run /etc/init.d/rc
# without information so that it defaults to previous=N runlevel=S.
pre-start script
source /etc/event.d/functions
/sbin/ifconfig lo 127.0.0.1
status_message "Setup local net..."
end script
post-stop script
source /etc/event.d/functions
/sbin/ifconfig lo down
status_message "Remove Local Net..."
end script

View File

@ -16,7 +16,7 @@ author "Harald Kueller <harald.kueller@compuextreme.de>"
# without information so that it defaults to previous=N runlevel=S.
console output
pre-start script
source /etc/init.d/functions
source /etc/event.d/functions
echo -n "Remounting rootfs in rw mode..."
/bin/mount -n -o remount,rw /
evaluate_retval
@ -42,7 +42,7 @@ pre-start script
end script
post-stop script
source /etc/init.d/functions
source /etc/event.d/functions
echo -n "Deactivating swap..."
/sbin/swapoff -a

View File

@ -9,27 +9,25 @@ stop on stopping nfsclient
console output
pre-start script
source /etc/init.d/functions
source /etc/event.d/functions
for i in `sed -e "/^#/d" /etc/fstab|awk '{print $2}'`; do
MOUNTPOINT=$i
FILESYSTEM=`awk '{if( $2 == "'$MOUNTPOINT'") print $3}' /etc/fstab`
if [ "$FILESYSTEM" == "nfs" ]; then
echo -n "Mounting nfs $MOUNTPOINT"
mount $MOUNTPOINT
evaluate_retval
status_message "Mount nfs Filesystem on $MOUNTPOINT"
fi
done
end script
post-stop script
source /etc/init.d/functions
source /etc/event.d/functions
for i in `sed -e "/^#/d" /etc/fstab|awk '{print $2}'`; do
MOUNTPOINT=$i
FILESYSTEM=`awk '{if( $2 == "'$MOUNTPOINT'") print $3}' /etc/fstab`
if [ "$FILESYSTEM" == "nfs" ]; then
echo -n "Mounting nfs $MOUNTPOINT"
umount $MOUNTPOINT
evaluate_retval
status_message "umount NFS Filesystem from $MOUNTPOINT"
fi
done
end script

View File

@ -11,11 +11,9 @@ start on varmake
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
echo -n "Mounting tmpfs on /var"
source /etc/event.d/functions
mount -t tmpfs none /var
evaluate_retval
echo -n "Getting Hostname ..."
status_message "Mount tmpfs on /var"
ifconfig|\
grep Protokoll|\
awk '{ if ( $2 == "Protokoll:Ethernet" ) print $1 }' >/var/devices
@ -33,14 +31,12 @@ script
break
fi
done
echo -n " $HOSTNAME"
evaluate_retval
echo -n "Restoring var folder"
status_message "Getting Hostname $HOSTNAME.."
cd /var
tar -zxf /boot/var_${HOSTNAME}.tgz
echo $HOSTNAME >etc/sysconfig/nodename
cd -
evaluate_retval
status_message "Restore of /var folder"
umount /proc
/sbin/initctl mount_virtual
end script

View File

@ -8,7 +8,7 @@ start on started ifup
console logged
script
source /etc/init.d/functions
source /etc/event.d/functions
if [ ! -f /etc/sysconfig/net/notrouter ]; then
echo "Configuring System with routing allowed"
if [ -f /etc/sysconfig/net/gateways ]; then
@ -18,14 +18,12 @@ script
read <&3 TYPE NETWORK OPTION GW NETMASK
while [ $TYPE ]; do
if [ "$OPTION" == "dev" ]; then
echo -n "Adding device Route to $NETWORK with $NETMASK on $GW"
route add -$TYPE $NETWORK netmask $NETMASK dev $GW
evaluate_retval
status_message "Device route to $NETWORK with $NETMASK on $GW"
fi
if [ "$OPTION" == "gw" ]; then
echo -n "Adding net Route to $NETWORK with $NETMASK and gw $GW"
route add -$TYPE $NETWORK netmask $NETMASK gw $GW
evaluate_retval
status_message "Net Route to $NETWORK with $NETMASK and gw $GW"
fi
read <&3 TYPE NETWORK OPTION GW NETMASK
done
@ -33,15 +31,13 @@ script
rm /tmp/gateways
fi
if [ -f /etc/sysconfig/net/defaultrouter ]; then
echo -n "setting up defaultrouter `cat /etc/sysconfig/net/defaultrouter`"
$DEBUG route add default gw `cat /etc/sysconfig/net/defaultrouter`
evaluate_retval
route add default gw `cat /etc/sysconfig/net/defaultrouter`
status_message "Default Router set to `cat /etc/sysconfig/net/defaultrouter`"
fi
NUMIF=`ip -f inet addr show|grep inet|wc -l`
NUMIF=`ip -f inet addr show|grep inet|grep -v "host lo"|wc -l`
if [ $NUMIF -gt 2 ]; then
echo -n "Enable ip_forwarding"
echo "1" >/proc/sys/net/ipv4/ip_forward
evaluate_retval
status_message "Enable of ip_forwarding"
fi
fi
end script

View File

@ -11,14 +11,13 @@ start on started mountfs
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
source /etc/event.d/functions
CLOCKPARAMS="--hctosys"
case "$UTC" in
yes|true|1)
CLOCKPARAMS="$CLOCKPARAMS -u"
;;
esac
echo -n "Setting clock.."
/sbin/hwclock $CLOCKPARAMS
evaluate_retval
status_message "Load of hwclock..."
end script

View File

@ -12,28 +12,25 @@ start on start udev
console output
script
if [ -f /sbin/udevstart ]; then
. /etc/init.d/functions
. /etc/event.d/functions
. /etc/udev/udev.conf
prog=udev
szsfs_dir=/sys
sysfs_dir=/sys
bin=/lib/udev
udevd=/sbin/udevd
udev_root=/dev
echo "Bringing udev system up"
echo -n "mounting sys"
mount -t sysfs none /sys
evaluate_retval
echo -n ".../var/lock"
status_message "mount of sys..."
if [ ! -d /var/lock/subsys ]; then
mkdir /var/lock/subsys
fi
if [ ! -d $udev_root ]; then
mkdir $udev_root
fi
evaluate_retval
echo -n ".../dev "
status_message "Creation ov /var/lock..."
mount -t tmpfs none /dev
evaluate_retval
status_message "Mounting tmpfs to /dev..."
export ACTION=add
echo -n "Creating initial udev device nodes"
/sbin/udevstart

View File

@ -6,39 +6,34 @@ start on varmake
#stop on runlevel
# Note: there can be no previous runlevel here, if we have one it's bad
# information (we enter rc1 not rcS for maintenance). Run /etc/init.d/rc
# without information so that it defaults to previous=N runlevel=S.
console output
script
echo -n "Mounting tmpfs on /var"
source /etc/init.d/functions
mount -t tmpfs none /var
evaluate_retval
echo -n "Getting Hostname ..."
status_message "Mount of tmpfs to /var ...."
ifconfig|\
grep Protokoll|\
awk '{ if ( $2 == "Protokoll:Ethernet" ) print $1 }' >/var/devices
for i in `cat /var/devices`; do
INET=`ifconfig $i|\
grep inet|\
awk -F ":" '{print $2}'|\
awk '{print $1}'`
ANET=`echo $INET|awk -F "." '{print $1}'`
if [ ! "$ANET" == "127" ]; then
HOSTNAME=`getent hosts $INET`
HOSTNAME=`echo $HOSTNAME|\
awk '{print $2}'|\
awk -F "." '{print $1}'`
break
fi
done
echo -n " $HOSTNAME"
evaluate_retval
echo -n "Restoring var folder"
for i in `cat /var/devices`; do
INET=`ifconfig $i|\
grep inet|\
awk -F ":" '{print $2}'|\
awk '{print $1}'`
ANET=`echo $INET|awk -F "." '{print $1}'`
if [ ! "$ANET" == "127" ]; then
HOSTNAME=`getent hosts $INET`
HOSTNAME=`echo $HOSTNAME|\
awk '{print $2}'|\
awk -F "." '{print $1}'`
break
fi
done
echo -n " $HOSTNAME"
status_message "Trying to find out hostname..."
cd /var
tar -zxf /boot/var_${HOSTNAME}.tgz
echo $HOSTNAME >etc/sysconfig/nodename
cd -
evaluate_retval
status_message "Restore of var Filesystem..."
/sbin/initctl emit start udev
end script

View File

@ -11,19 +11,17 @@ start on stopped udevstart
# without information so that it defaults to previous=N runlevel=S.
console output
script
source /etc/init.d/functions
echo -n "Changing state of rootfs to rw"
source /etc/event.d/functions
/bin/mount -n -o remount,rw /
evaluate_retval
status_message "Changing state of rootfs to rw"
echo >/dev/mtab
/bin/mount -f -o remount,rw /
for i in `sed -e "/^#/d" /etc/fstab|awk '{print $2}'`; do
MOUNTPOINT=$i
DEVICE=`awk '{if( $2 == "'$MOUNTPOINT'") print $1}' /etc/fstab`
if [ "$DEVICE" == "none" ]; then
echo -n "Mounting $MOUNTPOINT"
mount $MOUNTPOINT
evaluate_retval
status_message "Mounting $MOUNTPOINT ..."
fi
done
end script

View File

@ -9,9 +9,11 @@ stop on stopping rpc
console output
pre-start script
source /etc/event.d/functions
if [ -f /etc/sysconfig/nis/defaultdomain ]; then
domainname `cat /etc/sysconfig/nis/defaultdomain`
/usr/sbin/ypbind
status_message "ypclient started"
sleep 2
fi
end script

View File

@ -36,7 +36,8 @@ if [ ! "$DEV" ]; then
exit 10
fi
if [ -f /etc/sysconfig/net/${DEV}.dhcp ]; then
kill `ps -ef|grep dhclient|grep eth0|awk '{print $2}'`
kill `ps -ef|grep dhclient|grep ${DEV}|awk '{print $2}'`
ifconfig $DEV 0.0.0.0 down
elif [ -f /etc/sysconfig/net/hostname.${DEV} ]; then
HOST=`cat /etc/sysconfig/net/hostname.${DEV}|awk '{print $1}'`
IP=`grep $HOST /etc/hosts|awk '{print $1}'`

View File

@ -32,25 +32,29 @@
source /etc/init.d/functions
DEV=$1
if [ ! "$DEV" ]; then
echo "Usage: $0 <NetworkInterfaceName>"
exit 10
echo "Usage: $0 <NetworkInterfaceName>"
exit 10
fi
if [ -f /etc/sysconfig/net/${DEV}.dhcp ]; then
dhclient -q ${DEV}
elif [ -f /etc/sysconfig/net/hostname.${DEV} ]; then
HOST=`cat /etc/sysconfig/net/hostname.${DEV}|awk '{print $1}'`
IP=`grep $HOST /etc/hosts|awk '{print $1}'`
NETMASK=`getmask $IP`
SHMASK=`GetShortMask $NETMASK`
echo -n "setting up interface $i:IP=$IP NMASK=$NETMASK"
if [ "$NETMASK" = "" ]; then
DEV=`echo $i|cut -d ":" -f 1`
$DEBUG ip addr add $IP broadcast + dev $DEV
$DEBUG ip link set $DEV up
else
DEV=`echo $i|cut -d ":" -f 1`
$DEBUG ip addr add $IP/$SHMASK broadcast + dev $DEV
$DEBUG ip link set $DEV up
fi
evaluate_retval
echo -n "Setting up ${DEV} with dhcp"
dhclient -q ${DEV}
evaluate_retval
elif ls /etc/sysconfig/net/hostname.${DEV}* &>/dev/null; then
for NETDEV in `ls /etc/sysconfig/net/hostname.${DEV}*|awk -F "." '{print $2}'`; do
HOST=`cat /etc/sysconfig/net/hostname.${NETDEV}|awk '{print $1}'`
IP=`grep $HOST /etc/hosts|awk '{print $1}'`
NETMASK=`getmask $IP`
SHMASK=`GetShortMask $NETMASK`
echo -n "setting up interface $NETDEV:IP=$IP NMASK=$NETMASK"
if [ "$NETMASK" = "" ]; then
DEV=`echo $NETDEV|cut -d ":" -f 1`
$DEBUG ip addr add $IP broadcast + dev $DEV
$DEBUG ip link set $DEV up
else
DEV=`echo $NETDEV|cut -d ":" -f 1`
$DEBUG ip addr add $IP/$SHMASK broadcast + dev $DEV
$DEBUG ip link set $DEV up
fi
done
evaluate_retval
fi

View File

@ -35,11 +35,17 @@
#
source /etc/init.d/functions
if [ ! -f /var/state/ldap_disable ]; then
touch /var/state/ldap_disable
fi
NSSWITCH=/etc/nsswitch.conf
DEV=$1
if [ ! "$DEV" ]; then
echo "usage: $0 <WireLessLanDevice>"
exit 1
fi
/sbin/ifconfig $DEV up
if [ ! -d /sys/class/net/$DEV/wireless ]; then
echo "No Wireless Device"
exit 2
@ -66,6 +72,19 @@ for AP in `iwlist $DEV scan 2>/dev/null|\
echo -n "Configuring txpower to $ARG1"
$DEBUG iwconfig $DEV txpower $ARG1
;;
YP)
echo "domain $ARG1 server $ARG2" >/etc/yp.conf
NISSTR="nis"
;;
LDAP)
export USE_LDAP=1
LDAPSTR="ldap"
rm /var/state/ldap_disable
;;
DNS)
echo "#Resolv.conf generatet by wlan_setup" >/etc/resolv.conf
echo "nameserver $ARG1" >>/etc/resolv.conf
;;
esac
read <&3 OPTION ARG1 ARG2
done
@ -73,3 +92,20 @@ for AP in `iwlist $DEV scan 2>/dev/null|\
rm /tmp/AP
fi
done
FILESTR="files"
echo "passwd: $FILESTR $LDAPSTR $NISSTR" >$NSSWITCH
echo "group: $FILESTR $LDAPSTR $NISSTR" >>$NSSWITCH
echo "shadow: $FILESTR $LDAPSTR" >>$NSSWITCH
echo "publickkey: $FILESTR" >>$NSSWITCH
echo "hosts: dns $FILESTR $LDAPSTR $NISSTR" >>$NSSWITCH
echo "networks: $FILESTR $NISSTR" >>$NSSWITCH
echo "protocols: db $NISSTR $FILESTR" >>$NSSWITCH
echo "services: db $NISSTR $FILESTR" >>$NSSWITCH
echo "rpc: db $NISSTR $FILESTR" >>$NSSWITCH
echo "ethers: db $NISSTR $FILESTR" >>$NSSWITCH
echo "netmasks: $FILESTR $NISSTR" >>$NSSWITCH
echo "netgroup: $FILESTR $NISSTR" >>$NSSWITCH
echo "bootparams: $FILESTR" >>$NSSWITCH
echo "automount: $FILESTR $NISSTR" >>$NSSWITCH
echo "aliases: $FILESTR" >>$NSSWITCH
touch /var/run/nsswitch_done