summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-makeself-from-tlnet
blob: c0380f359f27887937240b7654e705f17bf2e300 (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
#!/usr/bin/env bash
# $Id: tl-makeself-from-tlnet 11099 2008-10-29 00:15:13Z preining $
# Copyright 2008 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
# 
# Creates a .run file for updating the texlive.infra and bin-texlive packages
# comparable to the windows .exe updater

set -e

TMP=`mktemp -d`

CWD=`pwd`

TLNET="$1"

if [ ! -d "$TLNET" ] ; then
  echo "No directory for the tlnet distribution given, aborting."
  exit 1
fi

ARCHIVE="$TLNET/archive"

if [ ! -d "$ARCHIVE" ] ; then
  echo "archive directory in $TLNET not found, aborting."
  exit 1
fi

cd $TMP
mkdir master
cd master

for i in $ARCHIVE/texlive.infra*.tar.lzma ; do
  case "$i" in 
    *win32*) ;;
    *) lzmadec < $i | tar -xvf - ;;
  esac
done
for i in $ARCHIVE/bin-texlive*.tar.lzma ; do
  case "$i" in 
    *win32*) ;;
    *) lzmadec < $i | tar -xvf - ;;
  esac
done

cd ..

# create the runme.sh script
#
cat > runme.sh <<'EOF'
#!/bin/sh
#
# updater for tlmgr and infrastructure on unix
#

ROOT=`kpsewhich --var-value=SELFAUTOPARENT`
if [ -r "$ROOT/tlpkg/texlive.tlpdb" ] ; then
  mv ./master/bin .
  mv ./master/tlpkg/installer .
  cp -a ./master/* $ROOT/
  # now try to get the list of installed architectures by listing the
  # directories in $ROOT/bin
  tlpobjs="$ROOT/tlpkg/tlpobj/bin-texlive.tlpobj $ROOT/tlpkg/tlpobj/texlive.infra.tlpobj"
  mkdir -p $ROOT/tlpkg/installer/lzma
  mkdir -p $ROOT/tlpkg/installer/wget
  for a in $ROOT/bin/* ; do
    b=`basename $a`
    cp -a bin/$b $ROOT/bin/
    tlpobjs="$tlpobjs $ROOT/tlpkg/tlpobj/bin-texlive.$b.tlpobj $ROOT/tlpkg/tlpobj/texlive.infra.$b.tlpobj"
    # we also have to copy the files from (tlpkg/)installer/lzma and ../wget
    cp -a installer/lzma/lzmadec.$b $ROOT/tlpkg/installer/lzma
    cp -a installer/lzma/lzma.$b $ROOT/tlpkg/installer/lzma
    if [ -r installer/wget/wget.$b ] ; then
      cp -a installer/wget/wget.$b $ROOT/tlpkg/installer/wget
    fi
  done
else
  # could be made more intelligent
  echo "Cannot find root, please call the .run script with --noexec --keep and"
  echo "then call the runme.sh script in the unpacked directory with the"
  echo "root as the first argument, i.e., something like"
  echo "    sh runme.sh /your/path/to/the/texlive/installaton/2008"
  exit 1
fi

tlmgr _include_tlpobj $tlpobjs

EOF

chmod ugo+x runme.sh

cd $CWD

makeself $TMP update-tlmgr.sh "TeX Live Manager Updater" ./runme.sh

rm -rf $TMP

# vim:set tabstop=2 expandtab: #