summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-images
blob: dcab9d5c84ec44d92eab086f48f9ee2643bac50f (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
#!/bin/sh
# $Id$
# Create the .iso image(s) for TeX Live.
# 
# Copyright 2007-2013 Karl Berry.
# Copyright 2003, 2004, 2005 Sebastian Rahtz.
#
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
# Send bug reports or suggestions to tex-live@tug.org.
# Historical notes at the end of the script.

NAME=texlive
V=2013
D=`date +%Y%m%d`
target=/home/ftp/texlive/Images/test

renice +19 -p $$ >/dev/null 2>&1
umask 0
unset CDPATH  # avoid output from cd
XZ_OPT=-6; export XZ_OPT # compression level, -9 for slowest-but-most,
                         # which is not worth the time.

mydir=`cd \`dirname $0\` && /bin/pwd`
cd $mydir || exit 1  # the Master/tlpkg/bin directory
master=`cd ../.. && /bin/pwd`
test -z "$master" && exit 1

debug=${OVERRIDE_DEBUG-false}
mkisofs="xorriso -read_mkisofsrc -as mkisofs"   # mkisofs
makeinst=true
maketar=true
tar_all=true
tar_bin_only=false
tar_source_only=false
quiet=  # for passing to mkisofs

while test $# -gt 0; do
  case $1 in
  --debug)     debug=true; quiet=;;
  --help)      echo "$0: No help, use the source, sorry."; exit 0;;
  --master=*)  master=`echo $1 | sed 's/.*=//'`;;
  --mkisofs=*) mkisofs=`echo $1 | sed 's/.*=//'`;;
  --noinst)    makeinst=false;;
  --notar)     maketar=false;;
  --quiet)     quiet=-quiet;;
  --target=*)  target=`echo $1 | sed 's/.*=//'`;;
  --tar-bin-only)    tar_all=false; makeinst=false; tar_bin_only=true;;
  --tar-source-only) tar_all=false; makeinst=false; tar_source_only=true;;
  --version)   echo "$0 for $NAME-$V ($D)"; exit 0;;  # who cares ...
  *) echo "$0: unknown option $1; try --help if you need it." >&2; exit 1;;
  esac
  shift
done

if $debug; then
  echo "master = $master"
  echo "target = $target"
fi
mkdir -p $target

# From the days when we made multiple images.  Keep it factored out in
# case they come back.
common_mkisofs_options="$quiet -pad -J -dir-mode 0755 -r -x .svn"

# 
MAKEINST ()
{
  prefix=$target/$NAME$V # directory and prefix for our files within
  iso=$prefix-$D.iso
  echo "-- `date` Writing image to $iso"

  # remove old images and checksums.
  rm -f $prefix-*.iso* $prefix-*.md5 $prefix-*.sha256

  # the image consists of the tlnet tree and the top-level files
  # from master, more or less.
  imgdir=${prefix}imgtmp
  rm -rf $imgdir
  mkdir $imgdir
  
  # files and a few dirs from master.
  cp -p $master/.mkisofsrc $imgdir || exit 1    # mkisofs control
  cp -p $master/* $imgdir 2>/dev/null           # intentionally skip dirs
  cp -pr $master/readme* $master/source $imgdir # but do these few dirs
  
  # included preformatted doc in new dir for the DVD.
  mkdir $imgdir/texlive-doc
  (cd $master/texmf-dist/doc/texlive && tar cf - \
     index.html */*.html */*.pdf */*.png \
   | (cd $imgdir/texlive-doc && tar xf -))
  
  # files from tlnet.
  cd /home/ftp/texlive/tlpretest
  if $debug; then
    echo "source = `pwd`"
  fi
  cp -pr install-tl *.bat tlpkg archive $imgdir
  
  # remove some platforms to save space on the dvd.
  # do this here so that they can be kept in the tree,
  # and thus installed normally over the net.
  prune="mips-irix alpha-linux powerpc-linux i386-kfreebsd amd64-kfreebsd \
         mipsel-linux armel-linux armhf-linux"
  echo "-- pruning platforms $prune..."
  mkdir $imgdir/tlpkg/bin
  cp $mydir/tl-prune-platforms $imgdir/tlpkg/bin
  $imgdir/tlpkg/bin/tl-prune-platforms $prune >/tmp/imgprune

  # some files we don't want in the image after all.
  rm -rf $imgdir/doc.html $imgdir/tlpkg/texlive.tlpdb.xz $imgdir/tlpkg/bin

  # the actual iso build.
  cd $imgdir || exit 1
  cmd="$mkisofs $common_mkisofs_options -o $iso ."
  echo "-- `date` with: $cmd"
  $cmd
  if test $? -ne 0; then
    echo "$0: $mkisofs failed (status $?), goodbye." >&2
    exit $?
  fi
  chmod a+rw $iso
  
  #rm -rf $imgdir

  # make checksums
  # and symlinks with short names (potentially used in /etc/fstab).
  for ext in ""; do  # used to do .xz here too
    rm -f $prefix.iso$ext $prefix.iso$ext.md5 $prefix.iso$ext.sha256
    
    (cd $target && md5sum `basename $iso$ext`) >$iso$ext.md5
    (cd $target && sha256sum `basename $iso$ext`) >$iso$ext.sha256

    ln -s `basename $iso$ext` $prefix.iso$ext
    
    # for md5 and sha256, have to adjust the filename embedded in the file.
    sed s,-$D,, $iso$ext.md5 >$prefix.iso$ext.md5
    sed s,-$D,, $iso$ext.sha256 >$prefix.iso$ext.sha256
    #ln -s `basename $iso`$ext.md5 $prefix.iso$ext.md5
    #ln -s `basename $iso`$ext.sha256 $prefix.iso$ext.sha256
    
    ls -l $iso$ext
  done
}


# 
# Make the tar files: the sources, the texmf trees, the binaries, the
# minor "extra" files.  Each should unpack into its directory name.  We
# use the GNU tar --transform option to avoid copying the whole
# hierarchy to a temp directory.  This auxiliary function takes that
# temp directory name as its first argument, and the files to archive as
# the rest.
# 
do_tar ()
{
  name=$1; shift
  #
  if false; then # ddebug
    verbose="-v --show-transformed-names"
  else
    verbose=
  fi
  #
  compress=--xz
  #
  excludes=--exclude-vcs  
  for e in bibtex epstopdf jfontmaps; do  # "upstream" sources
    excludes="$excludes --exclude=extra/$e"
  done
  #
  tar_common_opt="$verbose $compress $excludes"
  #
  tarfile=$target/$name.tar.xz
  tar -cf $tarfile --owner=0 --group=0 \
      --transform="s,^,$name/," $tar_common_opt \
      "$@"
  if test $? -ne 0; then
    echo "$0: tar failed, goodbye." >&2
  fi
  (cd $target && sha256sum `basename $tarfile`) >$tarfile.sha256
  ls -l $tarfile
}

MAKETAR ()
{
  echo
  echo "-- `date` Writing tars to $target"

  # remove old tarballs and checksums.
  rm -f $target/$NAME-*.tar.*

  # make tar files based on the tree we are running out of.
  cd $master || exit 1
  do_tar $NAME-$D-extra \
         LICENSE* README* autorun.inf *.html install* re* tl-* \
         tlpkg/TeXLive tlpkg/translations tlpkg/tlpostcode

  cd $master || exit 1
  do_tar $NAME-$D-texmf texmf*

  if $tar_bin_only || $tar_all; then
    cd $master/bin || exit 1
    do_tar $NAME-$D-bin *
    $tar_bin_only && return
  fi
  
  if $tar_source_only || $tar_all; then
    cd $master/../Build/source || exit 1
    do_tar $NAME-$D-source *
    $tar_source_only && return
  fi
  
  # one more unusual case: the development sources, which we record in
  # the 00texlive.image (fake) package; see its .tlpsrc.
  cd $master || exit 1
  do_tar $NAME-$D-devsource `tlpfiles 00texlive.image`
}


#  main program.

# Add our exact version to the release file.
cp $master/release-texlive.txt /tmp/tluirt.txt
printf "\ntexlive-$D\n" >>$master/release-texlive.txt

$makeinst && MAKEINST
$maketar && MAKETAR

# Undo the version without using svn, in case it's been relocked.
cp /tmp/tluirt.txt $master/release-texlive.txt

exit 0

# Until 2010, we also produced:
# live: full live distribution which can be run as is (CD/DVD)
# but this was dropped in 2010.  TeX Live is no longer live.  Oh well.
#
# From 2004-2007, we produced:
# inst: compressed zip files and installer only (CD)
# but this was dropped in 2008, and restored in a different form in 2010
# for DVD.
# 
# In 2003, we produced:
# demo: live subset which can be run as is (CD)
# but this was dropped in 2004.