aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg/update-from-egg.sh
blob: b3a78fd8b16dbdb7c3b91deab6185000152b71f1 (plain) (blame)
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
#!/bin/bash

EGGFILES="egg-editable-toolbar.c \
       egg-toolbars-model.c \
       egg-toolbar-editor.c \
       egg-editable-toolbar.h \
       egg-toolbars-model.h \
       egg-toolbar-editor.h \
       eggmarshalers.list"

function die() {
  echo $*
  exit 1
}

if test -z "$EGGDIR"; then
   echo "Must set EGGDIR"
   exit 1
fi

if test -z "$EGGFILES"; then
   echo "Must set EGGFILES"
   exit 1
fi

for FILE in $EGGFILES; do
  SRCFILE=$EGGDIR/$FILE
  if ! test -e $SRCFILE ; then
      if test -e $EGGDIR/tray/$FILE ; then
          SRCFILE=$EGGDIR/tray/$FILE
      fi
      if test -e $EGGDIR/util/$FILE ; then
          SRCFILE=$EGGDIR/util/$FILE
      fi
      if test -e $EGGDIR/toolbareditor/$FILE ; then
          SRCFILE=$EGGDIR/toolbareditor/$FILE
      fi
      if test -e $EGGDIR/treeviewutils/$FILE ; then
          SRCFILE=$EGGDIR/treeviewutils/$FILE
      fi
      if test -e $EGGDIR/dropdowntoolbutton/$FILE; then
      SRCFILE=$EGGDIR/dropdowntoolbutton/$FILE
      fi
  fi
  if cmp -s $SRCFILE $FILE; then
     echo "File $FILE is unchanged"
  else
     cp $SRCFILE $FILE || die "Could not move $SRCFILE to $FILE"
     echo "Updated $FILE"
  fi
done