annotate bin/makemotd @ 12:8f2256d473fb

Empty changelog
author darius
date Sat, 06 Dec 1997 05:10:46 +0000
parents 4d6502ffaa5e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
1 #!/bin/sh
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
2 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
3 # generates a motd with highscores
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
4 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
5 # first argument is the old playerfile, if a second argument exists it is
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
6 # assumed to be NETREKDIR.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
7 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
8 # NOTE: the Old playerfile is assumed to be a gzipped file! This is because
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
9 # the dbbackup script gzips it.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
10 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
11
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
12 if [ $# -eq 0 ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
13 echo "Syntax: '$0 <old player file> [NETREKDIR]'"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
14 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
15 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
16 OLDPLAYERS=$1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
17 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
18
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
19 if [ X$2 != X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
20 NETREKDIR=$2
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
21 elif [ X${NETREKDIR} = X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
22 if [ -f "../etc/conf.netrekdir" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
23 NETREKDIR=`cat "../etc/conf.netrekdir"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
24 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
25 echo "No NETREKDIR variable found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
26 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
27 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
28 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
29
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
30 if [ ! -f ${NETREKDIR}/bin/hs ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
31 echo "$0: Highscores program not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
32 echo "$0: (expecting: ${NETREKDIR}/bin/hs)"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
33 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
34 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
35
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
36 if [ ! -f ${NETREKDIR}/bin/hr ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
37 echo "$0: Honorroll program not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
38 echo "$0: (expecting: ${NETREKDIR}/bin/hr)"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
39 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
40 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
41
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
42 if [ ! -f ${NETREKDIR}/${OLDPLAYERS} ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
43 echo "$0: Old player db not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
44 echo "$0: (expecting: ${NETREKDIR}/${OLDPLAYERS})"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
45 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
46 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
47 echo -n "$0: Unzipping ${NETREKDIR}/${OLDPLAYERS}..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
48 gzip -d ${NETREKDIR}/${OLDPLAYERS}
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
49 echo "Done."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
50 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
51
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
52 if [ ! -f ${NETREKDIR}/etc/motd.body ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
53 echo "$0: \"motd.body\" file not found, exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
54 echo "$0: (expecting: ${NETREKDIR}/etc/motd.body)"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
55 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
56 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
57
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
58 exit
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
59
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
60 cat ${NETREKDIR}/etc/motd.body > ${NETREKDIR}/etc/motd
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
61 echo "Scores last updated: `date`" >> motd
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
62 ${NETREKDIR}/bin/hs -n 35 -c 0 ${NETREKDIR}/${OLDPLAYERS} ${NETREKDIR}/etc/db.players >> ${NETREKDIR}/etc/motd
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
63 ${NETREKDIR}/bin/hr 120 -m -f ${NETREKDIR}/etc/db.players >> ${NETREKDIR/etc/motd
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
64
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
65 echo -n "$0: gzipping ${NETREKDIR}/${OLDPLAYERS}..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
66 gzip -9 ${NETREKDIR}/${OLDPLAYERS}
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
67 echo "Done."