~tsimonq2/debian-cd/lubuntu-cosmic-changes

716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
1
#!/bin/bash
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
2
#
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
3
# $Id: update-cd,v 1.11 2004/10/31 01:10:41 93sam Exp $
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
4
# 
5
# (c) Steve McIntyre <stevem@chiark.greenend.org.uk> Released under
181 by Arch Librarian
Updates:
6
# GNU GPL v2 1st January 2001
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
7
#
8
# Quick and dirty script to create update CDs for people to upgrade
9
# from potato (2.2r0) to the latest release level
181 by Arch Librarian
Updates:
10
#
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
11
12
set -e
13
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
14
# Configuration goes here.
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
15
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
16
# Where is your mirror?
839 by Colin Watson
use $CDIMAGE_ROOT rather than hardcoding /srv/cdimage.no-name-yet.com
17
MIRROR=${MIRROR:-$CDIMAGE_ROOT/ftp}
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
18
19
# If you have a non-US mirror, where is it? Leave blank if you don't have one.
626 by Arch Librarian
Checking in changes used in making the woody r2 update ...
20
NONUS=${NONUS:-/mirror/debian-non-US}
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
21
22
# Do you want non-free? 1 for yes, 0 for no
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
23
#NONFREE=1
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
24
25
# What release version is this?
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
26
VER=3.0r3
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
27
28
# Path to use with mkisofs/mkhybrid
29
MKISOFS=${MKISOFS:-"mkhybrid"}
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
30
MKISOFS=mkisofs-jte
31
32
# Use JTE extensions to mkisofs to make jigdo files?
33
JTE=1
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
34
35
# The working directory to use. MUST be on the same partition as the mirror.
200 by Arch Librarian
Updated to work with r3. sources now on a 3rd CD.
36
TDIR=/mirror/debian-cd
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
37
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
38
# Building woody cd set ...
39
CODENAME=woody
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
40
41
# Path where the images will be written
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
42
OUT=/mirror/woody-update/r3
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
43
181 by Arch Librarian
Updates:
44
# Location of the diff file to use to determine the changes. If you leave
45
# this blank, we'll try to determine the changes from the ChangeLog files,
46
# which is probably less accurate. 
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
47
DIFF=/mirror/lists/$CODENAME/r0-r3.diff #~/r3.diff
181 by Arch Librarian
Updates:
48
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
49
CDSIZE=620 # megabytes, leaving space for metadata
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
50
REL=Debian"$VER"
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
51
CLOG=dists/$CODENAME/ChangeLog
52
NUCLOG=dists/$CODENAME/non-US/ChangeLog
53
UPD=$TDIR/$CODENAME-update
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
54
DATE=`date +%Y%m%d`
55
BASEDIR=`pwd`
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
56
SECTS="main non-free contrib"
57
VERBOSE=2
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
58
GRAB_MD5=$BASEDIR/tools/grab_md5
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
59
export VERBOSE BASEDIR SECTS
311 by Arch Librarian
Updated for r6, cleaned up a little
60
401 by Arch Librarian
Rearranged to produce a CD per architecture
61
ARCHLIST="alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc src" # all dealt with specially
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
62
63
export TDIR NONFREE NONUS VER MIRROR CODENAME OUT BASEDIR
64
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
65
CDSIZE=$(($CDSIZE * 1024))
66
268 by Arch Librarian
Updates for 2.2r4
67
scanpackages=$BASEDIR/tools/scanpackages.old
68
scansources=$BASEDIR/tools/scansources.old
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
69
set_mkisofs_opts=$BASEDIR/tools/set_mkisofs_opts
181 by Arch Librarian
Updates:
70
addfiles=$BASEDIR/tools/add_files
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
71
311 by Arch Librarian
Updated for r6, cleaned up a little
72
create_control_files () {
73
    CDDIR=$1
74
    shift
75
    ARCHES=$*
76
    echo "  Creating control files for \"$ARCHES\" on $CDDIR"
77
    for ARCH in $ARCHES
78
    do
79
        case "$ARCH" in
80
            src)
81
                echo "    src"
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
82
                for SECT in $SECTS
83
                do
84
                    mkdir -p $CDDIR/dists/$CODENAME/$SECT/source
85
                    mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/source
86
                done
400 by Arch Librarian
Make sure we're in the right directory before running s...
87
                cd $UPD
311 by Arch Librarian
Updated for r6, cleaned up a little
88
                $scansources $CDDIR >/dev/null 2>&1
89
                ;;
90
            all)
91
                ;;
92
            *)
93
                echo "    $ARCH"
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
94
                for SECT in $SECTS
95
                do
96
                    mkdir -p $CDDIR/dists/$CODENAME/$SECT/binary-$ARCH
97
                    mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/binary-$ARCH
98
                done
626 by Arch Librarian
Checking in changes used in making the woody r2 update ...
99
                ARCH=$ARCH $scanpackages scan $CDDIR > /dev/null 2>&1
100
                ARCH=$ARCH $scanpackages -noPackages.cd install $CDDIR > /dev/null 2>&1
399 by Arch Librarian
Updated to make woody update CDs. We fit onto two CDs f...
101
                rm -f $CDDIR/*.Packages* #>/dev/null 2>&1
311 by Arch Librarian
Updated for r6, cleaned up a little
102
                ;;
103
        esac
104
    done
105
}
106
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
107
copy_file () {
108
    ROOTDIR=$1
109
	shift
110
	FILE=$1
111
    DIR=`echo $FILE | sed 's?/[-_\.A-Za-z0-9\+]*$??'`
112
    if [ ! -d $ROOTDIR/$DIR ] ; then
113
        mkdir -p $ROOTDIR/$DIR
114
    fi
115
	if [ -e $MIRROR/$FILE ] ; then
116
		cp -l $MIRROR/$FILE $ROOTDIR/$FILE
117
	elif [ -e $NONUS/$FILE ] ; then
118
		cp -l $NONUS/$FILE $ROOTDIR/$FILE
119
	else
120
		echo
121
		echo "File $FILE not found!"
122
		exit 1
123
	fi
124
}
125
126
make_cd () {
127
	CDNUM=$1
128
	shift
129
	THISNUM=$1
130
	shift
131
	THISARCH=$1
132
	shift
133
	SRCFILES=$1
134
	shift
135
	ARCHFILES=$1
136
	shift
137
	ALLFILES=$1
138
	echo
139
	echo "  Creating Packages and Sources files for CD$CDNUM"
140
	cd $UPD
141
	create_control_files CD$CDNUM $THISARCH
142
	echo "  Creating image for CD$CDNUM ($SRCFILES source files, $ARCHFILES $ARCH debs, $ALLFILES all debs)"
143
	echo -n "    "
144
	if [ $JTE = 1 ] ; then
145
		${MKISOFS} -J -r -V "Debian $VER update CD" -o \
146
			/dev/null \
147
			-jigdo-jigdo $OUT/$CODENAME-update-$THISARCH-$THISNUM.jigdo \
148
			-jigdo-template $OUT/$CODENAME-update-$THISARCH-$THISNUM.template \
149
			-jigdo-map Debian=$MIRROR/ \
150
			-jigdo-map Non-US=$NONUS/ \
151
			-jigdo-force-md5 /pool/ \
152
			-md5-list $UPD/md5-check \
153
			$UPD/CD$CDNUM 2>&1 | grep "extents written"
154
	else
155
		${MKISOFS} -J -r -V "Debian $VER update CD" -o \
156
		$OUT/$CODENAME-update-$THISARCH-$THISNUM.raw \
157
		$UPD/CD$CDNUM 2>&1 | grep "extents written"
158
	fi
159
}
160
161
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
162
echo Cleaning up
163
rm -rf $UPD
401 by Arch Librarian
Rearranged to produce a CD per architecture
164
mkdir $UPD
165
CDNUM=1
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
166
167
cd $MIRROR
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
168
echo Creating file list
169
170
if [ ! -e $DIFF ] ; then
171
	echo "NO DIFF FOUND. ABORT!"
172
	exit 1
173
fi
174
175
cp $DIFF $UPD/list
176
if [ "$NONUS"x == ""x ] ; then
177
	echo "Removing non-US files from the list"
178
	grep -v non-US $UPD/list > $UPD/list1
179
	mv -f $UPD/list1 $UPD/list
181 by Arch Librarian
Updates:
180
fi
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
181
if [ "$NONFREE"x != "1"x ] ; then
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
182
	echo "Removing non-free files from the list"
183
	grep -v non-free $UPD/list > $UPD/list1
184
	mv -f $UPD/list1 $UPD/list
169 by Arch Librarian
Initial checkin of update-cd, simple tool to create r0 ...
185
fi
186
401 by Arch Librarian
Rearranged to produce a CD per architecture
187
for THISARCH in $ARCHLIST
188
do
716 by Arch Librarian
Checking in the changes needed for the woodyr3 update CDs.
189
	THISNUM=0
190
191
	rm -f $UPD/md5-check
192
	$GRAB_MD5 $MIRROR $THISARCH $CODENAME $UPD/md5-check
193
	if [ "$NONUS"x != ""x ] ; then
194
		$GRAB_MD5 $NONUS $THISARCH $CODENAME $UPD/md5-check
195
	fi
196
197
	for file in `cat $UPD/list`
198
	do
199
		if [ ! -d $UPD/CD$CDNUM ] ; then
200
			echo
201
			cd $MIRROR
202
			THISNUM=$((THISNUM + 1))
203
			if [ $THISARCH = "src" ] ; then
204
				echo "Creating CD$CDNUM for source (part $THISNUM)"
205
			else
206
				echo "Creating CD$CDNUM for binary-$THISARCH (part $THISNUM)"
207
			fi
208
			mkdir $UPD/CD$CDNUM $UPD/CD$CDNUM/.disk
209
			INFO="Debian GNU/Linux $VER Update CD $DATE: $THISARCH CD $THISNUM"
210
	   		echo $INFO > $UPD/CD$CDNUM/.disk/info
211
			SIZE_USED=0
212
			SRCFILES=0
213
			ARCHFILES=0
214
			ALLFILES=0
215
		fi
216
217
		SIZE_USED=`du -sk $UPD/CD$CDNUM | awk '{print $1}'`
218
219
		if [ $SIZE_USED -gt $CDSIZE ] ; then
220
			make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
221
			CDNUM=$(($CDNUM + 1))
222
			continue
223
		fi
224
225
        case "$THISARCH" in
226
            src)
227
				case "$file" in
228
					*.gz|*.dsc)
229
						copy_file $UPD/CD$CDNUM $file
230
						SRCFILES=$(($SRCFILES + 1))
231
						;;
232
				esac
233
				echo -en "\r$SRCFILES copied"
234
				;;
235
			*)
236
				case "$file" in
237
					*_$THISARCH.deb)
238
						copy_file $UPD/CD$CDNUM $file
239
						ARCHFILES=$(($ARCHFILES + 1))
240
						;;
241
					*_all.deb)
242
						copy_file $UPD/CD$CDNUM $file
243
						ALLFILES=$(($ALLFILES + 1))
244
						;;
245
				esac
246
				echo -en "\r$THISARCH:$ARCHFILES all:$ALLFILES copied"
247
				;;
248
		esac
249
	done
250
	make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
251
	CDNUM=$(($CDNUM + 1))
401 by Arch Librarian
Rearranged to produce a CD per architecture
252
done
311 by Arch Librarian
Updated for r6, cleaned up a little
253