Roll src/third_party/WebKit 06cb9e9:a978ee5 (svn 202558:202559)
[chromium-blink-merge.git] / third_party / lcov / bin / install.sh
blob27140f91dd18b1ae3eab10a61f1c262854176355
1 #!/bin/bash
3 # install.sh [--uninstall] sourcefile targetfile [install options]
7 # Check for uninstall option
8 if test "x$1" == "x--uninstall" ; then
9 UNINSTALL=true
10 SOURCE=$2
11 TARGET=$3
12 shift 3
13 else
14 UNINSTALL=false
15 SOURCE=$1
16 TARGET=$2
17 shift 2
20 # Check usage
21 if test -z "$SOURCE" || test -z "$TARGET" ; then
22 echo Usage: install.sh [--uninstall] source target [install options] >&2
23 exit 1
28 # do_install(SOURCE_FILE, TARGET_FILE)
31 do_install()
33 local SOURCE=$1
34 local TARGET=$2
35 local PARAMS=$3
37 install -p -D $PARAMS $SOURCE $TARGET
42 # do_uninstall(SOURCE_FILE, TARGET_FILE)
45 do_uninstall()
47 local SOURCE=$1
48 local TARGET=$2
50 # Does target exist?
51 if test -r $TARGET ; then
52 # Is target of the same version as this package?
53 if diff $SOURCE $TARGET >/dev/null; then
54 rm -f $TARGET
55 else
56 echo WARNING: Skipping uninstall for $TARGET - versions differ! >&2
58 else
59 echo WARNING: Skipping uninstall for $TARGET - not installed! >&2
64 # Call sub routine
65 if $UNINSTALL ; then
66 do_uninstall $SOURCE $TARGET
67 else
68 do_install $SOURCE $TARGET "$*"
71 exit 0