File: Package.sh

package info (click to toggle)
lammps 0~20140523.gite5e877d-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 193,012 kB
  • ctags: 48,147
  • sloc: cpp: 458,874; python: 21,769; fortran: 16,023; ansic: 12,503; perl: 3,687; sh: 3,221; makefile: 1,366; f90: 1,177; xml: 788; objc: 238; lisp: 169; tcl: 61; csh: 16; awk: 14
file content (87 lines) | stat: -rw-r--r-- 2,242 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Package.sh = package management, called from Makefile
# Syntax: sh Package.sh DIR status/update/overwrite/diff

# package is already installed if any package *.cpp or *.h file is in src
# else not installed

cd $1

installed=0
for file in *.cpp *.h; do
  if (test -e ../$file) then
    installed=1
  fi
done

# status, only if installed
# issue warning for any package file not in src or that is different

if (test $2 = "status") then
  if (test $installed = 1) then
    echo "Installed YES: package $1"
    for file in *.cpp *.h; do
      if (test ! -e ../$file) then
        echo "  src/$file does not exist"
      elif (! cmp -s $file ../$file) then
        echo "  src/$file and $1/$file are different"
      fi
    done
  else
    echo "Installed  NO: package $1"
  fi

# update, only if installed
# perform a re-install, but only if the package is already installed

elif (test $2 = "update") then
  echo "Updating src files from $1 package files"
  if (test $installed = 1) then
    echo "  updating package $1"
    if (test -e Install.sh) then
      /bin/sh Install.sh 2
    else
      /bin/sh ../Install.sh 2
    fi
    cd ..
    /bin/sh Depend.sh $1
  else
    echo "  $1 package is not installed"
  fi

# overwrite, only if installed
# overwrite package file with src file, if the two are different

elif (test $2 = "overwrite") then
  echo "Overwriting $1 package files with src files"
  if (test $installed = 1) then
    for file in *.cpp *.h; do
      if (test ! -e ../$file) then
        continue
      elif (! cmp -s $file ../$file) then
        echo "  overwriting $1/$file"
        cp ../$file .
      fi
    done
  else
    echo "  $1 package is not installed"
  fi

# diff
# if installed:
# show any differences between src files and package files

elif (test $2 = "diff") then
  if (test $installed = 1) then
    echo "Installed YES: package $1"
    for file in *.cpp *.h; do
      if (test ! -e ../$file) then
        echo "  src/$file does not exist"
      elif (! cmp -s $file ../$file) then
        echo "************************************************"
        echo "diff -u $1/$file src/$file "
        echo "************************************************"
	diff -u $file  ../$file 
      fi
    done
  fi
fi