file: update the file utility to version 5.04.
[msysgit.git] / share / msysGit / install-tar.sh
blob7e608c5e1f19baa6a7dff2d6b910bf31dc672d8f
1 #!/bin/sh
3 die () {
4 echo "$*" >&2
5 exit 1
8 root=/
9 while test $# -gt 0
11 case "$1" in
12 --mingw)
13 root=/mingw
14 shift
17 break
18 esac
19 done
21 cd "$root" || die "$root does not exist?"
23 test $# -ne 1 && die "Usage: $0 <TARFILE>"
26 index=$(/share/msysGit/pre-install.sh) || die "Pre-install stage failed"
28 uncompress=
29 case "$1" in
30 *.lzma)
31 (cd /tmp && /share/7-Zip/7za x "$1")
32 set /tmp/"$(basename "$1" .lzma)"
34 *.bz2)
35 uncompress=j
37 *.gz|*.tgz)
38 uncompress=z
40 esac
42 tar x${uncompress}mf "$1" || die "Could not untar $1"
44 /share/msysGit/post-install.sh $index Install "$(basename "$1")" ||
45 die "Post-install stage failed"