summaryrefslogtreecommitdiff
path: root/cut-n-paste-code/libegg/update-from-egg.sh
blob: 9be68a9b4ef649794f3b41052e859cd0f5abcd65 (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
#!/bin/sh

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
  if cmp -s $EGGDIR/$FILE $FILE; then
     echo "File $FILE is unchanged"
  else
     cp $EGGDIR/$FILE $FILE || die "Could not move $EGGDIR/$FILE to $FILE"
     echo "Updated $FILE"
  fi
done