File: update-cd

package info (click to toggle)
debian-cd 2.2.13
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,480 kB
  • ctags: 120
  • sloc: sh: 1,666; perl: 1,078; makefile: 832
file content (221 lines) | stat: -rwxr-xr-x 5,634 bytes parent folder | download
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#!/bin/sh
#
# $Id: update-cd,v 1.5 2001/12/16 23:22:11 93sam Exp $
# 
# (c) Steve McIntyre <stevem@chiark.greenend.org.uk> Released under
# GNU GPL v2 1st January 2001
#
# Quick and dirty script to create update CDs for people to upgrade
# from potato (2.2r0) to the latest release level
#
# Configuration goes here.
# Where is your mirror?
MIRROR=${MIRROR:-/mirror/debian}

# If you have a non-US mirror, where is it? Leave blank if you don't have one.
NONUS=${NONUS:-$MIRROR/non-US}

# Do you want non-free? 1 for yes, 0 for no
NONFREE=1

# What release version is this?
VER=2.2r4

# Path to use with mkisofs/mkhybrid
MKISOFS=${MKISOFS:-"mkhybrid"}

# The working directory to use. MUST be on the same partition as the mirror.
TDIR=/mirror/debian-cd

# Building potato cd set ...
CODENAME=potato

# Path where the images will be written
OUT=/mirror/debian-cd

# Location of the diff file to use to determine the changes. If you leave
# this blank, we'll try to determine the changes from the ChangeLog files,
# which is probably less accurate. 
DIFF=/mirror/lists/r0-r4.diff #~/r2.diff

REL=Debian"$VER"
CLOG=dists/potato/ChangeLog
NUCLOG=dists/potato/non-US/ChangeLog
UPD=$TDIR/potato-update
DATE=`date +%Y%m%d`
BASEDIR=`pwd`
INFO1="Debian GNU/Linux $VER Update CD $DATE for Alpha, Arm and i386"
INFO2="Debian GNU/Linux $VER Update CD $DATE for M68k, PowerPC and Sparc"
INFO3="Debian GNU/Linux $VER Update CD $DATE source"
ARCH1="alpha arm i386"
ARCH2="m68k powerpc sparc"

export TDIR NONFREE NONUS VER MIRROR CODENAME OUT BASEDIR

scanpackages=$BASEDIR/tools/scanpackages.old
scansources=$BASEDIR/tools/scansources.old
set_mkisofs_opts=$BASEDIR/tools/set_mkisofs_opts
adddirs=$BASEDIR/tools/add_dirs
addfiles=$BASEDIR/tools/add_files

echo Cleaning up
rm -rf $UPD
mkdir $UPD $UPD/CD1 $UPD/CD2 $UPD/CD3

echo Creating directory trees
for ARCH in $ARCH1
do
	export ARCH
	$adddirs $UPD/CD1
done

for ARCH in $ARCH2
do
	export ARCH
	$adddirs $UPD/CD2
done

$adddirs $UPD/CD3

cd $MIRROR

echo Creating main-section list

if [ -e $DIFF ] ; then
	grep -v non-US $DIFF >$UPD/list
	egrep -e \\.deb$ $UPD/list >$UPD/bin-list
	egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $UPD/list >$UPD/src-list
else
	egrep -e ^dists.*\\.deb$ $CLOG >$UPD/bin-list
	egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $CLOG >$UPD/src-list
fi
if [ "$NONFREE"x != "1"x ] ; then
	echo Removing non-free
	grep -v non-free $UPD/bin-list > $UPD/bin-list1
	mv -f $UPD/bin-list1 $UPD/bin-list
	grep -v non-free $UPD/src-list > $UPD/src-list1
	mv -f $UPD/src-list1 $UPD/src-list
fi

echo Creating trees
cat $UPD/bin-list | xargs $addfiles $UPD/CD1 $MIRROR
cat $UPD/bin-list | xargs $addfiles $UPD/CD2 $MIRROR
cat $UPD/src-list | xargs $addfiles $UPD/CD3 $MIRROR

if [ "$NONUS"x != ""x ] ; then
	echo Creating non-US list
	cd $NONUS
	if [ -e $DIFF ] ; then
		grep non-US $DIFF >$UPD/nu-list
		egrep -e \\.deb$ $UPD/nu-list >$UPD/bin-nu-list
		egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $UPD/nu-list >$UPD/src-nu-list
	else
		egrep -e ^dists.*\\.deb$ $NUCLOG | sed 's?^stable?dists/potato?g' > $UPD/bin-nu-list
		egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $NUCLOG | sed 's?^stable?dists/potato?g' > $UPD/src-nu-list
	fi

	if [ "$NONFREE"x != "1"x ] ; then
		echo Removing non-free
		grep -v non-free $UPD/bin-nu-list > $UPD/bin-nu-list1
		mv -f $UPD/bin-nu-list1 $UPD/bin-nu-list
		grep -v non-free $UPD/src-nu-list > $UPD/src-nu-list1
		mv -f $UPD/src-nu-list1 $UPD/src-nu-list
	fi

	echo Creating non-US trees
	cat $UPD/bin-nu-list | xargs $addfiles $UPD/CD1 $MIRROR
	cat $UPD/bin-nu-list | xargs $addfiles $UPD/CD2 $MIRROR
	cat $UPD/src-nu-list | xargs $addfiles $UPD/CD3 $MIRROR
fi

# The full update will not fit on a single CD, so split it by architecture, arbitrarily
# CD 1 gets alpha/arm/i386
# CD 2 gets m68k/sparc/powerpc
# binary-all goes on both
# CD 3 gets source

cd $UPD

echo Splitting binary dirs between trees

for ARCH in $ARCH2
do
	find CD1 -type d | egrep -e binary-$ARCH$ | xargs rm -r
done
find CD1 -type d | grep source$ | xargs rm -r

for ARCH in $ARCH1
do
	find CD2 -type d | egrep -e binary-$ARCH$ | xargs rm -r
done
find CD2 -type d | grep source$ | xargs rm -r

for ARCH in $ARCH1 $ARCH2 all
do
	find CD3 -type d | grep -e binary-$ARCH$ | xargs rm -r >/dev/null 2>&1
done

# Now create the binary-all symlinks

echo Creating binary-all symlinks
for DIR in `find . -name binary-all`
do
	cd $DIR
	for CAT in *
	do
		if [ $CAT != '*' ] ; then
			if [ -d $CAT ] ; then
				cd $CAT
			fi
			for FILE in *.deb
			do
				if [ $FILE != '*.deb' ] ; then
					for ARCH in alpha arm i386 m68k powerpc sparc
					do
						if [ -d ../../binary-$ARCH ] ; then
							if [ ! -d ../../binary-$ARCH/$CAT ] ; then
								mkdir ../../binary-$ARCH/$CAT
							fi
						ln -s ../../binary-all/$CAT/$FILE ../../binary-$ARCH/$CAT
						fi
					done
				fi
			done
			if [ -d ../$CAT ] ; then
				cd ..
			fi
		fi
	done
	cd $UPD
done

echo Creating .disk/info files
echo $INFO1 >CD1/.disk/info
echo $INFO2 >CD2/.disk/info
echo $INFO3 >CD3/.disk/info

echo Creating Packages files
for ARCH in $ARCH1
do
	echo $ARCH
	ARCH=$ARCH $scanpackages scan CD1
	ARCH=$ARCH $scanpackages -noPackages.cd install CD1
	rm -f CD1/*.Packages*
done

for ARCH in $ARCH2
do
	echo $ARCH
	ARCH=$ARCH $scanpackages scan CD2
	ARCH=$ARCH $scanpackages -noPackages.cd install CD2
	rm -f CD2/*.Packages*
done

echo Creating Sources files
$scansources CD3

rm CD?/CD?.*

${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/potato-update-1.raw CD1
${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/potato-update-2.raw CD2
${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/potato-update-3.raw CD3