Compare commits
No commits in common. "v961" and "v963" have entirely different histories.
Binary file not shown.
@ -1,25 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on startup
|
||||
|
||||
#stop on runlevel
|
||||
|
||||
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
|
||||
if mount|grep /dev/root|grep nfs &>/dev/null; then
|
||||
/sbin/initctl emit varmake
|
||||
else
|
||||
umount /proc
|
||||
mount -t tmpfs none /var/lock
|
||||
/sbin/initctl emit start udev
|
||||
fi
|
||||
end script
|
@ -1,9 +0,0 @@
|
||||
# control-alt-delete - emergency keypress handling
|
||||
#
|
||||
# This task is run whenever the Control-Alt-Delete key combination is
|
||||
# pressed. Usually used to shut down the machine.
|
||||
|
||||
start on control-alt-delete
|
||||
|
||||
emit shutdown
|
||||
exec /sbin/shutdown -t1 -a -r now "Control-Alt-Delete pressed"
|
@ -1,19 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on stopped udevstart
|
||||
|
||||
#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
|
||||
if [ -f /etc/sysconfig/nodename ]; then
|
||||
/bin/hostname `cat /etc/sysconfig/nodename`
|
||||
else
|
||||
/bin/hostname "localhost"
|
||||
fi
|
||||
end script
|
@ -1,14 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started udev
|
||||
|
||||
script
|
||||
source /etc/init.d/functions
|
||||
for RC in /etc/hotplug/*.rc; do
|
||||
$RC start
|
||||
done
|
||||
touch /var/lock/subsys/hotplug
|
||||
end script
|
@ -1,34 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on stopped maccfg
|
||||
stop on stopping mountfs
|
||||
|
||||
console logged
|
||||
|
||||
pre-start script
|
||||
for IF in `ls -d /sys/class/net/*[^lo]`; do
|
||||
DEVNAME=`basename $IF`
|
||||
if [ -d /sys/class/net/$DEVNAME/wireless ]; then
|
||||
/sbin/wlan_setup $DEVNAME
|
||||
#give wlan a chance go create link
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f /usr/sbin/ethtool ]; then
|
||||
if [ `ethtool $DEVNAME|grep Link|awk '{print $3}'` == "yes" ]; then
|
||||
/sbin/if_up $DEVNAME
|
||||
fi
|
||||
else
|
||||
/sbin/if_up $DEVNAME
|
||||
fi
|
||||
done
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
for IF in `ls -d /sys/class/net/*[^lo]`; do
|
||||
DEVNAME=`basename $IF`
|
||||
/sbin/if_down $DEVNAME
|
||||
done
|
||||
end script
|
@ -1,30 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on stopped virtualfs
|
||||
|
||||
#stop on runlevel
|
||||
|
||||
description "Initialize Locical Volume Manager (LVM)"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
|
||||
console logged
|
||||
|
||||
# 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
|
||||
source /etc/init.d/functions
|
||||
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
|
||||
end script
|
@ -1,11 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started mountfs
|
||||
stop on stopping mountfs
|
||||
|
||||
console logged
|
||||
|
||||
exec /usr/sbin/klogd -n -f /var/log/kern.log
|
@ -1,26 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on started mountfs
|
||||
|
||||
#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
|
||||
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
|
||||
exec 3>&-
|
||||
fi
|
||||
echo -n "Loading keymap..."
|
||||
/bin/loadkeys -d >/dev/null
|
||||
end script
|
@ -1,42 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started udev
|
||||
stop on stopping udev
|
||||
|
||||
pre-start script
|
||||
source /etc/init.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
|
||||
done
|
||||
rm /tmp/loadmods
|
||||
fi
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
if [ -f /etc/sysconfig/loadmods ]; then
|
||||
Z=0
|
||||
while [ "$Z" "<" "9" ]; do
|
||||
exec 3</proc/modules
|
||||
while read <&3 MODNAME INFO; do
|
||||
if rmmod -s $MODNAME &>/dev/null; then
|
||||
print_status success
|
||||
else
|
||||
if [ "$Z" == "8" ]; then
|
||||
print_status failure
|
||||
else
|
||||
echo "failed"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
(( Z = $Z + 1 ))
|
||||
exec 3>&-
|
||||
done
|
||||
fi
|
||||
end script
|
@ -1,20 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on stopped udevstart
|
||||
|
||||
#stop on runlevel
|
||||
|
||||
console logged
|
||||
|
||||
# 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.
|
||||
pre-start script
|
||||
/sbin/ifconfig lo 127.0.0.1
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
/sbin/ifconfig lo down
|
||||
end script
|
@ -1,16 +0,0 @@
|
||||
# logd
|
||||
#
|
||||
# This service is started automatically by init so that the output from
|
||||
# other services can be logged.
|
||||
|
||||
description "service logging daemon"
|
||||
author "Scott James Remnant <scott@ubuntu.com>"
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 6
|
||||
|
||||
console output
|
||||
|
||||
exec /sbin/logd
|
||||
respawn
|
@ -1,16 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started loadmodules
|
||||
|
||||
console logged
|
||||
|
||||
script
|
||||
if ls /etc/mactab* &>/dev/null; then
|
||||
for maccfg in /etc/mactab*; do
|
||||
nameif -c $maccfg >/dev/null
|
||||
done
|
||||
fi
|
||||
end script
|
@ -1,54 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on stopped checkfs
|
||||
|
||||
stop on shutdown
|
||||
stop on runlevel 6
|
||||
stop on runlevel 0
|
||||
|
||||
description "Mount all Filesystem which are not 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
|
||||
pre-start script
|
||||
source /etc/init.d/functions
|
||||
echo -n "Remounting rootfs in rw 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 script
|
||||
|
||||
post-stop script
|
||||
source /etc/init.d/functions
|
||||
|
||||
echo -n "Deactivating swap..."
|
||||
/sbin/swapoff -a
|
||||
evaluate_retval
|
||||
|
||||
echo -n "Unmounting file systems..."
|
||||
/bin/umount -a -r
|
||||
evaluate_retval
|
||||
end script
|
@ -1,35 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started nfsclient
|
||||
stop on stopping nfsclient
|
||||
|
||||
console output
|
||||
|
||||
pre-start script
|
||||
source /etc/init.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
|
||||
fi
|
||||
done
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
source /etc/init.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
|
||||
fi
|
||||
done
|
||||
end script
|
@ -1,28 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started syslogd
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console logged
|
||||
|
||||
script
|
||||
echo "Starting rc-default script"
|
||||
/sbin/runlevel --reboot || true
|
||||
|
||||
if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
|
||||
/sbin/telinit S
|
||||
elif [ -r /etc/inittab ]; then
|
||||
RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
|
||||
if [ -n "$RL" ]; then
|
||||
/sbin/telinit $RL
|
||||
else
|
||||
/sbin/telinit 2
|
||||
fi
|
||||
else
|
||||
/sbin/telinit 2
|
||||
fi
|
||||
end script
|
@ -1,25 +0,0 @@
|
||||
# rc0 - runlevel 0 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 0 ("halt/poweroff") scripts with
|
||||
# the decision as to whether to halt or power off the system left up to the
|
||||
# script (and thus /etc/default/poweroff).
|
||||
|
||||
start on runlevel 0
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel || true)
|
||||
if [ "$2" != "0" ] && [ "$2" != "6" ]; then
|
||||
set $(runlevel --set 0 || true)
|
||||
fi
|
||||
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 0
|
||||
end script
|
@ -1,19 +0,0 @@
|
||||
# rc1 - runlevel 1 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 1 ("single-user") scripts.
|
||||
|
||||
start on runlevel 1
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel --set 1 || true)
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 1
|
||||
end script
|
@ -1,20 +0,0 @@
|
||||
# rc2 - runlevel 2 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 2 ("multi-user") scripts. It
|
||||
# is usually started by the telinit compatibility wrapper.
|
||||
|
||||
start on runlevel 2
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel --set 2 || true)
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 2
|
||||
end script
|
@ -1,20 +0,0 @@
|
||||
# rc3 - runlevel 3 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 3 (user defined) scripts. It
|
||||
# is usually started by the telinit compatibility wrapper.
|
||||
|
||||
start on runlevel 3
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel --set 3 || true)
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 3
|
||||
end script
|
@ -1,20 +0,0 @@
|
||||
# rc3 - runlevel 3 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 3 (user defined) scripts. It
|
||||
# is usually started by the telinit compatibility wrapper.
|
||||
|
||||
start on runlevel 4
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel --set 4 || true)
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 4
|
||||
end script
|
@ -1,20 +0,0 @@
|
||||
# rc5 - runlevel 5 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 5 (user defined) scripts. It
|
||||
# is usually started by the telinit compatibility wrapper.
|
||||
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel --set 5 || true)
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 5
|
||||
end script
|
@ -1,23 +0,0 @@
|
||||
# rc6 - runlevel 6 compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc runlevel 6 ("reboot") scripts.
|
||||
|
||||
start on runlevel 6
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console output
|
||||
script
|
||||
set $(runlevel || true)
|
||||
if [ "$2" != "0" ] && [ "$2" != "6" ]; then
|
||||
set $(runlevel --set 6 || true)
|
||||
fi
|
||||
|
||||
if [ "$1" != "unknown" ]; then
|
||||
PREVLEVEL=$1
|
||||
RUNLEVEL=$2
|
||||
export PREVLEVEL RUNLEVEL
|
||||
fi
|
||||
|
||||
exec /etc/init.d/rc 6
|
||||
end script
|
@ -1,25 +0,0 @@
|
||||
# rcS-sulogin - "single-user" runlevel compatibility
|
||||
#
|
||||
# This task runs the sulogin binary during "single-user" mode.
|
||||
|
||||
start on runlevel S
|
||||
|
||||
stop on runlevel
|
||||
|
||||
console owner
|
||||
|
||||
script
|
||||
runlevel --set S >/dev/null || true
|
||||
/sbin/sulogin
|
||||
|
||||
if [ -r /etc/inittab ]; then
|
||||
RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
|
||||
if [ -n "$RL" ]; then
|
||||
telinit $RL
|
||||
else
|
||||
telinit 2
|
||||
fi
|
||||
else
|
||||
telinit 2
|
||||
fi
|
||||
end script
|
@ -1,47 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started ifup
|
||||
|
||||
console logged
|
||||
|
||||
script
|
||||
source /etc/init.d/functions
|
||||
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
|
||||
end script
|
@ -1,24 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on started mountfs
|
||||
|
||||
#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
|
||||
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
|
||||
end script
|
@ -1,11 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on stopped routing
|
||||
stop on stopping ifup
|
||||
|
||||
console logged
|
||||
exec /usr/sbin/syslogd -n -m 0
|
||||
respawn
|
@ -1,16 +0,0 @@
|
||||
# tty1 - getty
|
||||
#
|
||||
# This service maintains a getty on tty1 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on runlevel 2
|
||||
start on runlevel 3
|
||||
start on runlevel 4
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 6
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty1 9600
|
@ -1,17 +0,0 @@
|
||||
# tty2 - getty
|
||||
#
|
||||
# This service maintains a getty on tty2 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on runlevel 2
|
||||
start on runlevel 3
|
||||
start on runlevel 4
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 5
|
||||
stop on runlevel 6
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty2 9600
|
@ -1,16 +0,0 @@
|
||||
# tty3 - getty
|
||||
#
|
||||
# This service maintains a getty on tty3 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on runlevel 2
|
||||
start on runlevel 3
|
||||
start on runlevel 4
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 6
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty3 9600
|
@ -1,16 +0,0 @@
|
||||
# tty4 - getty
|
||||
#
|
||||
# This service maintains a getty on tty4 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on runlevel 2
|
||||
start on runlevel 3
|
||||
start on runlevel 4
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 6
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty4 9600
|
@ -1,16 +0,0 @@
|
||||
# tty5 - getty
|
||||
#
|
||||
# This service maintains a getty on tty5 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on runlevel 2
|
||||
start on runlevel 3
|
||||
start on runlevel 4
|
||||
start on runlevel 5
|
||||
|
||||
stop on runlevel 0
|
||||
stop on runlevel 1
|
||||
stop on runlevel 6
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty5 9600
|
@ -1,8 +0,0 @@
|
||||
# tty6 - getty
|
||||
#
|
||||
# This service maintains a getty on tty6 from the point the system is
|
||||
# started until it is shut down again.
|
||||
|
||||
start on started udev
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty6 9600
|
@ -1,27 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started mountfs
|
||||
stop on stopping mountfs
|
||||
|
||||
pre-start script
|
||||
source /etc/udev/udev.conf
|
||||
prog=udev
|
||||
sysfs_dir=/sys
|
||||
bin=/sbin/udev
|
||||
udevd=/sbin/udevd
|
||||
udev_root=/dev
|
||||
if [ ! -d $sysfs_dir/block ]; then
|
||||
exit 1
|
||||
fi
|
||||
export ACTION=add
|
||||
touch /var/lock/subsys/udev
|
||||
end script
|
||||
|
||||
exec /sbin/udevd
|
||||
|
||||
post-stop script
|
||||
rm /var/lock/subsys/udev
|
||||
end script
|
@ -1,42 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on start udev
|
||||
|
||||
#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
|
||||
if [ -f /sbin/udevstart ]; then
|
||||
. /etc/init.d/functions
|
||||
. /etc/udev/udev.conf
|
||||
prog=udev
|
||||
szsfs_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"
|
||||
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 "
|
||||
mount -t tmpfs none /dev
|
||||
evaluate_retval
|
||||
export ACTION=add
|
||||
echo -n "Creating initial udev device nodes"
|
||||
/sbin/udevstart
|
||||
mkdir /dev/pts
|
||||
fi
|
||||
end script
|
@ -1,8 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started udev
|
||||
|
||||
exec /sbin/udevtrigger
|
@ -1,44 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
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"
|
||||
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
|
||||
/sbin/initctl emit start udev
|
||||
end script
|
@ -1,29 +0,0 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
|
||||
start on stopped udevstart
|
||||
|
||||
#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
|
||||
source /etc/init.d/functions
|
||||
echo -n "Changing state of rootfs to rw"
|
||||
/bin/mount -n -o remount,rw /
|
||||
evaluate_retval
|
||||
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
|
||||
fi
|
||||
done
|
||||
end script
|
@ -1,21 +0,0 @@
|
||||
# rc - runlevel compatibility
|
||||
#
|
||||
# This task guesses what the "default runlevel" should be and starts the
|
||||
# appropriate script.
|
||||
|
||||
start on started rpc
|
||||
stop on stopping rpc
|
||||
|
||||
console output
|
||||
|
||||
pre-start script
|
||||
if [ -f /etc/sysconfig/nis/defaultdomain ]; then
|
||||
domainname `cat /etc/sysconfig/nis/defaultdomain`
|
||||
/usr/sbin/ypbind
|
||||
sleep 2
|
||||
fi
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
pkill ypbind
|
||||
end script
|
@ -148,7 +148,7 @@ loadproc()
|
||||
|
||||
base=`/bin/basename $1`
|
||||
|
||||
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
|
||||
pidlist=`/bin/pidof $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
pid=""
|
||||
|
||||
@ -188,7 +188,7 @@ killproc()
|
||||
nolevel=1
|
||||
fi
|
||||
|
||||
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
|
||||
pidlist=`/bin/pidof $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
pid=""
|
||||
|
||||
@ -251,7 +251,7 @@ reloadproc()
|
||||
nolevel=1
|
||||
fi
|
||||
|
||||
pidlist=`/bin/pidof -o $$ -o $PPID -o %PPID -x $base`
|
||||
pidlist=`/bin/pidof $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
pid=""
|
||||
|
||||
@ -287,7 +287,7 @@ statusproc()
|
||||
return 1
|
||||
fi
|
||||
|
||||
pid=`/bin/pidof -o $$ -o $PPID -o %PPID -x $1`
|
||||
pidlist=`/bin/pidof $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
if [ -n "$pid" ]
|
||||
then
|
||||
echo "$1 running with Process ID $pid"
|
||||
|
157
etc/init.d/rc
Normal file
157
etc/init.d/rc
Normal 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: 2003-10-22 20:35:29 +0200 (Mi, 22 Okt 2003) $
|
||||
#$Revision: 3339 $
|
||||
#
|
||||
#$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
|
49
etc/init.d/rcS
Normal file
49
etc/init.d/rcS
Normal file
@ -0,0 +1,49 @@
|
||||
#!/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: kueller $
|
||||
#Datum der letzten Änderung: $Date: 2009-03-30 21:53:23 +0200 (Mo, 30 Mär 2009) $
|
||||
#Version der Datei: $Revision: 4568 $
|
||||
#
|
||||
|
||||
# Begin /etc/init.d/rcS
|
||||
|
||||
runlevel=S
|
||||
prevlevel=N
|
||||
umask 022
|
||||
export runlevel prevlevel
|
||||
|
||||
trap ":" INT QUIT TSTP
|
||||
|
||||
source /etc/init.d/functions
|
||||
|
||||
for i in /etc/init.d/rcS.d/S??*
|
||||
do
|
||||
[ ! -f "$i" ] && continue;
|
||||
$i start
|
||||
done
|
||||
|
||||
# End /etc/init.d/rcS
|
@ -1,26 +1,17 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
description "Check Filesystems"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped initlvm
|
||||
|
||||
#stop on runlevel
|
||||
|
||||
description "Check Filesystems"
|
||||
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
|
||||
source /etc/init.d/functions
|
||||
if [ -f /fastboot ]; then
|
||||
echo "Fast boot, no file system check"
|
||||
else
|
||||
echo "Changing state of rootfs to ro"
|
||||
echo "running checkfs"
|
||||
source /etc/init/functions
|
||||
if [ ! -f /fastboot ]; then
|
||||
/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 "
|
27
etc/init/checkvar.conf
Normal file
27
etc/init/checkvar.conf
Normal file
@ -0,0 +1,27 @@
|
||||
description "Check if / ist nfs"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits varmake startudev
|
||||
|
||||
|
||||
start on startup
|
||||
|
||||
console output
|
||||
script
|
||||
echo "Starting checkvar script"
|
||||
source /etc/init/functions
|
||||
mount -o remount,rw /
|
||||
rm /etc/mtab
|
||||
touch /etc/mtab
|
||||
mount -o remount,ro /
|
||||
mount -o remount,rw -t proc none /proc &&
|
||||
status_message "/proc mounted"
|
||||
if mount|grep /dev/root|grep nfs &>/dev/null; then
|
||||
/sbin/initctl emit varmake
|
||||
status_message "emitting varmake"
|
||||
else
|
||||
mount -t tmpfs none /var/lock
|
||||
/sbin/initctl emit startudev
|
||||
status_message "emitting startudev"
|
||||
fi
|
||||
end script
|
12
etc/init/control-alt-delete.conf
Normal file
12
etc/init/control-alt-delete.conf
Normal file
@ -0,0 +1,12 @@
|
||||
# control-alt-delete - emergency keypress handling
|
||||
#
|
||||
# This task is run whenever the Control-Alt-Delete key combination is
|
||||
# pressed, and performs a safe reboot of the machine.
|
||||
|
||||
description "emergency keypress handling"
|
||||
author "Scott James Remnant <scott@netsplit.com>"
|
||||
|
||||
start on control-alt-delete
|
||||
|
||||
task
|
||||
exec shutdown -r now "Control-Alt-Delete pressed"
|
27
etc/init/dbus.conf
Executable file
27
etc/init/dbus.conf
Executable file
@ -0,0 +1,27 @@
|
||||
description "Startup autofs System for local configuration files"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on (runlevel [2345] and (started ifup))
|
||||
stop on runlevel [016]
|
||||
|
||||
console output
|
||||
|
||||
pre-start script
|
||||
dbus-uuidgen --ensure
|
||||
if [ -f /var/run/dbus/system_bus_socket ]; then
|
||||
rm /var/run/dbus/system_bus_socket
|
||||
fi
|
||||
end script
|
||||
|
||||
script
|
||||
export PATH=$PATH:/usr/X11R7/bin
|
||||
/usr/bin/dbus-daemon --system --nofork
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
if [ -f /var/run/dbus/pid ]; then
|
||||
rm /var/run/dbus/pid
|
||||
fi
|
||||
end script
|
415
etc/init/functions
Executable file
415
etc/init/functions
Executable file
@ -0,0 +1,415 @@
|
||||
#!/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 [ $STATUS = 0 ]; then
|
||||
print_status success
|
||||
else
|
||||
print_status failure
|
||||
fi
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
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 $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
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 $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
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 $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
|
||||
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
|
||||
|
||||
pidlist=`/bin/pidof $base|sed -e "s/$$//"|sed -e "s/$PPID//"`
|
||||
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
|
||||
}
|
12
etc/init/halt.conf
Normal file
12
etc/init/halt.conf
Normal file
@ -0,0 +1,12 @@
|
||||
description "halt system to poweroff"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [0] and ( stopped udev ))
|
||||
|
||||
console output
|
||||
script
|
||||
echo "System reboot in progress..."
|
||||
/sbin/halt -f -p
|
||||
end script
|
19
etc/init/hostname.conf
Normal file
19
etc/init/hostname.conf
Normal file
@ -0,0 +1,19 @@
|
||||
description "Setup System Hostname"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [S012345] and ( started udev ))
|
||||
|
||||
console none
|
||||
script
|
||||
echo "setting up hostname"
|
||||
source /etc/init/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
|
16
etc/init/hotplug.conf
Normal file
16
etc/init/hotplug.conf
Normal file
@ -0,0 +1,16 @@
|
||||
description "Startup Hotplug Service"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped virtualfs
|
||||
|
||||
script
|
||||
echo "starting hotplug scripts"
|
||||
source /etc/init/functions
|
||||
for RC in /etc/hotplug/*.rc; do
|
||||
$RC start
|
||||
done
|
||||
touch /var/lock/subsys/hotplug
|
||||
status_message "hotplug startup ready"
|
||||
end script
|
16
etc/init/ifdown.conf
Normal file
16
etc/init/ifdown.conf
Normal file
@ -0,0 +1,16 @@
|
||||
description "Shutdown all network interfaces without Loopback"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopping udev
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
echo "Stopping network"
|
||||
for IF in `ls -d /sys/class/net/*[^lo]`; do
|
||||
DEVNAME=`basename $IF`
|
||||
/sbin/if_down $DEVNAME
|
||||
done
|
||||
end script
|
34
etc/init/ifup.conf
Normal file
34
etc/init/ifup.conf
Normal file
@ -0,0 +1,34 @@
|
||||
description "Setup all configured Network Interfaces"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (stopped maccfg))
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
echo "Configuring network"
|
||||
for IF in `ls -d /sys/class/net/*[^lo]`; do
|
||||
DEVNAME=`basename $IF`
|
||||
/sbin/if_up $DEVNAME
|
||||
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
|
20
etc/init/initlvm.conf
Normal file
20
etc/init/initlvm.conf
Normal file
@ -0,0 +1,20 @@
|
||||
description "Initialize Logical Volume Manager (LVM)"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped virtualfs
|
||||
|
||||
console output
|
||||
script
|
||||
echo "Initializing volumes"
|
||||
source /etc/init/functions
|
||||
if [ -f /sbin/vgscan ]; then
|
||||
/sbin/vgscan >/dev/null 2>&1
|
||||
status_message "Scanning of Volumes....."
|
||||
for i in `vgdisplay|grep "VG Name"|awk '{print $3}'`; do
|
||||
vgchange -a y $i
|
||||
status_message "Volume Aktivation of $i ..."
|
||||
done
|
||||
fi
|
||||
end script
|
22
etc/init/loadkeys.conf
Normal file
22
etc/init/loadkeys.conf
Normal file
@ -0,0 +1,22 @@
|
||||
description "Load System default Keymap"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped mountfs
|
||||
|
||||
console output
|
||||
script
|
||||
echo "Loading Keymap"
|
||||
source /etc/init/functions
|
||||
if [ -f /etc/sysconfig/kbd/setkeys ]; then
|
||||
exec 3</etc/sysconfig/kbd/setkeys
|
||||
while read <&3 CODE MAP; do
|
||||
setkeycodes $CODE $MAP
|
||||
done
|
||||
status_message "Load of Special kbd mappings..."
|
||||
exec 3>&-
|
||||
fi
|
||||
/usr/bin/loadkeys -d >/dev/null
|
||||
status_message "Loaded Keymap ..."
|
||||
end script
|
21
etc/init/loadmodules.conf
Normal file
21
etc/init/loadmodules.conf
Normal file
@ -0,0 +1,21 @@
|
||||
description "Force load of special Modules defined in /etc/sysconfig/loadmods"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [12345] and ( started udev ))
|
||||
|
||||
pre-start script
|
||||
echo "Loading additional modules"
|
||||
source /etc/init/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
|
||||
end script
|
15
etc/init/localnet.conf
Normal file
15
etc/init/localnet.conf
Normal file
@ -0,0 +1,15 @@
|
||||
description "Loopback Network Setup"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [S012345] and ( started udev ))
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
echo "Setting up localhost"
|
||||
source /etc/init/functions
|
||||
/sbin/ifconfig lo 127.0.0.1 up
|
||||
status_message "Setup local net..."
|
||||
end script
|
17
etc/init/maccfg.conf
Normal file
17
etc/init/maccfg.conf
Normal file
@ -0,0 +1,17 @@
|
||||
description "Special MAC Address Setup based on /etc/mactab*"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (stopped mountfs))
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
if ls /etc/mactab* &>/dev/null; then
|
||||
for maccfg in /etc/mactab*; do
|
||||
nameif -c $maccfg >/dev/null
|
||||
done
|
||||
status_message "Setup of mac adresses"
|
||||
fi
|
||||
end script
|
47
etc/init/mountfs.conf
Normal file
47
etc/init/mountfs.conf
Normal file
@ -0,0 +1,47 @@
|
||||
description "Mounting all Filesystem not depending on Network"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped checkfs
|
||||
|
||||
console output
|
||||
script
|
||||
source /etc/init/functions
|
||||
/bin/mount -n -o remount,rw /
|
||||
status_message "Remount of / to rw"
|
||||
/bin/rm -f /fastboot /forcefsck
|
||||
/sbin/swapon -a
|
||||
status_message "Swap Aktivated"
|
||||
POINTS=`sed -e "/^#/d" -e "/^$/d" /etc/fstab|\
|
||||
awk '{if ( ( $2 != "/" ) && \
|
||||
( $3 != "swap" ) && \
|
||||
( $3 != "nfs" ) ) print $2 }'`
|
||||
Do_Mount=1
|
||||
FOUND=0
|
||||
MP_DEPTH=1
|
||||
while [ $Do_Mount -eq 1 ]; do
|
||||
for i in $POINTS; do
|
||||
DEPTH=`echo $i|awk -F"/" '{print NF-1}'`
|
||||
if [ $DEPTH == $MP_DEPTH ]; then
|
||||
if [ ! -d $i ]; then
|
||||
mkdir -p $i
|
||||
fi
|
||||
mount $i &
|
||||
status_message "Mount of $i"
|
||||
FOUND=1
|
||||
fi
|
||||
done
|
||||
wait `pgrep /bin/mount`
|
||||
if [ $FOUND -eq 0 ]; then
|
||||
Do_Mount=0
|
||||
else
|
||||
FOUND=0
|
||||
(( MP_DEPTH++ ))
|
||||
fi
|
||||
done
|
||||
/sbin/ldconfig
|
||||
if [ -f /var/run/utmp ]; then
|
||||
cp /dev/null /var/run/utmp
|
||||
fi
|
||||
end script
|
20
etc/init/mountnfs.conf
Normal file
20
etc/init/mountnfs.conf
Normal file
@ -0,0 +1,20 @@
|
||||
description "Mounting NFS Filesystems"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (started nfsclient))
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
source /etc/init/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
|
||||
mount $MOUNTPOINT
|
||||
status_message "Mount nfs Filesystem on $MOUNTPOINT"
|
||||
fi
|
||||
done
|
||||
end script
|
@ -1,21 +1,15 @@
|
||||
# rcS - runlevel compatibility
|
||||
#
|
||||
# This task runs the old sysv-rc startup scripts.
|
||||
description "Special Handling for nfs / (root) Filesystem"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
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
|
||||
source /etc/init.d/functions
|
||||
echo -n "Mounting tmpfs on /var"
|
||||
source /etc/init/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 +27,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
|
12
etc/init/nscd.conf
Normal file
12
etc/init/nscd.conf
Normal file
@ -0,0 +1,12 @@
|
||||
description "Startup nscd"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [12345] and (stopped routing))
|
||||
stop on (runlevel [06] and stopping udev)
|
||||
|
||||
console none
|
||||
|
||||
respawn
|
||||
exec /usr/sbin/nscd -f /etc/nscd.conf -d
|
11
etc/init/reboot.conf
Normal file
11
etc/init/reboot.conf
Normal file
@ -0,0 +1,11 @@
|
||||
description "Force a reboot after all daemons are down"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [6] and ( stopped udev ))
|
||||
|
||||
script
|
||||
echo "System reboot in progress..."
|
||||
/sbin/reboot -f
|
||||
end script
|
41
etc/init/routing.conf
Normal file
41
etc/init/routing.conf
Normal file
@ -0,0 +1,41 @@
|
||||
description "Setup Routing depending on several config files"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped ifup
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
source /etc/init/functions
|
||||
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
|
||||
while read <&3 TYPE NETWORK OPTION GW NETMASK; do
|
||||
if [ "$OPTION" == "dev" ]; then
|
||||
/sbin/route add -$TYPE $NETWORK netmask $NETMASK dev $GW
|
||||
status_message "Device route to $NETWORK with $NETMASK on $GW"
|
||||
fi
|
||||
if [ "$OPTION" == "gw" ]; then
|
||||
/sbin/route add -$TYPE $NETWORK netmask $NETMASK gw $GW
|
||||
status_message "Net Route to $NETWORK with $NETMASK and gw $GW"
|
||||
fi
|
||||
done
|
||||
exec 3>&-
|
||||
rm /tmp/gateways
|
||||
fi
|
||||
if [ -f /etc/sysconfig/net/defaultrouter ]; then
|
||||
/sbin/route add default gw `cat /etc/sysconfig/net/defaultrouter`
|
||||
status_message "Default Router set to `cat /etc/sysconfig/net/defaultrouter`"
|
||||
fi
|
||||
NUMIF=`/sbin/ip -f inet addr show|/bin/grep inet|/bin/grep -v "host lo"|wc -l`
|
||||
if [ $NUMIF -gt 2 ]; then
|
||||
echo "1" >/proc/sys/net/ipv4/ip_forward
|
||||
status_message "Enable of ip_forwarding"
|
||||
fi
|
||||
fi
|
||||
end script
|
12
etc/init/rsyslogd.conf
Normal file
12
etc/init/rsyslogd.conf
Normal file
@ -0,0 +1,12 @@
|
||||
description "Startup Syslog"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [12345] and (stopped routing))
|
||||
stop on (runlevel [06] and stopping udev)
|
||||
|
||||
console none
|
||||
|
||||
respawn
|
||||
exec /sbin/rsyslogd -n
|
13
etc/init/sendsignals.conf
Normal file
13
etc/init/sendsignals.conf
Normal file
@ -0,0 +1,13 @@
|
||||
description "Send all remaining prozesses the kill signal"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopped udev
|
||||
|
||||
script
|
||||
echo -n "sending all remaining processes the TERM signal"
|
||||
killall -15
|
||||
sleep 3
|
||||
killall -9
|
||||
end script
|
19
etc/init/setclock.conf
Normal file
19
etc/init/setclock.conf
Normal file
@ -0,0 +1,19 @@
|
||||
description "Set Clock from hw System clock"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [12345] and (started mountfs))
|
||||
|
||||
console output
|
||||
script
|
||||
source /etc/init/functions
|
||||
CLOCKPARAMS="--hctosys"
|
||||
case "$UTC" in
|
||||
yes|true|1)
|
||||
CLOCKPARAMS="$CLOCKPARAMS -u"
|
||||
;;
|
||||
esac
|
||||
/sbin/hwclock $CLOCKPARAMS
|
||||
status_message "Load of hwclock..."
|
||||
end script
|
10
etc/init/tty1.conf
Normal file
10
etc/init/tty1.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty1"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty1 9600
|
10
etc/init/tty2.conf
Normal file
10
etc/init/tty2.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty2"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and ( started udev ))
|
||||
stop on ( runlevel [016] and ( stopping udev ))
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty2 9600
|
10
etc/init/tty3.conf
Normal file
10
etc/init/tty3.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty3"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (started udev))
|
||||
stop on ( runlevel [016] and (stopping udev))
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty3 9600
|
10
etc/init/tty4.conf
Normal file
10
etc/init/tty4.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty4"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (started udev))
|
||||
stop on ( runlevel [016] and (stopping udev))
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty4 9600
|
10
etc/init/tty5.conf
Normal file
10
etc/init/tty5.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty5"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (started udev))
|
||||
stop on ( runlevel [016] and (stopping udev))
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty5 9600
|
10
etc/init/tty6.conf
Normal file
10
etc/init/tty6.conf
Normal file
@ -0,0 +1,10 @@
|
||||
description "Startup login getty on tty6"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( runlevel [2345] and (started udev))
|
||||
stop on ( runlevel [016] and (stopping udev))
|
||||
|
||||
respawn
|
||||
exec /sbin/agetty /dev/tty6 9600
|
50
etc/init/udev.conf
Normal file
50
etc/init/udev.conf
Normal file
@ -0,0 +1,50 @@
|
||||
description "Staring udevdaemon to create all the /dev entrys"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on startudev
|
||||
stop on runlevel [06]
|
||||
|
||||
console output
|
||||
pre-start script
|
||||
source /etc/init/functions
|
||||
echo "Starting udev"
|
||||
mount -t sysfs none /sys &&
|
||||
status_message "udev: mount sysfs"
|
||||
if [ ! -d /var/lock/subsys ]; then
|
||||
mkdir /var/lock/subsys
|
||||
fi
|
||||
if [ ! -d /dev ]; then
|
||||
mkdir /dev
|
||||
fi
|
||||
if [ ! -c /dev/zero ]; then
|
||||
mount -n -t tmpfs -o mode=0755 udev /dev &&
|
||||
status_message "udev: tmpfs on /dev created"
|
||||
fi
|
||||
test -d /lib/udev/devices &&
|
||||
cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev &&
|
||||
status_message "udev: Static entries copied..."
|
||||
/bin/mkdir -p /dev/shm
|
||||
/bin/mkdir -p /dev/pts
|
||||
/bin/mount -n -t tmpfs -o mode=1755 none /dev/shm
|
||||
test -c /dev/null ||
|
||||
/bin/mknod /dev/null c 1 3 &&
|
||||
/bin/chmod 666 /dev/null
|
||||
test -c /dev/console ||
|
||||
/bin/mknod /dev/console c 5 1
|
||||
status_message "udev prestart ready"
|
||||
end script
|
||||
|
||||
respawn
|
||||
exec /sbin/udevd
|
||||
|
||||
post-start script
|
||||
source /etc/init/functions
|
||||
/bin/mkdir -p /dev/.udev/queue
|
||||
status_message "udev: queue maked"
|
||||
/sbin/udevadm trigger
|
||||
status_message "udev: trigger done"
|
||||
/sbin/udevadm settle
|
||||
status_message "udev: Coldplug ready..."
|
||||
end script
|
17
etc/init/umountfs.conf
Normal file
17
etc/init/umountfs.conf
Normal file
@ -0,0 +1,17 @@
|
||||
description "Umount all Filesystems, and turn off swap"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on (runlevel[06] and (stopped udev))
|
||||
|
||||
console none
|
||||
script
|
||||
source /etc/init/functions
|
||||
|
||||
/sbin/swapoff -a
|
||||
status_message "swap deaktivated..."
|
||||
|
||||
/bin/umount -a -r
|
||||
status_message "All File Systems umounted..."
|
||||
end script
|
20
etc/init/umountnfs.conf
Normal file
20
etc/init/umountnfs.conf
Normal file
@ -0,0 +1,20 @@
|
||||
description "Mounting NFS Filesystems"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on stopping nfsclient
|
||||
|
||||
console output
|
||||
|
||||
script
|
||||
source /etc/init/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
|
||||
umount $MOUNTPOINT
|
||||
status_message "umount NFS Filesystem from $MOUNTPOINT"
|
||||
fi
|
||||
done
|
||||
end script
|
23
etc/init/unloadmodules.conf
Normal file
23
etc/init/unloadmodules.conf
Normal file
@ -0,0 +1,23 @@
|
||||
description "Force load of special Modules defined in /etc/sysconfig/loadmods"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on ( (runlevel [06]) and ( stopping udev ))
|
||||
|
||||
pre-start script
|
||||
echo "unload all modules"
|
||||
source /etc/init/functions
|
||||
Z=0
|
||||
while [ $z -le 9 ]; do
|
||||
exec 3</proc/modules
|
||||
read <$3 MODNAME INFO
|
||||
while [ $MODNAME ]; do
|
||||
modprobe -r $MODNAME 2>/dev/null
|
||||
status_message "$MODNAME unload..."
|
||||
read <&3 MODNAME INFO
|
||||
done
|
||||
(( Z = $Z + 1 ))
|
||||
exec 3>&-
|
||||
done
|
||||
end script
|
38
etc/init/varmake.conf
Normal file
38
etc/init/varmake.conf
Normal file
@ -0,0 +1,38 @@
|
||||
description "Make special handling for ro nfs root"
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on varmake
|
||||
|
||||
console output
|
||||
script
|
||||
source /etc/init.d/functions
|
||||
mount -t tmpfs none /var
|
||||
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"
|
||||
status_message "Trying to find out hostname..."
|
||||
cd /var
|
||||
tar -zxf /boot/var_${HOSTNAME}.tgz
|
||||
echo $HOSTNAME >etc/sysconfig/nodename
|
||||
cd -
|
||||
status_message "Restore of var Filesystem..."
|
||||
/sbin/initctl emit startudev
|
||||
end script
|
27
etc/init/virtualfs.conf
Normal file
27
etc/init/virtualfs.conf
Normal file
@ -0,0 +1,27 @@
|
||||
description "Mount all Virtual Filesystems like /proc /sys /tmp.."
|
||||
author "Harald Kueller <harald.kueller@compuextreme.de>"
|
||||
version 1.0
|
||||
emits none special
|
||||
|
||||
start on started udev
|
||||
|
||||
console output
|
||||
script
|
||||
source /etc/init/functions
|
||||
/bin/mount -n -o remount,rw /
|
||||
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
|
||||
if [ -d $MOUNTPOINT ]; then
|
||||
mount $MOUNTPOINT
|
||||
status_message "Mounting $MOUNTPOINT ..."
|
||||
else
|
||||
echo "Mountpoint $MOUNTPOINT not existing"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
end script
|
6
etc/inittab
Normal file
6
etc/inittab
Normal file
@ -0,0 +1,6 @@
|
||||
#
|
||||
#Helper for upstart to determine the runlevel
|
||||
#needet only in compatibly mode vor sysvinit
|
||||
#
|
||||
|
||||
id:4:initdefault:
|
65
init/genpkg
Normal file
65
init/genpkg
Normal file
@ -0,0 +1,65 @@
|
||||
#!/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: kueller $
|
||||
#Datum der letzten Änderung: $Date: 2009-03-30 21:53:23 +0200 (Mo, 30 Mär 2009) $
|
||||
#Version der Datei: $Revision: 4568 $
|
||||
#
|
||||
#$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
|
||||
ln -s ../init.d init.d
|
||||
cd $WDIR
|
28
sbin/CheckPid
Executable file
28
sbin/CheckPid
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
PIDFILE=$1
|
||||
|
||||
if [ ! ${PIDFILE} ]; then
|
||||
echo "Usage: $0 <pidfile>"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
PID=$(cat ${PIDFILE}|head -1)
|
||||
PSNAME=$(ps -ef|awk '{ if ( $2 == "'${PID}'" ) print $8 }'|cut -d "." -f1|sed -e "s/://g")
|
||||
SEEKNAME=$(basename ${PIDFILE}|cut -d"." -f1)
|
||||
if [ "${PSNAME}" ]; then
|
||||
if echo ${SEEKNAME}|grep -q $(basename ${PSNAME}); then
|
||||
logger -p info -t upstart "Found running Prozess ${PSNAME} for ${PIDFILE}; aborting startup"
|
||||
exit 2
|
||||
else
|
||||
logger -p info -t upstart "PIDFILE ${PIDFILE} does not point to the correct running prozess"
|
||||
logger -p info -t upstart "cleanup ${PIDFILE} and start the prozess"
|
||||
rm ${PIDFILE}
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
logger -p info -t upstart "PIDFILE ${PIDFILE} does not point to any prozess"
|
||||
logger -p info -t upstart "Cleanup ${PIDFILE} and start the prozess"
|
||||
rm ${PIDFILE}
|
||||
exit 0
|
||||
fi
|
37
sbin/if_down
37
sbin/if_down
@ -35,14 +35,19 @@ 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
|
||||
kill `ps -ef|grep dhclient|grep eth0|awk '{print $2}'`
|
||||
echo -n "Stopping dhclient for $DEV"
|
||||
dhcpcd -k $DEV
|
||||
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 "setting up interface $i:IP=$IP NMASK=$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
|
||||
@ -54,3 +59,31 @@ elif [ -f /etc/sysconfig/net/hostname.${DEV} ]; then
|
||||
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
|
||||
|
83
sbin/if_up
83
sbin/if_up
@ -30,27 +30,96 @@
|
||||
#
|
||||
|
||||
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
|
||||
dhclient -q ${DEV}
|
||||
elif [ -f /etc/sysconfig/net/hostname.${DEV} ]; then
|
||||
HOST=`cat /etc/sysconfig/net/hostname.${DEV}|awk '{print $1}'`
|
||||
#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"
|
||||
dhcpcd -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 $i:IP=$IP NMASK=$NETMASK"
|
||||
echo -n "setting up interface $NETDEV:IP=$IP NMASK=$NETMASK"
|
||||
if [ "$NETMASK" = "" ]; then
|
||||
DEV=`echo $i|cut -d ":" -f 1`
|
||||
DEV=`echo $NETDEV|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`
|
||||
DEV=`echo $NETDEV|cut -d ":" -f 1`
|
||||
$DEBUG ip addr add $IP/$SHMASK broadcast + dev $DEV
|
||||
$DEBUG ip link set $DEV up
|
||||
fi
|
||||
evaluate_retval
|
||||
done
|
||||
else
|
||||
ifconfig ${DEV} down
|
||||
fi
|
||||
fi
|
||||
|
@ -35,11 +35,20 @@
|
||||
#
|
||||
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
|
||||
@ -58,6 +67,9 @@ for AP in `iwlist $DEV scan 2>/dev/null|\
|
||||
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
|
||||
@ -66,10 +78,82 @@ for AP in `iwlist $DEV scan 2>/dev/null|\
|
||||
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
|
||||
|
@ -1,35 +0,0 @@
|
||||
cd /etc/init.d
|
||||
for i in 0 1 2 3 4 5 6; do
|
||||
cd rc$i.d
|
||||
if [ ! -d upstart_disabled ]; then
|
||||
mkdir upstart_disabled
|
||||
fi
|
||||
if [ -h S03sysklogd ]; then
|
||||
mv S03sysklogd upstart_disabled/S03sysklogd
|
||||
fi
|
||||
if [ -h S04hotplug ]; then
|
||||
mv S04hotplug upstart_disabled/S04hotplug
|
||||
fi
|
||||
if [ -h S05loadmodules ]; then
|
||||
mv S05loadmodules upstart_disabled/S05loadmodules
|
||||
fi
|
||||
if [ -h S05udev ]; then
|
||||
mv S05udev upstart_disabled/S05udev
|
||||
fi
|
||||
if [ -h S08wireless ]; then
|
||||
mv S08wireless upstart_disabled/S08wireless
|
||||
fi
|
||||
if [ -h S09localnet ]; then
|
||||
mv S09localnet upstart_disabled/S09localnet
|
||||
fi
|
||||
if [ -h S10dhcpclient ]; then
|
||||
mv S10dhcpclient upstart_disabled/S10dhcpclient
|
||||
fi
|
||||
if [ -h S10networks ]; then
|
||||
mv S10networks upstart_disabled/S10networks
|
||||
fi
|
||||
if [ -h S13ypclient ]; then
|
||||
mv S13ypclient upstart_disabled/S13ypclient
|
||||
fi
|
||||
cd ..
|
||||
done
|
Loading…
Reference in New Issue
Block a user