~samiam/MaraDNS

ref: 3.5.0021 MaraDNS/deadwood-github/update/3.1.02/3.1.01-to-3.1.02 -rwxr-xr-x 3.7 KiB
ca00f282 — Sam Trenholme MaraDNS release 3.5.0021 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh -e

# The revision number; in the case of having multiple snapshots a day,
# the revision number can be incremented so as to minimize confusion
# This is only done when more than one snapshop is uploaded to the
# maradns.org server in a given day.  Here at the top to be easy to change.
REVISION=1

# This script updates Deadwood 3.0

# To run this script, make sure that this script is in the directory
# containing the tarball for the version of Deadwood you wish to update, and
# all of the patches are in a directory entitled 'patches'.

CURRENT=${0%%-*}
CURRENT=${CURRENT##*/}
NEXT=${0##*-}

# Make a clean CURRENT install, which we rename NEXT
rm -fr deadwood-$CURRENT 2> /dev/null
rm -fr deadwood-$NEXT 2> /dev/null
echo extracting tarball
tar xjf deadwood-$CURRENT.tar.bz2
if [ $? != 0 ] ; then
	echo run this from the correct directory
	exit 1
fi
rm -fr deadwood-$NEXT*
mv deadwood-$CURRENT deadwood-$NEXT
cd deadwood-$NEXT

# The patches

mkdir update/$NEXT
if [ "$1" != "new" ] ; then
	cp ../patches/deadwood-$CURRENT* update/$NEXT
	#cp ../patches/maradns* update/$NEXT
	#echo
fi

# This is one of the few places where we will need to change anything
# in this script from version to version

echo applying patches

# Regenerate Deadwood's random prime number (always done)
echo Making new random prime
cd src
rm -f *orig # While we're here, remove any pesky .orig files
cc -o foo RandomPrime.c
./foo > DwRandPrime.h
rm foo
cd ..

# BEGIN Release-specific fixes and changes go here

# HOTFIX: Fix crashes while resolving queries
patch -p1 < update/$NEXT/deadwood-3.1.01-crash_hotfix.patch

# Since we're making a lot of changes to the code to speed up recursion,
# we make .orig files of all source files to make patching easier
if [ "$1" = "work" ] ; then 
	cd src
	for a in *.c *.h ; do
		cp $a $a.orig
	done
	cd ..
	cp doc/Deadwood.ej doc/Deadwood.ej.orig
fi

# END Release-specific fixes/changes

# Convert tabs in code to spaces, since this is inconsistant in different
# programs; disable when in "work" mode since it messes up patches
if [ "$1" != "work" ] ; then 
	echo removing tabs from source files
	for a in $( find . -type f -name \*.[ch] ) ; do 
		col -x < $a > foo
		mv foo $a
	done
fi
chmod 755 src/make.version.h

echo updating documentation
# Update the documentation
cd doc
make
# Go back to the deadwood dir
cd ..

# Go one level higher than the toplevel directory to copy this script
# over
cd ..

# Put this script in the "build" directory
cp $0 deadwood-$NEXT/update/$NEXT

# Version number always current
cd deadwood-$NEXT/src
./make.version.h > version.h
cd ../..

if [ "$1" = "new" ] ; then
	tar xjf deadwood-$CURRENT.tar.bz2
	echo OK, both deadwood-$CURRENT and deadwood-$NEXT made\; you
	echo now can start making patches.
	exit 0
fi

if [ "$1" != "go" ] && [ "$1" != "snap" ] && [ "$1" != "work" ] ; then
	echo OK, deadwood-$NEXT built.  Confirm this compiles and	
	echo perform basic regression before re-running this to make
	echo the tarballs.  Once you have tested this, rerun this 
	echo script as: \"$0 go\" or as \"$0 snap\" 
        echo to make a daily snapshot
	exit 0
fi

if [ "$1" = "work" ] ; then
	tar xjf deadwood-$CURRENT.tar.bz2
	echo OK, both deadwood-$CURRENT and deadwood-$NEXT made\; you
	echo now can make more patches as needed.  
	cd deadwood-$NEXT/src
	echo '#define VERSION "'$NEXT'-pre"' > version.h
	cd ../..
	exit 0
fi

# Build the tarballs
echo making new tarballs

if [ "$1" = "snap" ] ; then
	SNAP=S-$( date +%Y%m%d )-$REVISION
	rm -fr deadwood-$SNAP
	mv deadwood-$NEXT deadwood-$SNAP
	cd deadwood-$SNAP/src
	./make.version.h > version.h
	cd ../..
	tar cjf deadwood-$SNAP.tar.bz2 deadwood-$SNAP
	exit 0
else
	SNAP=$NEXT
	cd deadwood-$SNAP/src
	./make.version.h > version.h
	cd ../..
	tar cjf deadwood-$SNAP.tar.bz2 deadwood-$SNAP
fi

exit 0 # Done