summaryrefslogtreecommitdiff
path: root/Master/Tools/MakeImages.sh
blob: c8869a8d2680775516643afeea4a9bbdd0bf85fc (plain)
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#!/bin/sh
# $Id: //depot/Master/Tools/MakeImages.sh#124 $  $Date: 2005/10/27 $  $Author: karl $
#
# Create the .iso file system images for TeX Live:
# a) live: the complete uncompressed system (for DVD)
# b) inst: compressed zip files and installer only (CD)
# 
# In 2003, we also produced:
# c) demo: live subset which can be run as is (CD)
# but this was dropped in 2004.
#
# Copyright (c) Sebastian Rahtz 2003, 2004, 2005.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
# 
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
# 
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#    Send bug reports or suggestions to tex-live@tug.org.

unset CDPATH  # avoid output from cd
umask 0

HERE=`cd \`dirname $0\` && /bin/pwd`
cd $HERE || exit 1  # the Tools directory
source=`cd .. && /bin/pwd`

NAME=texlive
V=2005
D=`date +%Y%m%d`

debug=${OVERRIDE_DEBUG-false}
target=/home/ftp/texlive/Images/test
work=/var/tmp/TL_$$
zippath=/usr/local/bin
quiet=  # for passing to mkisofs
makelive=true
makeinst=true
makedemo=false

while test $# -gt 0; do
  case $1 in
    --debug)     debug=true; quiet=;;
    --noinst)    makeinst=false;;
    --nolive)    makelive=false;;
    --quiet)     quiet=-quiet;;
    --source=*)  source=`echo $1 | sed 's/.*=//'`;;
    --work=*)    work=`echo $1 | sed 's/.*=//'`;;
    --target=*)  target=`echo $1 | sed 's/.*=//'`;;
    --zippath=*) zippath=`echo $1 | sed 's/.*=//'`;;
     *) break;;
  esac
  shift
done

$debug && echo "source: [$source]  target: [$target]  work: [$work]"
mkdir -p $target

# 
MAKELIVE () {
live_iso=$target/$NAME$V-live-$D.iso
echo "--- (`date`) Writing complete live image to $live_iso."

# Basically copy the source directory.
(cd $source || exit 1
 # Complication: get the right install-tl.sh.
 rm -f install-tl.sh
 cp -p install-live.sh install-tl.sh
 cp -p install-pkg-live.sh install-pkg.sh

 # Another complication: getting the release date into 00LIVE.TL.
 rm -f 00LIVE.TL
 p4 sync -f 00LIVE.TL
 chmod a+w 00LIVE.TL
 (echo; echo "Release date: $D.`date +%H`") >>00LIVE.TL

 # remove old images.
 rm -f $target/$NAME$V-live-*.iso $target/$NAME$V-live-*.iso.md5
 
 # make new image, excluding the compressed stuff and more,
 # and moving everything to a texlive/ subdirectory,
 # since that's how we release it on the DVD.
 mkisofs $quiet -pad -J -dir-mode 0755 -r \
   -root texlive \
   -copyright LICENSE.TL \
   -x 00INST.TL \
   -x install-live.sh -x install-compr.sh \
   -x install-pkg-compr.sh  -x install-pkg-live.sh \
   -x ./support/tests \
   -x Tools \
   -o $live_iso  .
 md5sum $live_iso >$live_iso.md5
 rm -f install-tl.sh install-pkg.sh
)

# make symlink with short name, that we use in /etc/fstab.
rm -f $target/$NAME-live.iso $target/$NAME-live.iso.md5
ln -s `basename $live_iso` $target/$NAME-live.iso
ln -s `basename $live_iso`.md5 $target/$NAME-live.iso.md5
ls -l $live_iso
}


# 
MAKEINST () {
inst_iso=$target/$NAME$V-inst-$D.iso
echo "--- (`date`) Writing compressed/installable Unix image to $inst_iso."

WORK=$work/TL
test -d $WORK && rm -rf $WORK
mkdir -p $WORK

$debug && echo Copy top-level files
cd $source 
tar cf - \
 support \
 .mkisofsrc config.* autorun.inf \
 install-compr.sh install-pkg-compr.sh common.sh utils.sh \
 COPYING \
 LICENSE.TL \
 README.* \
 setup-win32/help/* \
 setup-win32/msgs/* \
 setup-win32/* \
 Tools \
 source \
 texmf-doc/doc/*/texlive-* \
 00INST.TL *html  \
 | (cd $WORK && tar xf - )

# initial texmf-var
mkdir $WORK/texmf-var
cd $source/texmf-dist || exit 1
tar cf -  \
 tex/plain/config/language.def  \
 tex/context/config/cont-usr.tex \
| (cd $WORK/texmf-var; tar xf - )
cd $source/texmf || exit 1
# updmap.cfg gets generated at install time, we don't want to copy the
# one from the distribution.
tar cf -  \
 web2c/mktex.cnf \
 dvips/config/config.ps \
 dvipdfm/config/config \
 tex/generic/config/pdftexconfig.tex \
 xdvi/XDvi \
 | (cd $WORK/texmf-var; tar xf - )
chmod -R u+rw $WORK/texmf-var  # the originals are mostly 444

# make zip file out of texmf-var, so we don't have an ersatz tree
# hanging around in the image to confuse users.
mkdir -p $WORK/archive
cd $WORK/texmf-var || exit 1
zip -qr $WORK/archive/texmf-var.zip .
cd $WORK && rm -rf texmf-var

$debug && echo Prepare zip files...
PATH=$PATH:$zippath
export PATH
cd $source || exit 1
# people want to get the windows binaries, so don't exclude everything.
# bzip2, perl, windvi, lib-* -- basically required.
# Fabrice suggests dumping the below, but since we seem to have room for
# now, let's include them.  xemacs is the biggie.
# w32progs="diff|grep|gsview|imagemagick|patch|sed|wget|xemacs"
w32progs="xemacs"
for i in texmf/lists/*; do
 # skip windows binaries for unix inst cd.  Since the windows installer
 # requires cab files, we can't put them on one CD any more, no space.
 # All the lib-* packages are xemtex things, strange but true.
 echo "$i" | egrep "bin-($w32progs)|\.win32-static" >/dev/null \
 && continue

 I=`basename $i`
 cat $i | zip -y -q -r $WORK/archive/$I.zip -@
done

# copy tpm directories
cd $source
tar cf - texmf/lists texmf/tpm texmf-dist/tpm texmf-doc/tpm \
   | (cd $WORK; tar xf - )  

cd $WORK || exit 1

# fix up top level.
rm -f install-tl.sh install-pkg.sh
mv install-compr.sh install-tl.sh
mv install-pkg-compr.sh install-pkg.sh
chmod a+w 00INST.TL
(echo; echo "Release date: $D.`date +%H`") >>00INST.TL

rm -f $target/$NAME$V-inst-*.iso $target/$NAME$V-inst-*.iso.md5
mkisofs $quiet -pad -J -dir-mode 0755 -r \
   -copyright LICENSE.TL \
  -x 00LIVE.TL \
  -x install-live.sh \
  -x support/tests \
  -x Tools \
  -o $inst_iso .
md5sum $inst_iso >$inst_iso.md5

# symlink with short name.
rm -f $target/$NAME-inst.iso $target/$NAME-inst.iso.md5
ln -s `basename $inst_iso` $target/$NAME-inst.iso
ln -s `basename $inst_iso`.md5 $target/$NAME-inst.iso.md5
}


# 
MAKEDEMO () {
demo_iso=$target/$NAME$V-demo-$D.iso 
echo "--- (`date`) Writing demo image (texlive-live scheme) to $demo_iso"

WORK=$work/TeXLive

cd $source
test -d $WORK && rm -rf $WORK
sh install-live.sh <<EOF
S
F
D
1
$WORK
R
B
N
N
Y
N
N
N
N
Y
N
N
Y
N
I
EOF
cd $WORK || exit 1
mkdir texmf-dist/tpm/scheme
mkdir texmf-dist/tpm/support
mkdir texmf-dist/ispell
chmod -R u+w .
(cd $source || exit 1
 # copy top-level files that don't need name changes.
tar cf - xemtex \
    .mkisofsrc \
    AUTORUN.EXE autorun.ini autorun.inf \
    00DEMO.TL \
    COPYING LICENSE.TL README.* \
    config* \
    *.html* | (cd $WORK && tar xf - )
)
# other files to copy.
rm -f install-tl.sh
cp $source/install-demo.sh install-tl.sh
cp $source/install-pkg-live.sh install-pkg.sh
cp $source/common.sh common.sh
cp $source/utils.sh utils.sh
cp -rp $source/bin/win32/* bin/win32
cp -rp $source/texmf/lists texmf/lists
cp -rp $source/texmf-dist/tpm texmf-dist/tpm
cp -rp $source/texmf/tpm texmf-dist/tpm
cp -rp $source/texmf-doc/tpm texmf-dist/tpm

rm -f texmf/tpm/texlive-full.tpm
rm -f texmf/tpm/texlive-full.scheme

rm -f $target/$NAME$V-demo-*.iso
rm -f $target/$NAME$V-demo-*.iso.md5

# we don't link links on the demo CD
(zip -r -o foo texmf-dist/fonts/map texmf-var/fonts/map; unzip -o -a foo; rm foo.zip)

# let's have a fresh language.dat
cp texmf-var/tex/generic/config/language.dat texmf/tex/generic/config/language.dat
mkisofs $quiet -pad -J -dir-mode 0755 -r \
  -x texmf-local \
  -o $demo_iso  .
md5sum $demo_iso >$demo_iso.md5

rm -f $target/$NAME-demo.iso
ln -s `basename $demo_iso` $target/$NAME-demo.iso
ls -l $demo_iso

cd $HERE
}


$makelive && MAKELIVE 
$makeinst && MAKEINST 
$makedemo && MAKEDEMO 
rm -rf $work $WORK