summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-images
blob: 9929747722ad52a2e5e1e3eace457f0cf142f517 (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
#!/bin/sh -e
# $Id$
# Create the .iso image(s) for TeX Live.
# 
# Copyright 2007, 2008, 2009, 2010 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=2010
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=-1; 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}
makeinst=true
maketar=true
mkisofs="xorriso -read_mkisofsrc -as mkisofs"   # mkisofs
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/.*=//'`;;
  --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 just a couple small dirs from master.
  cp -p $master/.mkisofsrc $imgdir              # mkisofs control
  cp -p $master/* $imgdir 2>/dev/null || true   # intentionally skip dirs
  cp -pr $master/readme* $master/source $imgdir # do these few dirs
  
  # files from tlnet.
  cd /home/ftp/texlive/tlnet
  cp -pr install-tl *.bat tlpkg archive $imgdir
  
  cd $imgdir || exit 1
  rm doc.html tlpkg/texlive.tlpdb.xz
  cmd="$mkisofs $common_mkisofs_options -o $iso ."
  echo "-- `date` with: $cmd"
  $cmd
  
  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
    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 temp directory.  This auxiliary function takes that name
# as its first argument, and the files to archive as the rest.
# 
do_tar ()
{
  if $debug; then
    verbose="-v --show-transformed-names"
  else
    verbose=
  fi
  compress=--xz
  tar_common_opt="--exclude-vcs $compress $verbose"
  #
  name=$1
  shift
  tarfile=$target/$name.tar.xz
  tar -cf "$tarfile" --owner=0 --group=0 \
      --transform="s,^,$name/," $tar_common_opt \
      "$@"
  (cd $target && sha256sum `basename $tarfile`) >$tarfile.sha256
  ls -l "$tarfile"
}

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

  cd $master
  do_tar $NAME-$D-extra \
         LICENSE* README* autorun.inf *.html install* re* \
         tl-portable* tlpkg/TeXLive tlpkg/translations tlpkg/tlpostcode

  do_tar $NAME-$D-texmf texmf* || return

  cd $master/../Build/source
  do_tar $NAME-$D-source * || return

  cd $master/bin
  do_tar $NAME-$D-bin *
}


#  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.