diff options
| author | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-07-19 14:08:30 +0000 |
|---|---|---|
| committer | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-07-19 14:08:30 +0000 |
| commit | a1479a87757fb5e9b48f3c8bb5dd9cc247406f1a (patch) | |
| tree | 06d23a51082a398c512ed8f1e39bdac60d4dd658 /src | |
| parent | 7fffea77edbe72cd66f7a55f41a3966204f9cf86 (diff) | |
BUILD : 1.7.4 (264) BUGS : N/A NOTES : Switched to autoconf - try to commit part 1
git-svn-id: svn://svn.anope.org/anope/trunk@264 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@169 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 107 | ||||
| -rw-r--r-- | src/actions.c | 95 | ||||
| -rwxr-xr-x | src/bin/am | 420 | ||||
| -rwxr-xr-x | src/bin/anoperc | 136 | ||||
| -rwxr-xr-x | src/bin/cp-recursive | 21 | ||||
| -rwxr-xr-x | src/bin/langtool | 239 | ||||
| -rwxr-xr-x | src/bin/mydbgen | 207 | ||||
| -rwxr-xr-x | src/bin/register | 101 | ||||
| -rw-r--r-- | src/botserv.c | 2593 | ||||
| -rw-r--r-- | src/channels.c | 1633 | ||||
| -rw-r--r-- | src/chanserv.c | 6257 | ||||
| -rw-r--r-- | src/commands.c | 178 | ||||
| -rw-r--r-- | src/compat.c | 212 | ||||
| -rw-r--r-- | src/config.c | 1333 | ||||
| -rw-r--r-- | src/converter.c | 398 | ||||
| -rw-r--r-- | src/datafiles.c | 510 | ||||
| -rw-r--r-- | src/encrypt.c | 434 | ||||
| -rw-r--r-- | src/helpserv.c | 83 | ||||
| -rw-r--r-- | src/hostserv.c | 1107 | ||||
| -rw-r--r-- | src/init.c | 849 | ||||
| -rw-r--r-- | src/language.c | 265 | ||||
| -rw-r--r-- | src/list.c | 178 | ||||
| -rw-r--r-- | src/log.c | 298 | ||||
| -rw-r--r-- | src/mail.c | 246 | ||||
| -rw-r--r-- | src/main.c | 537 | ||||
| -rw-r--r-- | src/memory.c | 96 | ||||
| -rw-r--r-- | src/memoserv.c | 1382 | ||||
| -rw-r--r-- | src/messages.c | 1284 | ||||
| -rw-r--r-- | src/misc.c | 711 | ||||
| -rw-r--r-- | src/modules.c | 2023 | ||||
| -rw-r--r-- | src/modules/Makefile | 32 | ||||
| -rw-r--r-- | src/modules/README | 1 | ||||
| -rwxr-xr-x | src/modules/compile.sh | 37 | ||||
| -rwxr-xr-x | src/modules/configure | 21 | ||||
| -rw-r--r-- | src/modules/hs_moo.c | 104 | ||||
| -rw-r--r-- | src/modules/ircd_catserv.c | 128 | ||||
| -rw-r--r-- | src/modules/module.h | 9 | ||||
| -rw-r--r-- | src/mysql.c | 1638 | ||||
| -rw-r--r-- | src/news.c | 541 | ||||
| -rw-r--r-- | src/nickserv.c | 4169 | ||||
| -rw-r--r-- | src/operserv.c | 5064 | ||||
| -rw-r--r-- | src/process.c | 268 | ||||
| -rw-r--r-- | src/protocol.c | 168 | ||||
| -rw-r--r-- | src/proxy.c | 797 | ||||
| -rw-r--r-- | src/rdb.c | 466 | ||||
| -rw-r--r-- | src/send.c | 240 | ||||
| -rw-r--r-- | src/servers.c | 259 | ||||
| -rw-r--r-- | src/sessions.c | 834 | ||||
| -rw-r--r-- | src/slist.c | 325 | ||||
| -rw-r--r-- | src/sockutil.c | 549 | ||||
| -rw-r--r-- | src/timeout.c | 130 | ||||
| -rw-r--r-- | src/users.c | 1161 | ||||
| -rw-r--r-- | src/vsnprintf.c | 518 |
53 files changed, 41392 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 000000000..6b77b5bcf --- /dev/null +++ b/src/Makefile @@ -0,0 +1,107 @@ +MYSQL_OBJ = $(MYSQL:.c=.o) +RDB_OBJ = $(RDB:.c=.o) +OBJS = actions.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \ + config.o datafiles.o encrypt.o helpserv.o hostserv.o init.o language.o list.o log.o mail.o main.o \ + memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \ + process.o protocol.o proxy.o send.o servers.o sessions.o slist.o sockutil.o \ + timeout.o users.o \ + $(VSNPRINTF_O) $(RDB_OBJ) $(MYSQL_OBJ) +SRCS = actions.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \ + config.c datafiles.c encrypt.c helpserv.c hostserv.c init.c language.c list.c log.c mail.c main.c \ + memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \ + process.c protocol.c proxy.c send.c servers.c sessions.c slist.c sockutil.c \ + timeout.c users.c \ + $(VSNPRINTF_C) $(RDB) $(MYSQL) + +INCLUDES = ../include/commands.h ../include/defs.h ../include/language.h \ + ../include/pseudo.h ../include/sysconf.h ../include/config.h \ + ../include/encrypt.h ../include/messages.h ../include/services.h \ + ../include/timeout.h ../include/datafiles.h ../include/extern.h \ + ../include/modules.h ../include/slist.h ../include/version.h + +MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \ + 'LDFLAGS=${LDFLAGS}' 'BINDEST=${BINDEST}' 'INSTALL=${INSTALL}' \ + 'INCLUDEDIR=${INCLUDEDIR}' 'RM=${RM}' 'CP=${CP}' \ + 'TOUCH=${TOUCH}' 'SHELL=${SHELL}' 'DATDEST=${DATDEST}' \ + 'RUNGROUP=${RUNGROUP}' 'MODULE_PATH=${MODULE_PATH}' 'MYSQL=${MYSQL}'\ + 'RDB=${RDB}' + +.c.o: + $(CC) $(CFLAGS) -I../include/ -c $< + +all: services + +services: $(OBJS) + $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(ELIBS) + +$(OBJS): Makefile +actions.o: actions.c $(INCLUDES) +botserv.o: botserv.c $(INCLUDES) +channels.o: channels.c $(INCLUDES) +chanserv.o: chanserv.c $(INCLUDES) +commands.o: commands.c $(INCLUDES) +compat.o: compat.c $(INCLUDES) +config.o: config.c $(INCLUDES) +converter.o: converter.c $(INCLUDES) +datafiles.o: datafiles.c $(INCLUDES) +encrypt.o: encrypt.c $(INCLUDES) +init.o: init.c $(INCLUDES) +hostserv.o: hostserv.c $(INCLUDES) +language.o: language.c $(INCLUDES) +list.o: list.c $(INCLUDES) +log.o: log.c $(INCLUDES) +mail.o: mail.c $(INCLUDES) +main.o: main.c $(INCLUDES) +memory.o: memory.c $(INCLUDES) +memoserv.o: memoserv.c $(INCLUDES) +messages.o: messages.c $(INCLUDES) +misc.o: misc.c $(INCLUDES) +news.o: news.c $(INCLUDES) +nickserv.o: nickserv.c $(INCLUDES) +operserv.o: operserv.c $(INCLUDES) +process.o: process.c $(INCLUDES) +protocol.o: protocol.c $(INCLUDES) +proxy.o: proxy.c $(INCLUDES) +send.o: send.c $(INCLUDES) +sessions.o: sessions.c $(INCLUDES) +slist.o: slist.c $(INCLUDES) +sockutil.o: sockutil.c $(INCLUDES) +timeout.o: timeout.c $(INCLUDES) +users.o: users.c $(INCLUDES) +vsnprintf.o: vsnprintf.c $(INCLUDES) +mysql.o: mysql.c $(INCLUDES) +rdb.o: rdb.c $(INCLUDES) + +modules: DUMMY + (cd modules ; ./configure ; ${MAKE} ${MAKEARGS} all) + +clean: + (cd modules ; ${MAKE} ${MAKEARGS} clean) + rm -f *.o services a.out + +install: services + test -d ${BINDEST} || mkdir ${BINDEST} + $(INSTALL) services $(BINDEST)/services + $(INSTALL) bin/anoperc $(BINDEST)/anoperc + rm -f $(BINDEST)/listnicks $(BINDEST)/listchans + ln $(BINDEST)/services $(BINDEST)/listnicks + ln $(BINDEST)/services $(BINDEST)/listchans + (cd ../lang ; $(MAKE) install) + $(CP) ../data/* $(DATDEST) + test -d $(DATDEST)/backups || mkdir $(DATDEST)/backups + test -d $(DATDEST)/logs || mkdir $(DATDEST)/logs + @if [ "$(MODULE_PATH)" ] ; then \ + test -d ${MODULE_PATH} || mkdir ${MODULE_PATH} ; \ + test -d ${MODULE_PATH}/runtime || mkdir ${MODULE_PATH}/runtime ; \ + (cd modules ; $(MAKE) install) ; \ + fi + @if [ "$(RUNGROUP)" ] ; then \ + echo chgrp -R $(RUNGROUP) $(DATDEST) ; \ + chgrp -R $(RUNGROUP) $(DATDEST) ; \ + echo chmod -R g+rw $(DATDEST) ; \ + chmod -R g+rw $(DATDEST) ; \ + echo find $(DATDEST) -type d -exec chmod g+xs \'\{\}\' \\\; ; \ + find $(DATDEST) -type d -exec chmod g+xs '{}' \; ; \ + fi + +DUMMY: diff --git a/src/actions.c b/src/actions.c new file mode 100644 index 000000000..cb7fd0851 --- /dev/null +++ b/src/actions.c @@ -0,0 +1,95 @@ +/* Various routines to perform simple actions. + * + * (C) 2003 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ + +#include "services.h" + +/*************************************************************************/ + +/* Note a bad password attempt for the given user. If they've used up + * their limit, toss them off. + */ + +void bad_password(User * u) +{ + time_t now = time(NULL); + + if (!BadPassLimit) + return; + + if (BadPassTimeout > 0 && u->invalid_pw_time > 0 + && u->invalid_pw_time < now - BadPassTimeout) + u->invalid_pw_count = 0; + u->invalid_pw_count++; + u->invalid_pw_time = now; + if (u->invalid_pw_count >= BadPassLimit) + kill_user(NULL, u->nick, "Too many invalid passwords"); +} + +/*************************************************************************/ + +void change_user_mode(User * u, char *modes, char *arg) +{ +#ifndef IRC_HYBRID + int ac = 1; + char *av[2]; + + av[0] = modes; + if (arg) { + av[1] = arg; + ac++; + } +#ifdef IRC_BAHAMUT + send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, u->timestamp, + av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); +#else + send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], + (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); +#endif + set_umode(u, ac, av); +#endif +} + +/*************************************************************************/ + +/* Remove a user from the IRC network. `source' is the nick which should + * generate the kill, or NULL for a server-generated kill. + */ + +void kill_user(const char *source, const char *user, const char *reason) +{ +#ifdef IRC_BAHAMUT + /* Bahamut uses SVSKILL as a better way to kill users. It sends back + * a QUIT message that Anope uses to clean up after the kill is done. + */ + send_cmd(NULL, "SVSKILL %s :%s", user, reason); +#else + char *av[2]; + char buf[BUFSIZE]; + + if (!user || !*user) + return; + if (!source || !*source) + source = ServerName; + if (!reason) + reason = ""; + snprintf(buf, sizeof(buf), "%s (%s)", source, reason); + av[0] = sstrdup(user); + av[1] = buf; + send_cmd(source, "KILL %s :%s", user, av[1]); + do_kill(source, 2, av); + free(av[0]); +#endif +} + +/*************************************************************************/ diff --git a/src/bin/am b/src/bin/am new file mode 100755 index 000000000..14b6d8638 --- /dev/null +++ b/src/bin/am @@ -0,0 +1,420 @@ +#!/usr/bin/env perl + +# ==================================================================== +# anomgr: Anope Manager. Used to manage anope revision on SubVersion. +# +# For usage, see the usage subroutine or run the script with no +# command line arguments. +# +# $Id$ +# +# ==================================================================== +require 5.6.0; +use strict; +use Getopt::Std; +use Net::FTP; +use Cwd; + +###################################################################### +# Configuration section. +my $myver="1.0"; +my $svnrev="http://www.zero.org/anosvn.php"; +my $fhint="version.log"; + +# Default values, change or use environment variables instead. +my $copy="anope"; +my $svnuser=""; +my $svnpath="/usr/bin"; +my $svnroot="svn://zero.org/repos/$copy"; +my $editor="/usr/bin/vi"; + +# Environment variables SVNBINDIR and SVNROOT override the above +# hardcoded values. +$svnuser="$ENV{SVNUSER}" if ($ENV{SVNUSER}); +$svnpath="$ENV{SVNBINDIR}" if ($ENV{SVNBINDIR}); +$svnroot="$ENV{SVNROOT}" if ($ENV{SVNROOT}); +$editor="$ENV{EDITOR}" if ($ENV{EDITOR}); + +# Svnlook path. +my $svnlook = "$svnpath/svnlook"; + +# Svn path. +my $svn = "$svnpath/svn"; + +# wget path. Need to change to a perl module instead... +my $wget = "$svnpath/wget"; + +my ( + $rev, + $branch, + $tag, + $ftp, + $dst, + $ver_major, + $ver_minor, + $ver_patch, + $ver_build, + $ver_revision, + $ver_comment, + $svn_comment, + $cver, + $nver, + $ctrlfile, + $tmpfile, + @source, + %opt +); + +{ + my $ok = 1; + foreach my $program ($svnlook, $svn, $editor) + { + if (-e $program) + { + unless (-x $program) + { + warn "$0: required program `$program' is not executable, ", + "edit $0.\n"; + $ok = 0; + } + } + else + { + warn "$0: required program `$program' does not exist, edit $0.\n"; + $ok = 0; + } + } + exit 1 unless $ok; +} + +sub usage() +{ + # More features to add: + # --diff N:M to produce a diff between revisions + # --bugs CLI method to add bug number to the commit message + # --mesg CLI methos to add the commit message + # --create-branch to create a branch + # --create-tag to create a tag + # --switch to switch between branches/tags + print "Usage: $0 <-g | -p | -f> [-r revision | -b branch | -t tag] <destination>\n"; + print " Operations:\n"; + print " -g Get Operation\n"; + print " -p Put Operation\n"; + print " -f[tar|diff] FTP Operation, retrieve latest tar or diff\n"; + print " Selector:\n"; + print " -r revision Retrieve by revision number\n"; + print " -b branch Retrieve by branch name\n"; + print " -t tag Retrieve by tag name\n"; + print " Destination:\n"; + print " The working copy to perform the operation in or to. The script will \n"; + print " try to guess where that is, unless you provide a specific path.\n"; + exit; +} + +sub banner() { + + print "Anope Source Managemnt Utility - Version $myver\n\n"; + +} + +sub getans { + my $ans; + while (! (($ans =~ /y/) || ($ans =~ /n/))) { + print "*** Ready to continue? (y/n): "; + $ans = <STDIN>; + chomp($ans); + $ans = lc($ans); + # $ans = &getans(); + } + + # return $ans; + return ($ans eq "y") ? 1 : 0 +} + +sub find_conflict() { + + my $filename=shift; + my $retval=0; + open (IN2, "$filename") || die "Can't open $filename\n"; + while (<IN2>) { + if (/^<<<<<<</) { + $retval=1; + } + } + close(IN2); + + return $retval; +} + +sub do_ftp() { + + my $ftpc; + $ftpc = Net::FTP->new("ftp.zero.org"); + $ftpc->login("ftp","-anonymou@"); + $ftpc->cwd("/incoming"); + + if ( lc($ftp) eq "tar" ) { + print "Retrieving latest tar ball...\n"; + $ftpc->get("anope.tgz"); + } elsif ( lc($ftp) eq "diff" ) { + print "Retrieving latest patch file...\n"; + $ftpc->get("anope.diff"); + } else { + print "Unknown type $ftp, aborting...\n"; + } + $ftpc->quit(); +} + +sub do_get() { + + my $options = "" ; # Options to be passed to the svn command + my $selector = "" ; # Selector to be passed to the svn command + + if ($rev) { + $options .= "-r $rev"; + $selector = "trunk"; + $copy = $copy . "-$rev"; + } elsif ($tag) { + $selector = "tags/$tag"; + $copy = $copy . "-$tag"; + } elsif ($branch) { + $selector = "branches/$branch"; + $copy = $copy . "-$branch"; + } else { + $selector = "trunk"; + } + + if ($dst eq undef) { + my $cwd = &Cwd::cwd(); + if (-f "$cwd/$fhint") { + system("$svn update $options $cwd"); + } elsif (-f "$cwd/$copy/$fhint") { + system("$svn update $options $cwd/$copy"); + } else { + system("$svn checkout $svnroot/$selector $options $cwd/$copy"); + } + } else { + $dst = &Cwd::cwd() if ($dst eq "\.") ; + if (-f "$dst/$fhint") { + system("$svn update $options $dst"); + } else { + system("$svn checkout $svnroot/$selector $options $dst"); + } + } +} + +sub do_put() { + + if ($dst eq undef) { + my $cwd = &Cwd::cwd(); + if (-f "$cwd/$fhint") { + $dst = "$cwd"; + } elsif (-f "$cwd/$copy/$fhint") { + $dst .= "$cwd/$copy"; + } else { + print "Error: Unable to determine your working copy location.\n"; + exit; + } + } else { + $dst = &Cwd::cwd() if ($dst eq "\.") ; + if (! -f "$dst/$fhint") { + print "Error: Unable to determine your working copy location.\n"; + exit; + } + } + + # Check to see if we need to update our working copy first. + my $nupdate; + open (IN, "$svn status --show-updates --verbose $dst|"); + while (<IN>) { + if (/\*/) { + $nupdate .= "$_"; + } + } + close(IN); + + if ($nupdate ne undef) { + print "*** Warning: There are files modified in the repository that need\n"; + print "*** to be merged back to your working copy before the commit can\n"; + print "*** take place. These files are:\n"; + print $nupdate; + print "Please use: $0 -g $dst\n"; + exit; + } + + # Get a prelim diff of the changes... + my $dcount=0; + my $conflict; + # open (IN, "$svn diff $dst|"); + open (IN, "$svn status $dst|"); + while (<IN>) { + if (!/^\?/) { + $dcount++; + } + + if (/^C/) { + $_ =~ s/^C\s+//; + chomp($_); + # I don't want to use grep. But my find_conflict sub + # does not seem to work :( Too bad + if (`grep "^<<<<<<<" $_`) { + $conflict .= "$_\n" ; + } else { + system("$svn resolved $_"); + } + } + } + close(IN); + + if ($dcount == 0) { + print "*** Warning: There are no modified files to be commited. Are you\n"; + print "*** sure you are in the right working copy? Verify changes with:\n"; + print "*** $svn diff $dst\n"; + exit; + } + + if ($conflict ne undef) { + print "*** Warning: There are merge conflicts to be resolved! Please take\n"; + print "*** a look at the following files and resolve them manually:\n\n"; + print "$conflict\n"; + exit; + } + + $ctrlfile = "$dst/$fhint"; + # Grab the current revision number. Clunky way, I know! + $ver_revision=`$wget -qO - $svnrev`; + chomp($ver_revision); + + unless ($ver_revision =~ /^\d+/ and $ver_revision > 0) + { + print "*** Error: Got bogus result $ver_revision from $svnrev.\n"; + exit; + } + + $ver_revision++; + open (REV, "$ctrlfile") || die "Can't open $ctrlfile\n"; + while (<REV>) { + push (@source, $_); + $ver_major = $_ if (/VERSION_MAJOR/); + $ver_minor = $_ if (/VERSION_MINOR/); + $ver_patch = $_ if (/VERSION_PATCH/); + $ver_build = $_ if (/VERSION_BUILD/); + } + close(REV); + + my $junk; + ($junk, $ver_major) = split('"', $ver_major); + ($junk, $ver_minor) = split('"', $ver_minor); + ($junk, $ver_patch) = split('"', $ver_patch); + ($junk, $ver_build) = split('"', $ver_build); + + $cver = "$ver_major.$ver_minor.$ver_patch ($ver_build)"; + $nver = "$ver_major.$ver_minor.$ver_patch ($ver_revision)"; + + # Greet the developer + banner(); + print "*** Repository : $svnroot \n"; + print "*** Working copy : $dst \n" ; + print "*** Current ver. : $cver \n"; + print "*** Updated ver. : $nver \n"; + print "*** Files Changed: $dcount (before indent and version change)\n"; + die ("Aborting...\n") unless &getans(); + + # Need to add a clause for -c "comment" and -b "buglist" + + # Get developers input for commit + $tmpfile=".commit"; + open (OUT, ">$tmpfile") or die ("*** Error! Unable to open $tmpfile file\n"); + print OUT "# Anope commit utility. Please use this template for your commits. +# Add Bugzilla bugs separated by spaces. The note part is free form. +BUILD : $nver +BUGS : +NOTES : "; + close(OUT); + + system("$editor $tmpfile"); + + my $tmp_comment=""; + $ver_comment="#\n"; + $svn_comment=""; + open (IN, "$tmpfile") or die ("*** Error! Unable to open $tmpfile file\n"); + while (<IN>) { + if ( !/^#/) { + $tmp_comment.="$_"; + chomp($_); + $_ =~ s/\t/ /g; + $ver_comment.="# $_\n"; + $svn_comment.="$_ "; + } + } + close(IN); + + $svn_comment =~ s/\s\s+/ /g; + # Confirm the commit one last time... + print "*** Ready to commit, please verify:\n"; + print "\n$tmp_comment\n"; + + die ("Aborting...\n") unless &getans(); + + print "*** Running Indent...\n"; + system("indent -kr -nut *.c"); + system("rm -f *~"); + + print "*** Bumping the revision number...\n"; + # Re-write the control file + open(OUT, ">$ctrlfile") or die ("*** Error! Unable to open $ctrlfile ... aborting"); + foreach (@source) { + if (/^VERSION_BUILD/) { + $_ =~ s/\"\d+\"/\"$ver_revision\"/; + } elsif (/# \$Log\$/) { + $_ .= "$ver_comment"; + } + print OUT $_; + } + close(OUT); + + print "*** Starting the upload...\n\n"; + my $rval=system("$svn commit $dst --username='$svnuser' --message '$svn_comment'"); + if ( $rval ) { + print "*** Error: Unable to complete commit. Rolling back....\n\n"; + system("$svn revert $ctrlfile"); + } + +} + +{ + usage() if (! @ARGV); + + my $opt = 'hgpf:r:b:t:'; + getopts ("$opt", \%opt) or usage(); + usage() if $opt{h}; + + usage() if ($opt{g} && $opt{p}); + usage() if ($opt{g} && $opt{f}); + usage() if ($opt{p} && $opt{f}); + usage() if ($opt{r} && $opt{b}); + usage() if ($opt{r} && $opt{t}); + usage() if ($opt{b} && $opt{t}); + + $rev = $opt{r} ; + $branch = $opt{b} ; + $tag = $opt{t} ; + $ftp = $opt{f} ; + $dst = shift; + + if ($rev ne undef) { + unless ($rev =~ /^\d+/ and $rev > 0) + { + print "*** Error: Revision number '$rev' must be an integer > 0.\n"; + exit; + } + } + + do_ftp() if $opt{f}; + do_get() if $opt{g}; + do_put() if $opt{p}; + print "*** Done!\n"; + +} + + diff --git a/src/bin/anoperc b/src/bin/anoperc new file mode 100755 index 000000000..bc0704f12 --- /dev/null +++ b/src/bin/anoperc @@ -0,0 +1,136 @@ +#!/bin/sh + +############################################### +# Set Variables +############################################### + +# PID FILE NAME (e.g. services.pid) +PIDFILE="services.pid" + +# FULL PATH TO ANOPE DIRECTORY e.g. /home/ribosome/services/ +# YOU MUST INCLUDE TRAILING SLASH +ANOPEBIN="" + +# SERVICES EXECUTABLE NAME (e.g. services) +ANOPROG="services" + +# SCRIPT VERSION NUMBER (DO NOT ALTER) +ARCVERSION="1.1" + + +################################################ +# END OF CONFIGURATION +# YOU ARE NOT REQUIRED TO CHANGE ANYTHING BELOW +################################################ + +isAnopeRunning () { +if [ ! -f $ANOPEBIN$PIDFILE ] ; then + echo "Warning: Anope is not currently running" + exit 1 +fi + +PID=`cat $ANOPEBIN$PIDFILE` + +if [ ! `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` ] ; then + echo "Warning: Anope is not currently running" + exit 1 +fi +} + +if [ "$ANOPEBIN" = "" ] ; then + echo "Error: Please open this file set the variables correctly"; + exit 1 +fi + +if [ ! -f $ANOPEBIN$ANOPROG ] ; then + echo "Error: $ANOPEBIN$ANOPROG cannot be accessed" + exit 1 +fi + +if [ "$1" = "start" ] ; then + +if [ -f $ANOPEBIN$PIDFILE ] ; then + PID=`cat $ANOPEBIN$PIDFILE` + if [ `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` = 1 ] ; then + echo "Warning! Anope is already running" + exit 1 + fi +fi + echo "Starting Anope" + shift + $ANOPEBIN$ANOPROG $* + sleep 1 + if [ ! -f $ANOPEBIN$PIDFILE ] ; then + echo "Unfortunately it seems Anope did not start successfully" + echo "This error has been logged in your Anope Log file" |
