Ported it back to /bin/sh.

This commit is contained in:
Ivo Timmermans 2000-12-05 09:03:41 +00:00
parent 1e38dcc3fa
commit 4610d98c04

117
debian/init.d vendored
View file

@ -1,7 +1,7 @@
#! /usr/bin/perl -w #! /bin/sh
# #
# System startup script for tinc # System startup script for tinc
# $Id: init.d,v 1.14.2.3 2000/10/31 16:22:49 guus Exp $ # $Id: init.d,v 1.14.2.4 2000/12/05 09:03:41 zarq Exp $
# #
# Based on Lubomir Bulej's Redhat init script. # Based on Lubomir Bulej's Redhat init script.
# #
@ -11,71 +11,56 @@
# file. # file.
# #
my $DAEMON="/usr/sbin/tincd"; DAEMON="/usr/sbin/tincd"
my $NAME="tinc"; NAME="tinc"
my $DESC="tinc daemons"; DESC="tinc daemons"
my $TCONF="/etc/tinc"; TCONF="/etc/tinc"
my $EXTRA=""; EXTRA=""
my $NETSFILE="$TCONF/nets.boot"; NETSFILE="$TCONF/nets.boot"
my @NETS=(); NETS=""
test -f $DAEMON || exit 0
if (! -f $DAEMON) { exit 0; } find_nets () {
if [ ! -f $NETSFILE ] ; then
echo "Please create $NETSFILE."
exit 0
sub find_nets { fi
if(! open(FH, $NETSFILE)) { NETS="`egrep '^[ ]*[a-zA-Z0-9_]+[ ]*$' $NETSFILE`"
warn "Please create $NETSFILE.\n";
exit 0;
}
while (<FH>) {
chomp;
if( /^[ ]*([^ \#]+)/i ) {
push(@NETS, "$1");
}
}
if($#NETS == -1) {
warn "$NETSFILE doesn't contain any nets.\n";
exit 0;
} }
} case "$1" in
start)
if(!defined($ARGV[0])) { find_nets
die "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}\n"; echo -n "Starting $DESC:"
} for n in $NETS ; do
echo -n " $n"
if($ARGV[0] eq "start") { $DAEMON -n $n $EXTRA
find_nets; done
print "Starting $DESC:"; echo "."
foreach $n (@NETS) { ;;
print " $n"; stop)
system("$DAEMON -n $_[0] $EXTRA"); find_nets
} echo -n "Stopping $DESC:"
print ".\n"; for n in $NETS ; do
} elsif ($ARGV[0] eq "stop") { echo -n " $n"
find_nets; $DAEMON -n $n $EXTRA -k
print "Stopping $DESC:"; done
foreach $n (@NETS) { echo "."
print " $n"; ;;
system("$DAEMON -n $_[0] $EXTRA -k"); restart|force-reload)
} find_nets
print ".\n"; echo -n "Restarting $DESC:"
} elsif ($ARGV[0] eq "restart" || $ARGV[0] eq "force-reload") { for n in $NETS ; do
find_nets; echo -n " $n"
print "Stopping $DESC:"; $DAEMON -n $n $EXTRA -k
foreach $n (@NETS) { sleep 1
print " $n"; $DAEMON -n $n $EXTRA
system("$DAEMON -n $_[0] $EXTRA -k"); done
} echo "."
print ".\n"; ;;
print "Starting $DESC:"; *)
foreach $n (@NETS) { echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
print " $n"; exit 1
system("$DAEMON -n $_[0] $EXTRA"); ;;
} esac
print ".\n";
} else {
die "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}\n";
}