/[cvs]/eggdrop1.7/misc/addpatch
ViewVC logotype

Contents of /eggdrop1.7/misc/addpatch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Mon Nov 20 13:53:32 2006 UTC (12 years, 11 months ago) by tothwolf
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -2 lines
* Updated copyright dates for 2006 (better late than never).

1 #! /bin/sh
2 #
3 # addpatch - modifies src/patch.h
4 #
5 # Copyright (C) 2002 - 2006 Eggheads Development Team
6 # Copyright (C) 2000 Fabian Knittel <fknittel@gmx.de>
7 #
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26 #
27 # $Id: addpatch,v 1.3 2005/01/21 01:43:38 wcc Exp $
28
29 show_usage() {
30 echo "Usage: `basename $0` [-hs] <patchname> [unixtime]"
31 echo ""
32 echo " patchname - Name of last patch added."
33 echo " unixtime - Some unixtime number or 'now'. Default is 'now'."
34 echo ""
35 echo " -h, --help - Print this help and exit."
36 echo " -s, --show - Print current patch name and exit."
37 exit 1
38 }
39
40 if test "x${1}" = "x" || test "x${1}" = "x-h" || test "x${1}" = "x--help"; then
41 show_usage
42 else
43 patch_name=$1
44 fi
45
46 if test ! -f src/main.c; then
47 echo "You are not in the Eggdrop root directory."
48 exit 1
49 fi
50
51 oldpatch_name=`cat src/patch.h | grep -E '^patch.*\);$'| awk '-F"' '{ print $2 }'`
52
53 if test "x${oldpatch_name}" = "x"; then
54 oldpatch_name='(could not detect)'
55 fi
56
57 if test "x${1}" = "x-s" || test "x${1}" = "x--show"; then
58 echo ${oldpatch_name}
59 exit
60 fi
61
62 if test "x${2}" = "x" || test "$unix_time" = now; then
63 unix_time=`date +%s`
64 else
65 unix_time=$2
66 fi
67
68 echo "Unixtime: ${unix_time}"
69 echo "Current patch: ${oldpatch_name}"
70 echo "New patch: ${patch_name}"
71
72 if sed -e "s/^patch.*\")\(.*current unixtime.*\)/patch(\"${unix_time}\")\1/" -e "s/^patch.*);$/patch(\"${patch_name}\");/" src/patch.h > src/patch.h_; then
73 mv src/patch.h_ src/patch.h
74 if test "${oldpatch_name}" = "${patch_name}"; then
75 echo "Successful: yes (no name change)"
76 else
77 echo "Successful: yes"
78 fi
79
80 else
81 echo "Successful: no"
82 exit 1
83 fi

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23