X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=debian%2Finit.d;h=4733951226150f0fda33c9d3f677a030e945c721;hp=c9a75fcbe69054d742edbb39e11ed8e7e4d82484;hb=0a2e2b0c8d20baf22b550f735b1fe63b0a1d377a;hpb=269067bb22e8f80deb43d3ac903f4e0d67af63d2 diff --git a/debian/init.d b/debian/init.d index c9a75fcb..47339512 100644 --- a/debian/init.d +++ b/debian/init.d @@ -1,30 +1,24 @@ #! /usr/bin/perl -w # # System startup script for tinc -# $Id: init.d,v 1.3 2000/05/13 00:54:27 zarq Exp $ +# $Id: init.d,v 1.5 2000/05/15 17:15:52 zarq Exp $ # my $DAEMON="/usr/sbin/tincd"; my $NAME="tinc"; my $DESC="tinc daemons"; -my $NETS="test2"; my $TCONF="/etc/tinc"; -my $EXTRA="-d"; +my $EXTRA=""; -if (! -f $DAEMON) { exit 0; } +my $NETS=""; # This is a space-separated list of networks to be started. -# Check the daemon -if ( ! -x $DAEMON ) { - print "**tinc: daemon $DAEMON does not exist or is not executable!\n"; - exit 1; -} -# Check the configuration directory -if ( ! -d $TCONF ) { - print "**tinc: configuration directory ($TCONF) not found!\n"; - exit 1; -} +if (! -f $DAEMON) { exit 0; } +if ($NETS eq "") { + warn "Please edit /etc/init.d/tinc before attempting to start tinc.\n"; + exit 0; +} ############################################################################## # vpn_load () Loads VPN configuration @@ -92,16 +86,9 @@ sub vpn_load { sub vpn_start { vpn_load($_[0]) || die "tinc: could not vpn_load $_[0]"; - if (! -c "/dev/$DEV") { - if (-e "/dev/$DEV") { - unlink("/dev/$DEV"); - } - $num = $NUM + 16; - system("echo mknod --mode=0600 /dev/$DEV c 36 $num"); - } system("insmod ethertap -s --name=\"ethertap$NUM\" unit=\"$NUM\" >/dev/null"); system("ifconfig $DEV hw ether $MAC"); - system("ifconfig $DEV $ADR netmask $MSK broadcast $BRD"); + system("ifconfig $DEV $ADR netmask $MSK broadcast $BRD -arp"); system("start-stop-daemon --start --quiet --pidfile /var/run/$NAME.$_[0].pid --exec $DAEMON -- -n $_[0] $EXTRA"); } @@ -111,7 +98,7 @@ sub vpn_start { ############################################################################## # vpn_stop () Stops specified VPN # -# $1 ... VPN to stop +# $_[0] ... VPN to stop sub vpn_stop { vpn_load($_[0]) || return 1;