1# Install/unInstall package files in LAMMPS
2# mode = 0/1/2 for uninstall/install/update
3
4# this is default Install.sh for all packages
5# if package has an auxiliary library or a file with a dependency,
6# then package dir has its own customized Install.sh
7
8mode=$1
9
10# arg1 = file, arg2 = file it depends on
11
12action () {
13  if (test $mode = 0) then
14    rm -f ../$1
15  elif (! cmp -s $1 ../$1) then
16    if (test -z "$2" || test -e ../$2) then
17      cp $1 ..
18      if (test $mode = 2) then
19        echo "  updating src/$1"
20      fi
21    fi
22  elif (test -n "$2") then
23    if (test ! -e ../$2) then
24      rm -f ../$1
25    fi
26  fi
27}
28
29# all package files with no dependencies
30# explicity exclude wildcard actions
31for file in *.cpp *.h; do
32
33  if [ "$file" == "*.cpp" ];then
34     continue
35  fi
36  if [ "$file" == "*.h" ];then
37     continue
38  fi
39
40  #echo "action for file $file"
41  action $file
42done
43