summaryrefslogtreecommitdiff
path: root/Master/tlpkg/libexec/mactex-copy-tl
blob: 349f308701207f6d15c8d435e65728fd2459a7f2 (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
#!/bin/sh
# $Id$
# Public domain.  Originally written by Karl Berry, 2009.
# Copy TeX Live tree from a SRCDIR to a DESTDIR, using tar.
# Intended for MacTeX postflight on the DVD, so we don't have two
# complete copies of TL.

if test $# -ne 2; then
  echo "Usage: $0 SRCDIR DESTDIR"
  echo "Copy the TeX Live image in SRCDIR to DESTDIR,"
  echo "with only the bin/universal-darwin binaries."
  exit 1
fi

srcdir=$1
destdir=$2

if test ! -d "$srcdir"; then
  echo "$0: $srcdir is not a directory, goodbye." >&2
  exit 1
fi
cd $srcdir || exit 1

bindir=bin/universal-darwin
if test ! -d $bindir; then
  echo "$0: $srcdir/$bindir does not exist, goodbye." >&2
  exit 1
fi

if test -e "$destdir"; then
  echo "$0: $destdir already exists, goodbye." >&2
  exit 1
fi

mkdir -p "$destdir"
if test ! -d "$destdir"; then
  echo "$0: could not make directory $destdir, goodbye." >&2
  exit 1
fi

touch "$destdir/testfile"
if test ! -r "$destdir/testfile"; then
  echo "$0: could not write in directory $destdir, goodbye." >&2
  exit 1
else
  rm "$destdir/testfile"
fi
  
# texmf-{config,var} don't exist in the DVD image, but in case we want
# to test from an installed hierarchy ...
exclude="rr_moved|texmf-config|texmf-var|.*\.bat|bin"
wantedfiles="$bindir "`\ls -1 | grep -E -v "^($exclude)\$"`

# There should be no filenames with spaces or other untoward characters
# in that list, because we keep TL that way.

echo "$0: Copying these from $srcdir to $destdir:"
echo $wantedfiles
echo "$0: This will take a while."

: ${TL_TAR=tar}
"$TL_TAR" cf - $wantedfiles | (cd "$destdir" && "$TL_TAR" xf -)