Neue Version V963

git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_sysvinit@5933 504e572c-2e33-0410-9681-be2bf7408885
This commit is contained in:
kueller 2011-01-03 10:48:06 +00:00
commit 6fe55395a2
26 changed files with 3093 additions and 0 deletions

156
etc/init.d/checkfs Normal file
View File

@ -0,0 +1,156 @@
#!/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$
#
#(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:
#Start/Stop Script checkfs
#FileSystem Checks initiieren
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.8 2004/03/03 12:48:07 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.7 2003/10/27 12:03:11 kueller
#volume Aktivierung mit entsprechender Bootmeldung versehen, und in
#Abfrage auf LVM Binarys eingepackt.
#
#Revision 1.6 2003/10/26 11:33:39 kueller
#Config-Schnittstelle hat sich geaendert. Volume Groups koennen nicht mehr
#Ueber ein File erfragt werden, sondern ueber vgdisplay.
#
#Revision 1.5 2003/07/15 06:40:51 kueller
#Prüfen der vorhandenen Volumes über /etc/sysconfig/lvmtab nicht möglich, da hier
#die Volumes ohne Trennzeichen stehen. Dies laesst die for schleife nicht funktionieren,
#sobald mehr als ein Volume im System vorhanden ist.
#Volumes stehen aber als Datei nocheinamal unter /etc/sysconfig/lvmtab.d. Eine Auswertung
#auf diese Dateien funktioniert auch bei mehreren Volumes.
#
#Revision 1.4 2002/10/15 17:34:25 kueller
#Korrekturen beim Variablenhandling. Bei IF Abfragen sollten Variablen in
#Anfuehrungszeichen stehen
#
#Revision 1.3 2002/10/10 08:12:19 kueller
#Aktivierung der volumes in mountfs macht probleme beim fsck, zu
#zum Zeitpunkt des fsck laufes die Volumes noch nicht bekannt sind.
#Zum Aktivieren der Volumes ist mindestens das vonhandensein von /proc
#notwendig. Daher werden die "none" Filesysteme (tmpfs, procfs, ptsfs, usbfs)
#nun bereits in checkfs angemeldet. Ausserdem werden die Volumes vor dem
#start von fsck aktiviert. Dies sollte speziell probleme mit ext2 und ext3
#Filesystemen beheben.
#
#Revision 1.2 2002/09/22 14:54:41 hkueller
#Aktivierung des Swap Bereichs erfolgt nun nach der Aktivierung der Volumes.
#Damit darf auf eine Volume als Swap verwendung finden
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/checkfs
source /etc/init.d/functions
echo "Changing state of rootfs to rw"
/bin/mount -n -o remount,rw /
evaluate_retval
echo >/etc/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
fi
done
if [ -f /sbin/vgscan ]; then
echo -n "Scanning Volumes"
/sbin/vgscan >/dev/null 2>&1
evaluate_retval
for i in `vgdisplay|grep "VG Name"|awk '{print $3}'`; do
echo -n "Activating Volume $i"
vgchange -a y $i
evaluate_retval
done
fi
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
if [ $? = 0 ]
then
if [ -f /forcefsck ]
then
echo -n "/forcefsck exists, forcing "
echo "file system check"
force="-f"
else
force=""
fi
echo "Checking file systems..."
/sbin/fsck $force -a -A -C -T
if [ $? -gt 1 ]
then
$FAILURE
echo
echo -n "fsck failed. Please repair your file "
echo "systems manually by running /sbin/fsck"
echo "without the -a option"
echo
echo -n "Please note that the root file system "
echo "is currently mounted in read-only mode."
echo
echo -n "I will start sulogin now. When you "
echo "logout I will reboot your system."
echo
$NORMAL
/sbin/sulogin
/sbin/reboot -f
else
print_status success
fi
else
echo -n "Cannot check root file system because it "
echo "could not be mounted in read-only mode."
fi
fi
# End /etc/init.d/checkfs

97
etc/init.d/dbus Executable file
View File

@ -0,0 +1,97 @@
#!/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$
#
#(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:
#
#Letzte Änderung von: $Author: kueller $
#Datum der letzten Änderung: $Date: 2009-04-27 13:14:47 +0200 (Mo, 27 Apr 2009) $
#Version der Datei: $Revision: 4633 $
#
#$Log$
#Revision 1.7 2007/04/28 20:13:35 kueller
#Entspricht eigentlich wieder der Version 1.5 -> Rev. 1.6 war ein
#Fehlerhafter checkin eines Files fuer /etc/sysconfig/profile.d,
#nicht fuer /etc/init.d
#
#Revision 1.5 2007/04/13 09:22:39 kueller
#Anpassung des startup -> Dbus wird nun mit systemweiter Konfiguration gestartet
#neue postinstall installiert den in der neuen version erwarteten user messagebus
#
#Revision 1.4 2007/04/12 10:01:17 kueller
#Startup fehler wegen vorhandenem /var/run/dbus/pid nach
#system absturz wird nun aufgefangen
#
#Revision 1.3 2007/02/18 08:59:04 kueller
#PATH erweitert, so das dbus-launch, sowie die zugehoerigen daemons gefunden
#werden.
#
#Revision 1.2 2006/07/18 13:26:27 kueller
#Aufgrund neuer configure optionen (sysstatedir) ist /var/run/dbus nun ein
#verzeichniss. initscript entsprechend geaendert. Ausserdem wird mehrmaliges
#aufrufen mit "stop" option jetzt abgefangen
#
#Revision 1.1.1.1 2006/07/18 12:54:21 kueller
#Startup Script fuer dbus
#
#
source /etc/init.d/functions
case "$1" in
start)
if [ -f /var/run/dbus/pid ]; then
if [ "`pgrep dbus-daemon`" == "`cat /var/run/dbus/pid`" ]; then
echo "The dbus deamon is already running with pid `cat /var/run/dbus/pid`"
exit 10
else
rm /var/run/dbus/*
fi
fi
export PATH=$PATH:/usr/X11R7/bin
echo -n "Starting dbus messaging system"
dbus-daemon --system
evaluate_retval
;;
stop)
if [ ! -f /var/run/dbus/pid ]; then
echo "dbus is not running!"
exit 10
fi
echo -n "Stopping dbus messaging system"
kill `cat /var/run/dbus/pid` &&
rm /var/run/dbus/pid &&
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

396
etc/init.d/functions Normal file
View File

@ -0,0 +1,396 @@
#!/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$
#
#(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$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#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
#
#
COL=70
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
}
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
$*
evaluate_retval
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
}
# End /etc/init.d/functions

48
etc/init.d/halt Normal file
View File

@ -0,0 +1,48 @@
#!/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$
#
#(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:
#halt script des sysvinit Prozesses
#Basierend auf eine vorlage des linuxfromscratch Projektes
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.2 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/halt
/sbin/halt -d -f -i -p
# End /etc/init.d/halt

137
etc/init.d/ifup Normal file
View File

@ -0,0 +1,137 @@
#!/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$
#
#(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.
#
#Script:
#Funkitonssammlung zur Unterstuetzung der /etc/init.d/* scripten
#
#Letzte Änderung von: $Author: segler $
#Datum der letzten Änderung: $Date: 2007-02-23 00:48:05 +0000 (Fr, 23 Feb 2007) $
#Version der Datei: $Revision: 3713 $
#
#$Log$
#Revision 1.15 2007/02/23 00:48:05 segler
#nameif vor die Konfiguration gesetzt.
#es werden Konfigfiles /etc/mactab* der Reihe nach abgearbeitet.
#Dies hat den Vorteil, dass man ggf. in /etc/mactab.1 eth1 nach eth2 wegmoven und
#eth0 mit dem ursprünglichen eth1 neu setzen kann um in /etc/mactab.2 eth2
#nach eth1 moven.
#Die Konfigfiles haben die Form:
#eth0 XX:XX:XX:XX:XX:XX # ethernet
#eth1 XX:XX:XX:XX:XX:XX # wireless
#
#Revision 1.14 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#
#Revision 1.9 2002/07/07 09:18:09 hkueller
#Korrekturen in der Ablaufkontrolle (Routing Setup wird auf jedenfall durchlaufen - wichtig für das Zusammenspiel mit dhcp usw.)
#Funktionalität von /etc/sysconfig/net/notrouter mit implementiert
#
#Revision 1.8 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.7 2002/01/27 13:58:43 hkueller
#Debugging statement entfernt
#auswertung der /etc/sysconfig/net/gateways neu erstellt.
#Jetzt wird net/host/dev routing ermöglicht
#
#Revision 1.5 2001/11/17 23:41:36 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.4 2001/11/03 18:49:26 segler
#
#Bugfix: Abfrage auf existierende hostname.* fuer mehrere Interfaces erweitert
#
#Revision 1.3 2001/09/28 22:33:16 kueller
#Korrektur der abfrage auf existierende /etc/sysconfig/hostname.* dateien.
#
#Revision 1.2 2001/09/25 11:57:23 kueller
#Fehlermeldung bei nicht forhandener /etc/sysconfig/net/hostname.* bereinigt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Version: 0.01
# Version: 0.02 Möglichkeit der Einrichtung eines PTP Netzwerkes
# Version: 0.03 RIP Unterstütung wenn routed installiert ist
# Version: 0.04 Umstellung auf iproute Verwendung. Damit Bugfix
# der falsch gesetzten Broadcast adressen
#
source /etc/init.d/functions
#DEBUG=echo
case "$1" in
start)
for IF in `ls -d /sys/class/net/*[^lo]`; do
DEVNAME=`basename $IF`
/sbin/if_up $DEVNAME
done
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
;;
stop)
for IF in `ls -d /sys/class/net/*[^lo]`; do
DEVNAME=`basename $IF`
/sbin/if_down $DEVNAME
done
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

138
etc/init.d/install Normal file
View File

@ -0,0 +1,138 @@
#!/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$
#
#(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:
#install des systemvinit prozesses
#Abschluss des Installation Prozesses
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.13 2007/01/24 16:09:55 segler
#There is no /dev/cdroms/* without devfs any more...
#Hopefully some /dev/cdr* devices like /dev/cdrom or /dev/cdrw
#
#Revision 1.12 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.11 2003/04/19 08:05:46 kueller
#Soweit nicht vorhanden, erweiterung um restart option. Ansonsten anpassung
#an aktuellen Umfang von functions. reload und status funktioniert hier unter
#viitor nicht!
#
#Revision 1.10 2003/04/06 19:45:47 kueller
#FOUNDCD Variable muss natürlich vor continiue anweisung gesetzt werden.
#
#Revision 1.9 2003/04/06 19:43:58 kueller
#FOUNDCD Variable wird nun vor jedem notwendigen CDWechel richtig initialisiert.
#
#Revision 1.8 2003/04/06 18:19:59 kueller
#Korrectur der cdromabfragen. Korrektur der afterinstall routine
#
#Revision 1.7 2003/04/06 12:40:46 kueller
#Anpassung an neue Option "-d" des installpkg kommandos. Hier werden
#alle Postinstall scripten nicht ausgeführt, sondern nach
#/tmp/afterinstall/pkgname.postinstall kopiert.
#install führt diese Scripten nun nach fertigstellung des kopiervorgangs aus.
#
#Revision 1.6 2003/04/06 12:10:08 kueller
#Mehere CDROM Laufwerke werden nun erkannt. Wenn eine Passende CD in einem
#der vorhandenen CDROM Laufwerke liegt, wird diese Automatisch erkannt und
#verwendet
#
#Revision 1.5 2003/01/16 07:40:10 kueller
#Nach Abschluss der Installation wird die LD Configuration nun mittels
#ldconfig aktualisiert.
#
#Revision 1.4 2003/01/06 20:33:23 kueller
#Meldung "....press some key" in "...press ENTER" Geändert
#
#Revision 1.3 2002/10/04 08:00:34 kueller
#Routine Eingefügt, die Überprüft, ob die richtige CD Eingelegt wurde
#
#Revision 1.2 2002/06/12 10:38:07 hkueller
#Diverse Korrekturen ($ bei Variablennamen vergessen, falscher Dateidescriptor
#bei read (<$3 statt <&3) etc.
#
#Revision 1.1 2002/06/12 09:46:23 hkueller
#Post Install Script - sorgt dafür das Packete die in /var/install/pkg_to_do
#gelistet sind nach einem Reboot installiert werden. (Stage 2 des Monsum
#installation vorgangs)
#
#
source /etc/init.d/functions
case "$1" in
start)
if [ -f /var/install/pkg_to_do ]; then
exec 3</var/install/pkg_to_do
read <&3 INSTCD INSTPKG
AKTCD=""
while [ "$INSTCD" ]; do
if [ ! "$INSTCD" == "$AKTCD" ]; then
FOUNDCD=0
umount /mnt >/dev/null 2>&1
while [ ! -d /mnt/$INSTCD ]; do
for i in /dev/cdr*; do
mount -o ro $i /mnt >/dev/null 2>&1
if [ -d /mnt/$INSTCD ]; then
FOUNDCD=1
continue
else
FOUNDCD=0
umount /mnt >/dev/null 2>&1
fi
done
if [ "$FOUNDCD" == "0" ]; then
echo -n "CD not found - Please insert $INSTCD in any CDROM and press ENTER"
read
fi
done
AKTCD=$INSTCD
fi
installpkg -di /mnt/$INSTPKG
read <&3 INSTCD INSTPKG
done
exec 3>&-
rm /var/install/pkg_to_do
umount /mnt
if [ -d /tmp/afterinstall ]; then
for i in /tmp/afterinstall/*; do
source $i /
cd - >/dev/null
rm $i
done
rm -r /tmp/afterinstall
fi
ldconfig
fi
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

64
etc/init.d/loadkeys Normal file
View File

@ -0,0 +1,64 @@
#!/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$
#
#(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:
#loadkeys script des sysvinit Prozesses
#Basierend auf einer Vorlage von Linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.3 2006/07/18 21:04:31 kueller
#Unwillige scancodes koennen jetzt haendisch per /etc/sysconfig/kdb/setkeys
#dem kernel beigebracht werden.
#
#Revision 1.2 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/loadkeys
source /etc/init.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
fi
exec 3>&-
echo -n "Loading keymap..."
/usr/bin/loadkeys -d >/dev/null
evaluate_retval
# End /etc/init.d/loadkeys

104
etc/init.d/loadmodules Normal file
View File

@ -0,0 +1,104 @@
#!/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$
#
#(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:
# Dieses Script läd beim Systemstart manuell zu konfigurierende
# Kernel Module. Diese Module werden als Parameter des modprobe
# kommandos in die Datei /etc/sysconfig/loadmods eingetragen.
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.4 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
# Revision 1.1.1.1 2001/09/23 00:02:08 kueller
# Neustart wg. Datenverlust
#
# Revision 1.1.1.1 2001/08/08 10:02:32 kueller
# sysvinit addons
#
#
source /etc/init.d/functions
case "$1" in
start)
if [ -f /etc/sysconfig/loadmods ]; then
sed -e "/^#/d" /etc/sysconfig/loadmods |
sed -e "/^ *$/d" >/tmp/loadmods
exec 3</tmp/loadmods
read <&3 MODULE OPTIONS
while [ $MODULE ]; do
echo -n "Loading Module $MODULE with options: $OPTIONS"
if grep -q $MODULE /proc/modules; then
echo -n "Module $MODULE already loaded - removing it"
rmmod $MODULE
evaluate_retval
fi
modprobe -s $MODULE $OPTIONS
evaluate_retval
read <&3 MODULE OPTIONS
done
exec 3>&-
rm /tmp/loadmods
fi
;;
stop)
if [ -f /etc/sysconfig/loadmods ]; then
Z=0
while [ "$Z" "<" "9" ]; do
exec 3</proc/modules
read <&3 MODNAME INFO
while [ $MODNAME ]; do
echo -n "Try to unload $MODNAME"
rmmod -s $MODNAME 2>/dev/null
if [ "$?" == "0" ]; then
print_status success
else
if [ "$Z" == "8" ]; then
print_status failure
else
echo "failed"
fi
fi
read <&3 MODNAME INFO
done
(( Z = $Z + 1 ))
exec 3>&-
done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

78
etc/init.d/localnet Normal file
View File

@ -0,0 +1,78 @@
#!/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$
#
#(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:
#loaclnet script des sysvinit Prozesses
#Konfigurieren der localhost umgebung
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.3 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.2 2003/04/19 08:05:46 kueller
#Soweit nicht vorhanden, erweiterung um restart option. Ansonsten anpassung
#an aktuellen Umfang von functions. reload und status funktioniert hier unter
#viitor nicht!
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
source /etc/init.d/functions
case "$1" in
start)
echo -n "Bringing up the loopback interface..."
/sbin/ifconfig lo 127.0.0.1
evaluate_retval
if [ -f /etc/sysconfig/nodename ]; then
echo -n "Setting up hostname..."
/bin/hostname `cat /etc/sysconfig/nodename`
evaluate_retval
fi
;;
stop)
echo -n "Bringing down the loopback interface..."
/sbin/ifconfig lo down
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage $0: {start|stop|restart}"
exit 1
;;
esac
#End /etc/init.d/localnet

119
etc/init.d/maccfg Normal file
View File

@ -0,0 +1,119 @@
#!/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$
#
#(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.
#
#Script:
#Funkitonssammlung zur Unterstuetzung der /etc/init.d/* scripten
#
#Letzte Änderung von: $Author: segler $
#Datum der letzten Änderung: $Date: 2007-02-23 00:48:05 +0000 (Fr, 23 Feb 2007) $
#Version der Datei: $Revision: 3713 $
#
#$Log$
#Revision 1.15 2007/02/23 00:48:05 segler
#nameif vor die Konfiguration gesetzt.
#es werden Konfigfiles /etc/mactab* der Reihe nach abgearbeitet.
#Dies hat den Vorteil, dass man ggf. in /etc/mactab.1 eth1 nach eth2 wegmoven und
#eth0 mit dem ursprünglichen eth1 neu setzen kann um in /etc/mactab.2 eth2
#nach eth1 moven.
#Die Konfigfiles haben die Form:
#eth0 XX:XX:XX:XX:XX:XX # ethernet
#eth1 XX:XX:XX:XX:XX:XX # wireless
#
#Revision 1.14 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#
#Revision 1.9 2002/07/07 09:18:09 hkueller
#Korrekturen in der Ablaufkontrolle (Routing Setup wird auf jedenfall durchlaufen - wichtig für das Zusammenspiel mit dhcp usw.)
#Funktionalität von /etc/sysconfig/net/notrouter mit implementiert
#
#Revision 1.8 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.7 2002/01/27 13:58:43 hkueller
#Debugging statement entfernt
#auswertung der /etc/sysconfig/net/gateways neu erstellt.
#Jetzt wird net/host/dev routing ermöglicht
#
#Revision 1.5 2001/11/17 23:41:36 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.4 2001/11/03 18:49:26 segler
#
#Bugfix: Abfrage auf existierende hostname.* fuer mehrere Interfaces erweitert
#
#Revision 1.3 2001/09/28 22:33:16 kueller
#Korrektur der abfrage auf existierende /etc/sysconfig/hostname.* dateien.
#
#Revision 1.2 2001/09/25 11:57:23 kueller
#Fehlermeldung bei nicht forhandener /etc/sysconfig/net/hostname.* bereinigt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Version: 0.01
# Version: 0.02 Möglichkeit der Einrichtung eines PTP Netzwerkes
# Version: 0.03 RIP Unterstütung wenn routed installiert ist
# Version: 0.04 Umstellung auf iproute Verwendung. Damit Bugfix
# der falsch gesetzten Broadcast adressen
#
source /etc/init.d/functions
#DEBUG=echo
case "$1" in
start)
if ls /etc/mactab* >/dev/null 2>/dev/null ; then
for maccfg in /etc/mactab*; do
nameif -c $maccfg >/dev/null
done
fi
;;
stop)
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

108
etc/init.d/mountfs Normal file
View File

@ -0,0 +1,108 @@
#!/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$
#
#(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:
#mountfs Script des sysvinit Prozesses
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.8 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.7 2002/10/15 17:34:25 kueller
#Korrekturen beim Variablenhandling. Bei IF Abfragen sollten Variablen in
#Anfuehrungszeichen stehen
#
#Revision 1.6 2002/10/10 08:12:19 kueller
#Aktivierung der volumes in mountfs macht probleme beim fsck, zu
#zum Zeitpunkt des fsck laufes die Volumes noch nicht bekannt sind.
#Zum Aktivieren der Volumes ist mindestens das vonhandensein von /proc
#notwendig. Daher werden die "none" Filesysteme (tmpfs, procfs, ptsfs, usbfs)
#nun bereits in checkfs angemeldet. Ausserdem werden die Volumes vor dem
#start von fsck aktiviert. Dies sollte speziell probleme mit ext2 und ext3
#Filesystemen beheben.
#
#Revision 1.5 2002/09/22 14:54:41 hkueller
#Aktivierung des Swap Bereichs erfolgt nun nach der Aktivierung der Volumes.
#Damit darf auf eine Volume als Swap verwendung finden
#
#Revision 1.4 2002/01/21 16:52:06 kueller
#"None" Filesysteme wie tmpfs, procfs etc. werden in eigenem Schritt
#gemountet, bevor das Volumanagement initialisiert wird. Initialisierung
#des Volumemanagements findet nun komplett hier statt.
#Nach der Initialisierung des lvm werden die restlichen Volumes
#gemountet (ausser nfs)
#
#Revision 1.3 2002/01/21 14:34:43 kueller
#Korrektur der Pfade für VolumeManager - liegen nun unter /etc/sysconfig
#
#Revision 1.2 2001/11/04 01:39:17 kueller
#Zusatzfunktion, die in /etc/lvmtab gelistete VolumeGroups aktiviert
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.2 2001/08/13 15:30:56 kueller
#mount -a geändert. NFS Mounts dürfen erst nach der Netzwerk Initialisierung
#ausgeführt werden.
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/mountfs
source /etc/init.d/functions
echo -n "Remounting root file system in read-write mode..."
/bin/mount -n -o remount,rw /
evaluate_retval
echo > /etc/mtab
/bin/mount -f -o remount,rw /
/bin/rm -f /fastboot /forcefsck
echo -n "Activating swap ..."
/sbin/swapon -a
evaluate_retval
for i in `sed -e "/^#/d" /etc/fstab|awk '{print $2}'`; do
MOUNTPOINT=$i
FILESYSTEM=`awk '{if( $2 == "'$MOUNTPOINT'") print $3}' /etc/fstab`
DEVICE=`awk '{if( $2 == "'$MOUNTPOINT'") print $1}' /etc/fstab`
if [ ! "$FILESYSTEM" == "nfs" ] \
&& [ ! "$FILESYSTEM" == "swap" ] \
&& [ ! "$MOUNTPOINT" == "/" ] \
&& [ ! "$DEVICE" == "none" ]; then
echo -n "Mounting $MOUNTPOINT"
mount $MOUNTPOINT
evaluate_retval
fi
done
# End /etc/init.d/mountfs

214
etc/init.d/networks Normal file
View File

@ -0,0 +1,214 @@
#!/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$
#
#(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.
#
#Script:
#Funkitonssammlung zur Unterstuetzung der /etc/init.d/* scripten
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.15 2007/02/23 00:48:05 segler
#nameif vor die Konfiguration gesetzt.
#es werden Konfigfiles /etc/mactab* der Reihe nach abgearbeitet.
#Dies hat den Vorteil, dass man ggf. in /etc/mactab.1 eth1 nach eth2 wegmoven und
#eth0 mit dem ursprünglichen eth1 neu setzen kann um in /etc/mactab.2 eth2
#nach eth1 moven.
#Die Konfigfiles haben die Form:
#eth0 XX:XX:XX:XX:XX:XX # ethernet
#eth1 XX:XX:XX:XX:XX:XX # wireless
#
#Revision 1.14 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#
#Revision 1.9 2002/07/07 09:18:09 hkueller
#Korrekturen in der Ablaufkontrolle (Routing Setup wird auf jedenfall durchlaufen - wichtig für das Zusammenspiel mit dhcp usw.)
#Funktionalität von /etc/sysconfig/net/notrouter mit implementiert
#
#Revision 1.8 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.7 2002/01/27 13:58:43 hkueller
#Debugging statement entfernt
#auswertung der /etc/sysconfig/net/gateways neu erstellt.
#Jetzt wird net/host/dev routing ermöglicht
#
#Revision 1.5 2001/11/17 23:41:36 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.4 2001/11/03 18:49:26 segler
#
#Bugfix: Abfrage auf existierende hostname.* fuer mehrere Interfaces erweitert
#
#Revision 1.3 2001/09/28 22:33:16 kueller
#Korrektur der abfrage auf existierende /etc/sysconfig/hostname.* dateien.
#
#Revision 1.2 2001/09/25 11:57:23 kueller
#Fehlermeldung bei nicht forhandener /etc/sysconfig/net/hostname.* bereinigt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Version: 0.01
# Version: 0.02 Möglichkeit der Einrichtung eines PTP Netzwerkes
# Version: 0.03 RIP Unterstütung wenn routed installiert ist
# Version: 0.04 Umstellung auf iproute Verwendung. Damit Bugfix
# der falsch gesetzten Broadcast adressen
#
source /etc/init.d/functions
#DEBUG=echo
if ls /etc/sysconfig/net/hostname.* >/dev/null 2>&1; then
DEVNUM=`ls /etc/sysconfig/net/hostname.* 2>/dev/null|wc -w`
else
DEVNUM=0
fi
case "$1" in
start)
if ls /etc/mactab* >/dev/null 2>/dev/null ; then
for maccfg in /etc/mactab*; do
nameif -c $maccfg >/dev/null
done
fi
if [ "$DEVNUM" != 0 ]; then
for i in `ls /etc/sysconfig/net/hostname.*|cut -d "." -f2`; do
HOST=`cat /etc/sysconfig/net/hostname.$i|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
done
fi
if [ ! -f /etc/sysconfig/net/notrouter ]; then
echo "Configuring System with routing allowed"
if [ -f /etc/sysconfig/net/gateways ]; then
sed -e "/^#/d" /etc/sysconfig/net/gateways | \
sed -e "/^ *$/d" >/tmp/gateways
exec 3</tmp/gateways
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
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
fi
read <&3 TYPE NETWORK OPTION GW NETMASK
done
exec 3>&-
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
fi
NUMIF=`ip -f inet addr show|grep inet|wc -l`
if [ $NUMIF -gt 2 ]; then
echo -n "Enable ip_forwarding"
echo "1" >/proc/sys/net/ipv4/ip_forward
evaluate_retval
fi
if [ -f /usr/sbin/routed ]; then
if [ $NUMIF -gt 2 ]; then
echo -n "Starte Routing Information Protokoll Server"
$DEBUG /usr/sbin/routed -s -g &
evaluate_retval
else
echo -n "Starte Routing Information Protokoll Client"
$DEBUG /usr/sbin/routed -q &
evaluate_retval
fi
fi
else
if [ -f /usr/sbin/routed ]; then
echo -n "Starte RIP Client im silent mode"
$DEBUG /usr/sbin/routed -q &
evaluate_retval
fi
fi
;;
stop)
NUMIF=`ip -f inet addr show|grep inet|wc -l`
if [ -f /usr/sbin/routed ]; then
echo -n "Stopping Routing Information Protokoll"
killproc routed
fi
if [ $DEVNUM != 0 ]; then
for i in `ls /etc/sysconfig/net/hostname.*|cut -d "." -f2`; do
echo -n "shutting down interface $i"
#ifconfig $i down
HOST=`cat /etc/sysconfig/net/hostname.$i|awk '{print $1}'`
IP=`grep $HOST /etc/hosts|awk '{print $1}'`
echo -n " Address $IP"
DEV=`echo $i|cut -d ":" -f 1`
ip addr del $IP dev $DEV
evaluate_retval
done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

157
etc/init.d/rc Normal file
View File

@ -0,0 +1,157 @@
#!/bin/sh
# Begin /etc/init.d/rc
#
# By Jason Pearce - jason.pearce@linux.org
# Modified by Gerard Beekmans - gerard@linuxfromscratch.org
# print_error_msg based on ideas by Simon Perreault - nomis80@yahoo.com
#
#$Date$
#$Revision$
#
#$Log$
#Revision 1.3 2003/10/22 18:35:29 kueller
#Korrektur von rechtschreibfehlern
#
#Revision 1.2 2003/04/07 10:22:30 kueller
#Fehlermeldungen an CompuExtreme, nicht mehr an RainMaker
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
source /etc/init.d/functions
print_error_msg()
{
echo
$FAILURE
echo "Sie sollten diese Fehlermeldung niemals sehen"
echo "Sie bedeutet, das ein unvorhergesehener Fehler"
echo "Aufgetreten ist."
echo "Das Subscript $i ist hat sich mit dem Returnwert"
echo "$error_value beendet."
echo "Bitte melden sie den Fehler der Fa. CompuExtreme"
$NORMAL
echo
}
# Un-comment the following for debugging.
# debug=echo
#
# Start script or program.
#
startup() {
case "$1" in
*.sh)
$debug sh "$@"
;;
*)
$debug "$@"
;;
esac
}
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP
# Set onlcr to avoid staircase effect.
stty onlcr 0>&1
# Now find out what the current and what the previous runlevel are.
runlevel=$RUNLEVEL
# Get first argument. Set new runlevel to this argument.
[ "$1" != "" ] && runlevel=$1
if [ "$runlevel" = "" ]
then
echo "Usage: $0 <runlevel>" >&2
exit 1
fi
previous=$PREVLEVEL
[ "$previous" = "" ] && previous=N
export runlevel previous
# Is there an rc directory for this new runlevel?
if [ -d /etc/init.d/rc$runlevel.d ]
then
# First, run the KILL scripts for this runlevel.
if [ $previous != N ]
then
for i in /etc/init.d/rc$runlevel.d/K*
do
[ ! -f $i ] && continue
suffix=${i#/etc/init.d/rc$runlevel.d/K[0-9][0-9]}
previous_start=/etc/init.d/rc$previous.d/S[0-9][0-9]$suffix
sysinit_start=/etc/init.d/rcS.d/S[0-9][0-9]$suffix
# Stop the service if there is a start script
# in the previous run level.
[ ! -f $previous_start ] &&
[ ! -f $sysinit_start ] && continue
startup $i stop
error_value=$?
if [ $error_value != 0 ]
then
print_error_msg
fi
done
fi
# Now run the START scripts for this runlevel.
for i in /etc/init.d/rc$runlevel.d/S*
do
[ ! -f $i ] && continue
if [ $previous != N ]
then
# Find start script in previous runlevel and
# stop script in this runlevel.
suffix=${i#/etc/init.d/rc$runlevel.d/S[0-9][0-9]}
stop=/etc/init.d/rc$runlevel.d/K[0-9][0-9]$suffix
previous_start=/etc/init.d/rc$previous.d/S[0-9][0-9]$suffix
# If there is a start script in the previous
# level
# and _no_ stop script in this level, we don't
# have to re-start the service.
[ -f $previous_start ] && [ ! -f $stop ] &&
continue
fi
case "$runlevel" in
0|6)
startup $i stop
error_value=$?
if [ $error_value != 0 ]
then
print_error_msg
fi
;;
*)
startup $i start
error_value=$?
if [ $error_value != 0 ]
then
print_error_msg
fi
;;
esac
done
fi
# End /etc/init.d/rc

99
etc/init.d/rcS Normal file
View File

@ -0,0 +1,99 @@
#!/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$
#
#(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:
#rcS Script des sysvinit Projektes
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
# Begin /etc/init.d/rcS
runlevel=S
prevlevel=N
umask 022
export runlevel prevlevel
trap ":" INT QUIT TSTP
source /etc/init.d/functions
mount -t proc none /proc
if mount|grep /dev/root|grep nfs &>/dev/null; then
echo -n "Mounting tmpfs on /var"
mount -t tmpfs none /var
evaluate_retval
echo -n "Getting Hostname ..."
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"
cd /var
tar -zxf /boot/var_${HOSTNAME}.tgz
echo $HOSTNAME >etc/sysconfig/nodename
cd -
evaluate_retval
else
mount -t tmpfs none /var/lock
fi
umount /proc
if [ -f /sbin/udevd ]; then
echo -n "Mounting /sys"
mount -t sysfs none /sys
evaluate_retval
if [ ! -d /var/lock/subsys ]; then
mkdir /var/lock/subsys
fi
if [ ! -d /dev ]; then
mkdir /dev
fi
fi
for i in /etc/init.d/rcS.d/S??*
do
[ ! -f "$i" ] && continue;
$i start
done
# End /etc/init.d/rcS

50
etc/init.d/reboot Normal file
View File

@ -0,0 +1,50 @@
#!/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$
#
#(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:
#reboot script des sysvinit Prozesses
#basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.2 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/reboot
echo "System reboot in progress..."
/sbin/reboot -d -f -i
# End /etc/init.d/reboot

143
etc/init.d/routed Normal file
View File

@ -0,0 +1,143 @@
#!/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$
#
#(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.
#
#Script:
#Funkitonssammlung zur Unterstuetzung der /etc/init.d/* scripten
#
#Letzte Änderung von: $Author: segler $
#Datum der letzten Änderung: $Date: 2007-02-23 00:48:05 +0000 (Fr, 23 Feb 2007) $
#Version der Datei: $Revision: 3713 $
#
#$Log$
#Revision 1.15 2007/02/23 00:48:05 segler
#nameif vor die Konfiguration gesetzt.
#es werden Konfigfiles /etc/mactab* der Reihe nach abgearbeitet.
#Dies hat den Vorteil, dass man ggf. in /etc/mactab.1 eth1 nach eth2 wegmoven und
#eth0 mit dem ursprünglichen eth1 neu setzen kann um in /etc/mactab.2 eth2
#nach eth1 moven.
#Die Konfigfiles haben die Form:
#eth0 XX:XX:XX:XX:XX:XX # ethernet
#eth1 XX:XX:XX:XX:XX:XX # wireless
#
#Revision 1.14 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#
#Revision 1.9 2002/07/07 09:18:09 hkueller
#Korrekturen in der Ablaufkontrolle (Routing Setup wird auf jedenfall durchlaufen - wichtig für das Zusammenspiel mit dhcp usw.)
#Funktionalität von /etc/sysconfig/net/notrouter mit implementiert
#
#Revision 1.8 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.7 2002/01/27 13:58:43 hkueller
#Debugging statement entfernt
#auswertung der /etc/sysconfig/net/gateways neu erstellt.
#Jetzt wird net/host/dev routing ermöglicht
#
#Revision 1.5 2001/11/17 23:41:36 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.4 2001/11/03 18:49:26 segler
#
#Bugfix: Abfrage auf existierende hostname.* fuer mehrere Interfaces erweitert
#
#Revision 1.3 2001/09/28 22:33:16 kueller
#Korrektur der abfrage auf existierende /etc/sysconfig/hostname.* dateien.
#
#Revision 1.2 2001/09/25 11:57:23 kueller
#Fehlermeldung bei nicht forhandener /etc/sysconfig/net/hostname.* bereinigt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Version: 0.01
# Version: 0.02 Möglichkeit der Einrichtung eines PTP Netzwerkes
# Version: 0.03 RIP Unterstütung wenn routed installiert ist
# Version: 0.04 Umstellung auf iproute Verwendung. Damit Bugfix
# der falsch gesetzten Broadcast adressen
#
source /etc/init.d/functions
#DEBUG=echo
case "$1" in
start)
if [ ! -f /etc/sysconfig/net/notrouter ]; then
NUMIF=`ip -f inet addr show|grep inet|wc -l`
if [ $NUMIF -gt 2 ]; then
echo -n "Enable ip_forwarding"
echo "1" >/proc/sys/net/ipv4/ip_forward
evaluate_retval
fi
if [ -f /usr/sbin/routed ]; then
if [ $NUMIF -gt 2 ]; then
echo -n "Starte Routing Information Protokoll Server"
$DEBUG /usr/sbin/routed -s -g &
evaluate_retval
else
echo -n "Starte Routing Information Protokoll Client"
$DEBUG /usr/sbin/routed -q &
evaluate_retval
fi
fi
else
if [ -f /usr/sbin/routed ]; then
echo -n "Starte RIP Client im silent mode"
$DEBUG /usr/sbin/routed -q &
evaluate_retval
fi
fi
;;
stop)
if [ -f /usr/sbin/routed ]; then
echo -n "Stopping Routing Information Protokoll"
killproc routed
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

155
etc/init.d/routing Normal file
View File

@ -0,0 +1,155 @@
#!/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$
#
#(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.
#
#Script:
#Funkitonssammlung zur Unterstuetzung der /etc/init.d/* scripten
#
#Letzte Änderung von: $Author: segler $
#Datum der letzten Änderung: $Date: 2007-02-23 00:48:05 +0000 (Fr, 23 Feb 2007) $
#Version der Datei: $Revision: 3713 $
#
#$Log$
#Revision 1.15 2007/02/23 00:48:05 segler
#nameif vor die Konfiguration gesetzt.
#es werden Konfigfiles /etc/mactab* der Reihe nach abgearbeitet.
#Dies hat den Vorteil, dass man ggf. in /etc/mactab.1 eth1 nach eth2 wegmoven und
#eth0 mit dem ursprünglichen eth1 neu setzen kann um in /etc/mactab.2 eth2
#nach eth1 moven.
#Die Konfigfiles haben die Form:
#eth0 XX:XX:XX:XX:XX:XX # ethernet
#eth1 XX:XX:XX:XX:XX:XX # wireless
#
#Revision 1.14 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#
#Revision 1.9 2002/07/07 09:18:09 hkueller
#Korrekturen in der Ablaufkontrolle (Routing Setup wird auf jedenfall durchlaufen - wichtig für das Zusammenspiel mit dhcp usw.)
#Funktionalität von /etc/sysconfig/net/notrouter mit implementiert
#
#Revision 1.8 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.7 2002/01/27 13:58:43 hkueller
#Debugging statement entfernt
#auswertung der /etc/sysconfig/net/gateways neu erstellt.
#Jetzt wird net/host/dev routing ermöglicht
#
#Revision 1.5 2001/11/17 23:41:36 kueller
#Network Setup erweitert. Netmasks werden jetzt aus /etc/netmasks erkannt.
#Konfiguration der Netmask in /etc/sysconfig/hostname.<if> nicht mehr
#notwendig!
#Korrekturen bei der netzmask erkennung unter zsh
#
#Revision 1.4 2001/11/03 18:49:26 segler
#
#Bugfix: Abfrage auf existierende hostname.* fuer mehrere Interfaces erweitert
#
#Revision 1.3 2001/09/28 22:33:16 kueller
#Korrektur der abfrage auf existierende /etc/sysconfig/hostname.* dateien.
#
#Revision 1.2 2001/09/25 11:57:23 kueller
#Fehlermeldung bei nicht forhandener /etc/sysconfig/net/hostname.* bereinigt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Version: 0.01
# Version: 0.02 Möglichkeit der Einrichtung eines PTP Netzwerkes
# Version: 0.03 RIP Unterstütung wenn routed installiert ist
# Version: 0.04 Umstellung auf iproute Verwendung. Damit Bugfix
# der falsch gesetzten Broadcast adressen
#
source /etc/init.d/functions
#DEBUG=echo
if ls /etc/sysconfig/net/hostname.* >/dev/null 2>&1; then
DEVNUM=`ls /etc/sysconfig/net/hostname.* 2>/dev/null|wc -w`
else
DEVNUM=0
fi
case "$1" in
start)
if [ ! -f /etc/sysconfig/net/notrouter ]; then
echo "Configuring System with routing allowed"
if [ -f /etc/sysconfig/net/gateways ]; then
sed -e "/^#/d" /etc/sysconfig/net/gateways | \
sed -e "/^ *$/d" >/tmp/gateways
exec 3</tmp/gateways
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
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
fi
read <&3 TYPE NETWORK OPTION GW NETMASK
done
exec 3>&-
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
fi
NUMIF=`ip -f inet addr show|grep inet|wc -l`
if [ $NUMIF -gt 2 ]; then
echo -n "Enable ip_forwarding"
echo "1" >/proc/sys/net/ipv4/ip_forward
evaluate_retval
fi
fi
;;
stop)
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
#end /etc/inet.d/network

55
etc/init.d/sendsignals Normal file
View File

@ -0,0 +1,55 @@
#!/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$
#
#(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:
#sendsignals script des sysvinit prozesses
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.2 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
source /etc/init.d/functions
echo -n "Sending all processes the TERM signal..."
/sbin/killall5 -15
evaluate_retval
echo -n "Sending all processes the KILL signal..."
/sbin/killall5 -9
evaluate_retval
# End /etc/init.d/sendsignals

72
etc/init.d/setclock Normal file
View File

@ -0,0 +1,72 @@
#!/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$
#
#(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:
#setclock script des sysvinit prozesses
#basierend auf einer vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.2 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.4 2001/09/01 19:13:06 kueller
#
#Fehler beim Setzen der Zeitzone - zic kann /etc/localtime nicht anlegen.
#Localtime wird nun über CVS Monsum_config eingespielt, und darüber die timezone
#eingestellt
#
#Revision 1.3 2001/08/24 22:25:43 kueller
#
#Zeitzone wird jetzt richtig gesetzt, wenn die Datei /etc/timezone entweder
#als link auf die Entsprechzende Zonendatei in /usr/share/zoneinfo oder als
#ASCII Datei mit der UNIX Typischen ZeitZonen angabe existiert
#
#Revision 1.2 2001/08/09 13:09:06 cvs
#
#sourcen der Datei /etc/sysconfig/clock nicht notwendig - bringt keine Vorteile
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
source /etc/init.d/functions
CLOCKPARAMS="--hctosys"
case "$UTC" in
yes|true|1)
CLOCKPARAMS="$CLOCKPARAMS -u"
;;
esac
echo -n "Setting clock..."
/sbin/hwclock $CLOCKPARAMS
evaluate_retval

57
etc/init.d/sysklogd Normal file
View File

@ -0,0 +1,57 @@
#!/bin/sh
#sysklogd script des sysvinit prozesses
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#$Author$
#$Date$
#$Revision$
#
#$Log$
#Revision 1.3 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#Revision 1.2 2003/04/19 08:05:46 kueller
#Soweit nicht vorhanden, erweiterung um restart option. Ansonsten anpassung
#an aktuellen Umfang von functions. reload und status funktioniert hier unter
#viitor nicht!
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
source /etc/init.d/functions
case "$1" in
start)
echo -n "Starting system log daemon..."
loadproc /usr/sbin/syslogd -m 0
echo -n "Starting kernel log daemon..."
loadproc /usr/sbin/klogd -f /var/log/kern.log
;;
stop)
echo -n "Stopping kernel log daemon..."
killproc klogd
echo -n "Stopping system log daemon..."
killproc syslogd
;;
restart)
$0 stop
/usr/bin/sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
# End /etc/init.d/sysklogd

62
etc/init.d/umountfs Normal file
View File

@ -0,0 +1,62 @@
#!/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$
#
#(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:
#umountfs script des sysvinit prozesses
#Basierend auf einer Vorlage von linuxfromscratch.org
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.3 2004/03/03 12:48:08 kueller
#Header auf neuen Viitor GPL Header umgestellt
#
#
#Revision 1.2 2001/09/24 13:31:00 kueller
#/dev wird nun explizit umounted
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
# Begin /etc/init.d/umountfs
source /etc/init.d/functions
echo -n "Deactivating swap..."
/sbin/swapoff -a
evaluate_retval
echo -n "Umounting devfs..."
/bin/umount -f /dev
echo -n "Unmounting file systems..."
/bin/umount -a -r
evaluate_retval
# End /etc/init.d/umountfs

104
etc/inittab Normal file
View File

@ -0,0 +1,104 @@
#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$
#
#(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.
#
#/etc/inittab - Steruerung des sysvinit Prozesses
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.3 2006/07/07 20:34:55 kueller
#dank umstellung von devfs auf udev muessen wieder die alten devicenamen
#verwendet werden!
#
#Revision 1.2 2004/03/03 11:49:39 kueller
#Aktualisierung des Headers - mit einbau der GPL Informationen
#
#
#(c) Harald Küller, CompuExtreme
#
#$Author$
#$Date$
#$Revision$
#
#$Log$
#Revision 1.3 2006/07/07 20:34:55 kueller
#dank umstellung von devfs auf udev muessen wieder die alten devicenamen
#verwendet werden!
#
#Revision 1.2 2004/03/03 11:49:39 kueller
#Aktualisierung des Headers - mit einbau der GPL Informationen
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#Revision 1.5 2001/09/06 10:22:57 kueller
#
#Login Terminal an devfs angepasst - Terminal namen von tty# auf vc/# geändert
#
#Revision 1.4 2001/08/25 13:15:01 kueller
#
#Fehler in den Basis Runleveln - Runlevel 2 Fehlte, rest um 1 Runlevel verrutscht
#
#Revision 1.3 2001/08/24 15:29:02 kueller
#
#Änderung mit aufeinanderfolgenden Runleveln (sprich rc2 führt auch rc1 und
#zusätzlich rc2 aus) funktioniert nicht. Vorläufiger switchback zum Linux
#Üblichen Verhalten.
#
#Revision 1.2 2001/08/11 00:08:02 cvs
#
#Runlevel Verhalten korrigiert. Runlevel verhalten sich jetzt ähnlich wie
#unter solaris - nur noch etwas konsequenter..:-))
#rc S - wird nur in Runlevel S aufgerufen
#rc 0 - wird nur in Runlevel 0 aufgerufen (shutdown, halt)
#rc 1 - wird in Runlevel S,1,2,3,4,5 aufgerufen
#rc 2 - wird in Runlevel 2,3,4,5 aufgerufen
#rc 3 - wird in Runlevel 3,4,5 aufgerufen
#rc 4 - wird in Runlevel 4,5 aufgerufen
#rc 5 - wird in Runlevel 5 aufgerufen
#rc 6 - wird nur in Runlevel 6 aufgerufen (Shutdown, reboot)
#
#Revision 1.1.1.1 2001/08/08 10:02:32 kueller
#sysvinit addons
#
#
id:3:initdefault:
si::sysinit:/etc/init.d/rcS
l0:0:wait:/etc/init.d/rc 0
l1:S1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
f1:0:respawn:/sbin/sulogin
f2:6:respawn:/sbin/sulogin
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S1:respawn:/sbin/sulogin
1:2345:respawn:/sbin/agetty /dev/tty1 9600
2:2345:respawn:/sbin/agetty /dev/tty2 9600
3:2345:respawn:/sbin/agetty /dev/tty3 9600
4:2345:respawn:/sbin/agetty /dev/tty4 9600
5:2345:respawn:/sbin/agetty /dev/tty5 9600
6:2345:respawn:/sbin/agetty /dev/tty6 9600
# End /etc/inittab

101
init/genpkg Normal file
View File

@ -0,0 +1,101 @@
#!/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$
#
#(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.
#
#Script:
#cvs module init script zur initialisierung
#der /etc/init.d scripten
#des Viitor_sysvinit archives.
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log$
#Revision 1.5 2004/03/03 12:53:40 kueller
#Umstellung auf Viitor GPL Header
#
#
#$Log$
#Revision 1.5 2004/03/03 12:53:40 kueller
#Umstellung auf Viitor GPL Header
#
#Revision 1.4 2002/06/12 09:55:41 hkueller
#Eintrag für das install script hinzugefügt
#
#Revision 1.3 2001/10/16 22:01:47 kueller
#Init Scripten werden nun mit den passenden Berechtigungen versehen
#
#Revision 1.2 2001/09/28 22:04:46 kueller
#/etc/sysconfig/net wird nun explizit angelegt
#
#Revision 1.1.1.1 2001/09/23 00:02:08 kueller
#Neustart wg. Datenverlust
#
#
WDIR=`pwd`
mkdir -p etc/sysconfig/net
cd etc/init.d
for i in *; do
if [ -f $i ]; then
chmod 755 $i
fi
done
mkdir rc{S,0,1,2,3,4,5,6}.d
cd rcS.d
ln -s ../checkfs S10checkfs
ln -s ../mountfs S15mountfs
ln -s ../setclock S20setclock
ln -s ../loadkeys S25loadkeys
cd ..
for i in 0 6; do
cd rc$i.d
ln -s ../dbus K74dbus
ln -s ../ifup K80ifup
ln -s ../sendsignals K80sendsignals
ln -s ../loadmodules K87loadmodules
ln -s ../sysklogd K90sysklogd
ln -s ../umountfs K90umountfs
cd ..
done
cd rc0.d
ln -s ../halt S99halt
cd ..
cd rc6.d
ln -s ../reboot S99reboot
cd ..
for i in 1 2 3 4 5; do
cd rc$i.d
ln -s ../sysklogd S03sysklogd
ln -s ../loadmodules S05loadmodules
ln -s ../localnet S09localnet
ln -s ../ifup S10ifup
ln -s ../routing S11routing
ln -s ../install S11install
ln -s ../dbus S12dbus
cd ..
done
ln -s ../init.d init.d
cd $WDIR

95
sbin/if_down Executable file
View File

@ -0,0 +1,95 @@
#!/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: /Data/cvs/ViitorMake/templates/Script.template,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.
#
#Script:if_up
#
#Letzte Änderung von: $Author: $
#Datum der letzten Änderung: $Date: $
#Version der Datei: $Revision: $
#
#$Log: $
#
source /etc/init.d/functions
DEV=$1
if [ ! "$DEV" ]; then
echo "Usage: $0 <NetworkInterfaceName>"
exit 10
fi
if pgrep vtun >/dev/null; then
/etc/init.d/vtund stop
fi
if [ -f /etc/sysconfig/net/${DEV}.dhcp ]; then
echo -n "Stopping dhclient for $DEV"
DHPID=`ps -ef|grep dhclient|grep ${DEV}|awk '{print $2}'`
if [ "$DHPID" ]; then
kill $DHPID
fi
evaluate_retval
echo -n "Shutting down Interface $DEV"
ifconfig $DEV 0.0.0.0 down
evaluate_retval
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 "shutting down interface $i:IP=$IP NMASK=$NETMASK"
if [ "$NETMASK" = "" ]; then
DEV=`echo $i|cut -d ":" -f 1`
$DEBUG ip addr del $IP broadcast + dev $DEV
$DEBUG ip link set $DEV down
else
DEV=`echo $i|cut -d ":" -f 1`
$DEBUG ip addr del $IP/$SHMASK broadcast + dev $DEV
$DEBUG ip link set $DEV down
fi
evaluate_retval
fi
if [ -f /var/run/shutdown/wlan_nis ]; then
if [ -f /etc/sysconfig/nis/defaultdomain.wlan ]; then
echo -n "Restoring nis defaultdomain"
mv /etc/sysconfig/nis/defaultdomain.wlan \
/etc/sysconfig/nis/defaultdomain
evaluate_retval
fi
if [ -f /etc/yp.conf.wlan ]; then
echo -n "Restoring nis yp.conf"
mv /etc/yp.conf.wlan \
/etc/yp.conf
evaluate_retval
fi
rm /var/run/shutdown/wlan_nis
if [ -f /var/run/shutdown/wlan_dns ]; then
if [ -f /etc/resolv.conf.wlan ]; then
echo -n "Restoring resolv.conf"
mv /etc/resolv.conf.wlan /etc/resolv.conf
evaluate_retval
fi
rm /var/run/shutdown/wlan_dns
fi
fi
if pgrep wpa_supplicant >/dev/null; then
echo -n "Stopping wpa_supplicant"
pkill wpa_supplicant
evaluate_retval
fi

125
sbin/if_up Executable file
View File

@ -0,0 +1,125 @@
#!/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: /Data/cvs/ViitorMake/templates/Script.template,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.
#
#Script:if_up
#
#Letzte Änderung von: $Author: $
#Datum der letzten Änderung: $Date: $
#Version der Datei: $Revision: $
#
#$Log: $
#
source /etc/init.d/functions
DEV=$1
CheckForLink() {
NETDEVICE=$1
if [ -f /usr/sbin/ethtool ]; then
#Einige Dumme Interfaces (z.B. die VMware Emulationen) Zeiten
#den korrekten Status erst nach einem ifconfig up
WAITTIME=7
ZAHLER=0
if ! ethtool $NETDEVICE|grep -q "No data available"; then
while [ ${ZAHLER} -le ${WAITTIME} ]; do
if [ ! `ethtool $NETDEVICE|grep Link|awk '{print $3}'` == "yes" ]; then
(( ZAHLER++ ))
else
break
fi
sleep 1
done
if [ `ethtool $NETDEVICE|grep Link|awk '{print $3}'` == "yes" ]; then
touch /var/run/net_up
return 0
else
return 1
fi
else
touch /var/run/net_up
return 0
fi
else
touch /var/run/net_up
return 0
fi
}
if [ ! "$DEV" ]; then
echo "Usage: $0 <NetworkInterfaceName>"
exit 10
fi
#Check for files in /etc/sysconfig/net
#hostname.<if> will setup static ip for the interfaces, based
#on /etc/hosts (hostname) and /etc/networks (netmask/Broadcast)
#<if>.dhcp will do a dynamic setup for the interface with dhcp
if [ -f /etc/sysconfig/net/${DEV}.dhcp ]; then
#ok this is the dynamic part for setup ${DEV}
#first we have to startup interface to check interface type
ifconfig ${DEV} up
#Let check in /sys if the interface is a wireless interface
if [ -d /sys/class/net/${DEV}/wireless ]; then
#wireless interface need special setup..
/sbin/wlan_setup ${DEV}
#give wlan time to startup and create a link
sleep 1
fi
#let check if there is a link on the interface.
#only if there is a link, we will setup the interface..
if CheckForLink ${DEV}; then
echo -n "Setting up ${DEV} with dhcp"
dhclient -q ${DEV}
evaluate_retval
else
ifconfig ${DEV} down
fi
elif ls /etc/sysconfig/net/hostname.${DEV}* &>/dev/null; then
ifconfig ${DEV} up
if [ -d /sys/class/net/${DEV}/wireless ]; then
/sbin/wlan_setup ${DEV}
#give wlan time to startup and create a link
sleep 1
fi
if CheckForLink ${DEV}; 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
else
ifconfig ${DEV} down
fi
fi

159
sbin/wlan_setup Executable file
View File

@ -0,0 +1,159 @@
#!/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_wireless/etc/init.d/wireless,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.
#
#Script:wlan_setup
#Setup eines WLAN Interfaces per accesspoint config files in
#/etc/sysconfig/wlan/<apname>
#
#Letzte Änderung von: $Author$
#Datum der letzten Änderung: $Date$
#Version der Datei: $Revision$
#
#$Log: wireless,v $
#Revision 1.1.1.1 2004/12/05 13:10:59 kueller
#New Package wireless
#
#
source /etc/init.d/functions
if [ ! -f /var/state/ldap_disable ]; then
touch /var/state/ldap_disable
fi
if [ ! -d /var/run/shutdown ]; then
mkdir -p /var/run/shutdown
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
fi
for AP in `iwlist $DEV scan 2>/dev/null|\
grep ESSID|\
cut -d":" -f 2-`; do
AP=`echo $AP|sed -e "s/\"//g"`
if [ -f /etc/sysconfig/wlan/$AP ]; then
echo -n "Binding Wireless Network to AP $AP"
$DEBUG iwconfig $DEV essid $AP
evaluate_retval
sed -e "/^#/d" /etc/sysconfig/wlan/$AP | \
sed -e "/^ *$/d" >/tmp/AP
exec 3</tmp/AP
read <&3 OPTION ARG1 ARG2
while [ $OPTION ]; do
case $OPTION in
WPA2|WPA)
wpa_supplicant -i ${DEV} -D ${ARG1} -c /etc/sysconfig/wpa_supplicant/${AP} -B
;;
KEY)
echo -n "Configuring Wireless Interface KEY"
$DEBUG iwconfig $DEV key $ARG1 $ARG2
;;
TXPOWER)
echo -n "Configuring txpower to $ARG1"
$DEBUG iwconfig $DEV txpower $ARG1
;;
YP)
if [ -f /var/run/shutdown/wlan_nis ]; then
echo "No Clean Shutdown, cleaning up"
if [ -f /etc/sysconfig/nis/defaultdomain.wlan ]; then
mv /etc/sysconfig/nis/defaultdomain.wlan \
/etc/sysconfig/nis/defaultdomain
elif [ -f /etc/sysconfig/nis/defaultdomain ]; then
rm /etc/sysconfig/nis/defaultdomain
fi
if [ -f /etc/yp.conf.wlan ]; then
mv /etc/yp.conf.wlan /etc/yp.conf
elif [ -f /etc/yp.conf ]; then
rm /etc/yp.conf
fi
fi
touch /var/run/shutdown/wlan_nis
if [ "$ARG1" ]; then
if [ -f /etc/sysconfig/nis/defaultdomain ]; then
mv /etc/sysconfig/nis/defaultdomain{,.wlan}
fi
echo "$ARG1" >/etc/sysconfig/nis/defaultdomain
fi
if [ "$ARG2" ]; then
if [ -f /etc/yp.conf ]; then
mv /etc/yp.conf{,.wlan}
fi
echo "domain $ARG1 server $ARG2" >/etc/yp.conf
fi
NISSTR="nis"
;;
LDAP)
export USE_LDAP=1
LDAPSTR="ldap"
rm /var/state/ldap_disable
;;
DNS)
if [ -f /var/run/shutdown/wlan_dns ]; then
echo "No Clean Shutdown, cleaning up"
if [ -f /etc/resolv.conf.wlan ]; then
mv /etc/resolv.conf.wlan /etc/resolv.conf
fi
fi
touch /var/run/shutdown/wlan_dns
if [ -f /etc/resolv.conf ]; then
mv /etc/resolv.conf{,.wlan}
fi
echo "#Resolv.conf generatet by wlan_setup" >/etc/resolv.conf
echo "nameserver $ARG1" >>/etc/resolv.conf
;;
VTUN)
echo "Starting vtun client"
/etc/init.d/vtund start
;;
esac
read <&3 OPTION ARG1 ARG2
done
exec 3>&-
ifconfig $DEV down
ifconfig $DEV up
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