aboutsummaryrefslogtreecommitdiff
path: root/common/svn-prepare.sh
blob: 6edae1a1bcfa5b6a0415023a2d67fccabddf9b0b (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
#!/bin/sh

USAGE="$0 {copy|link} [COMMON_SRC=../common] [COMMON_DST=./common]"

if test -n "$1"; then
  case "$1" in
    copy)
      CP="cp -a";
      ;;
    link)
      CP="ln -s";
      ;;
    *)
      echo "Usage: $USAGE"
      exit 1;
      ;;
  esac
else
  CP="ln -s"
fi

if test -n "$2"; then
  COMMON_SRC="$2";
else
  COMMON_SRC="../common";
fi

if test -n "$3"; then
  COMMON_DST="$3";
else
  COMMON_DST="./common";
fi

##-- copy or link in common dir
runcmd() {
  echo "$0[`basename \`pwd\``]:" "$@"
  $@
}

runcmd rm -rf "$COMMON_DST";
runcmd $CP "$COMMON_SRC" "$COMMON_DST";