~ubuntu-branches/ubuntu/saucy/geant321/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/302-scripts-comply-with-FHS.dpatch.in

  • Committer: Bazaar Package Importer
  • Author(s): Kevin B. McCarty
  • Date: 2006-07-06 09:43:53 UTC
  • Revision ID: james.westby@ubuntu.com-20060706094353-w4gdbptc5kklds1t
Tags: 1:3.21.14.dfsg-1
* Split off GEANT 3.21 into a separate source package.  Use the version
  numbering embedded in source instead of the date of release.

* For previous changelog entries (versions 2005.05.09.dfsg-9 and earlier),
  please see the changelog.Debian in the cernlib-base binary package or
  the cernlib source package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 302-scripts-comply-with-FHS.dpatch by  <kmccarty@debian.org>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Put data files under @DATADIR@ and assume $CERN is @PREFIX@ by default
 
6
## DP: in scripts.  (These values are filled in from add-ons/Makefile.)
 
7
## DP: Also some other improvements.
 
8
 
 
9
@DPATCH@
 
10
diff -urNad cernlib-2005.05.09.dfsg~/src/scripts/gxint cernlib-2005.05.09.dfsg/src/scripts/gxint
 
11
--- cernlib-2005.05.09.dfsg~/src/scripts/gxint  2005-04-18 11:41:16.000000000 -0400
 
12
+++ cernlib-2005.05.09.dfsg/src/scripts/gxint   2005-12-13 10:07:57.789716862 -0500
 
13
@@ -1,4 +1,4 @@
 
14
-#!/bin/sh
 
15
+#!/bin/bash
 
16
 #
 
17
 #*******************************************
 
18
 #
 
19
@@ -17,8 +17,7 @@
 
20
 #*******************************************
 
21
 line="******************************************************"
 
22
  
 
23
 
24
-if [ $# -eq 0 ] ; then
 
25
+print_help() { 
 
26
 cat << EoD
 
27
 
 
28
  GXINT [options] file(s)
 
29
@@ -32,9 +31,13 @@
 
30
         on all systems. X11 is the default.
 
31
   -v version
 
32
         version of the program library to use. Possible values
 
33
-        include pro ( default ), new and old.
 
34
+        include pro, new and old. This option only makes sense if you
 
35
+       have installed a non-Debian version of Cernlib. In that case
 
36
+       you must have defined the environment variable \$CERN.
 
37
   -g geant_version
 
38
-        which version of geant to use. Current default is 315.
 
39
+        which version of geant to use. Current default is 321. This
 
40
+       also makes sense only if you have installed a non-Debian version
 
41
+       of Cernlib.
 
42
   -h host
 
43
         useful with the -d X11 option only. Specify the hostname
 
44
         used for the display. Syntax identical to that of DISPLAY.
 
45
@@ -43,16 +46,20 @@
 
46
         Do not immediately run GEANT, but produce an executable
 
47
         file named outputfile.
 
48
   -L path
 
49
-        additional loader search path. Usefull if additional libraries
 
50
-        are specified with -l option.  This option may be repeated to
 
51
+        additional loader search path. Useful if additional libraries
 
52
+        are specified with -l option. This option may be repeated to
 
53
         more than one pathname.
 
54
-  -l libary
 
55
+  -l library
 
56
         specify additional libraries. This option may be repeated to
 
57
         add several libs.
 
58
   -m    do NOT use main program from cernlib area.
 
59
 
 
60
 EoD
 
61
-exit
 
62
+}
 
63
+
 
64
 
65
+if [ $# -eq 0 ] ; then 
 
66
+       print_help
 
67
 fi
 
68
 
 
69
 if [ -f /usr/bin/uname ] ; then
 
70
@@ -66,52 +73,47 @@
 
71
 fi
 
72
 
 
73
  SHOPT="d:v:g:h:o:L:l:m"
 
74
- cmd=$0
 
75
 # Check option set and give default values
 
76
   if [ -f /bin/getopt -o -f /usr/bin/getopt ] ; then
 
77
      set -- `getopt $SHOPT $*` ; cc=$?
 
78
      if [ $cc -ne 0 ] ; then
 
79
        echo ""
 
80
        echo "Usage:"
 
81
-       exec $cmd
 
82
-       exit
 
83
+       print_help ; exit 0
 
84
      fi
 
85
   fi
 
86
 
87
-drv="/X11" ; ver="pro" ; OUT="${HOME}/GEANT$$"
 
88
+
 
89
+if [ -z "$TMPDIR" ] || [ "$TMPDIR" = "/tmp" ] ; then
 
90
+  TMPDIR="$HOME"
 
91
+fi
 
92
+drv="/X11" ; ver="" ; OUT="$TMPDIR/GEANT$$"
 
93
 gxint=""
 
94
  
 
95
 while [ $# -gt 0 ]
 
96
 do case $1 in
 
97
-     -d) drv="/$2";                     shift ;;
 
98
+     -d) drv="/$2";                  shift ;;
 
99
      -v) ver=$2;                     shift ;;
 
100
      -g) gvs=$2;                     shift ;;
 
101
      -h) DISPLAY=$2;export DISPLAY;  shift ;;
 
102
      -o) OUT=$2; norun="1";          shift ;;
 
103
-     -L) userpath="$userpath -L$2"; shift ;;
 
104
-     -l) userlibs="$userlibs -l$2"; shift ;;
 
105
+     -L) userpath="$userpath -L$2";  shift ;;
 
106
+     -l) userlibs="$userlibs -l$2";  shift ;;
 
107
      -m) _m="1"                                   ;;
 
108
      --)                     shift ; break ;;
 
109
+     --help|-\?) print_help ; exit 0      ;;
 
110
       *)                             break ;;
 
111
    esac
 
112
    shift
 
113
 done
 
114
  
 
115
 if [ $# -gt 0 ] ; then
 
116
-   pgm="$*"
 
117
+   pgm="$@"
 
118
  else
 
119
    echo "gxint_Warning: no user program specified"
 
120
 fi
 
121
  
 
122
  
 
123
 
124
-if [ -z "$CERN" ] ; then
 
125
-  if [ ! -d /cern ]; then
 
126
-   echo "gxint_Error: shell variable CERN must be set or /cern must exist"
 
127
-   exit 1
 
128
-  fi
 
129
-  CERN="/cern" ; export CERN
 
130
-fi
 
131
+[ -z "$CERN" ] && export CERN="@PREFIX@"
 
132
  
 
133
 if [ "$drv" = "/GKS" ] ; then
 
134
   if [ -z "$GKSR" ] ; then
 
135
@@ -143,6 +145,7 @@
 
136
 CLIB="geant${gvs} pawlib graflib$drv packlib mathlib"
 
137
  
 
138
 [ -z "$_m" ] && gxint="${CERN}/${ver}/lib/gxint${gvs}.$_o" 
 
139
+[ "$CERN" = "@PREFIX@" -a -z "$ver" ] && gxint=@DATADIR@/geant321/gxint.f
 
140
  
 
141
 cat << EoD
 
142
 $line
 
143
@@ -155,8 +158,10 @@
 
144
 *   gxint used        : ${gxint:-user supplied}
 
145
 $line
 
146
 EoD
 
147
 
148
-$LDN -o $OUT $gxint $pgm $userpath $userlibs `cernlib -v $ver $CLIB`; cc=$?
 
149
+
 
150
+[ -z "$ver" ] && verflag="" || verflag="-v"
 
151
+$LDN -o $OUT $gxint $pgm $userpath $userlibs `cernlib $verflag $ver $CLIB` ; \
 
152
+cc=$?
 
153
  
 
154
 [ $cc -ne 0 ] && exit $cc
 
155
  
 
156
diff -urNad cernlib-2005.05.09.dfsg~/src/scripts/paw cernlib-2005.05.09.dfsg/src/scripts/paw
 
157
--- cernlib-2005.05.09.dfsg~/src/scripts/paw    1995-02-07 04:54:06.000000000 -0500
 
158
+++ cernlib-2005.05.09.dfsg/src/scripts/paw     2005-12-13 10:10:17.850939931 -0500
 
159
@@ -21,9 +21,9 @@
 
160
   SHOPT="d:h:v:"
 
161
 #SEQ,GETOPTD.
 
162
   [ "`uname -s`" = "DomainOS" ] && drv="GKS" || drv="X11"
 
163
-  [ -z "$CERN"       ] && CERN="/cern"
 
164
-  [ -z "$CERN_LEVEL" ] && ver="pro" || ver="$CERN_LEVEL"
 
165
 
166
+  [ -z "$CERN"       ] && CERN="@PREFIX@"
 
167
+  [ -z "$CERN_LEVEL" ] && ver="" || ver="$CERN_LEVEL"
 
168
+  [ -e "$CERN/$CERN_LEVEL/bin/pawX11" ] || drv="++" # use paw++ if no pawX11
 
169
   while [ $# -gt 0 ]
 
170
   do case $1 in
 
171
        -d) drv=$2 ; shift      ;;
 
172
@@ -43,15 +43,26 @@
 
173
 #    inlib $GKS_INLIB
 
174
      GDIR=$CERN/$ver/gksbin
 
175
   fi
 
176
-  if [ "$drv" = "X11" -a -n "$hst" ] ; then
 
177
+  if [ \( "$drv" = "X11" -o "$drv" = "++" \) -a -n "$hst" ] ; then
 
178
      nw=`echo $hst | awk -F: '{ print NF }'`
 
179
      [ $nw -eq 1 ] && hst="$hst:0"
 
180
      DISPLAY="$hst" ; export DISPLAY
 
181
   fi
 
182
-  if [ "$ver" != "pro" ] ; then
 
183
+  if [ -n "$ver" ] ; then
 
184
      echo
 
185
      echo " Calling $ver version of paw-$drv"
 
186
      echo
 
187
   fi
 
188
-  $GDIR/paw$drv $*
 
189
-  [ ! -s paw.metafile ] && rm paw.metafile
 
190
+  if [ ! -x "$GDIR/paw$drv" ] ; then
 
191
+     echo " Error: PAW executable $GDIR/paw${drv} does not exist!"
 
192
+     exit 1
 
193
+  fi
 
194
+  "$GDIR/paw$drv" "$@"
 
195
+  [ ! -s paw.metafile ] && rm -f paw.metafile
 
196
+  [ ! -s PAW.METAFILE ] && rm -f PAW.METAFILE
 
197
+
 
198
+  # clean up comis temporary working directories if empty
 
199
+  [ "`(echo /tmp/comis*) 2> /dev/null`" = '/tmp/comis*' ] || \
 
200
+    rmdir /tmp/comis* > /dev/null 2>&1 || true
 
201
+  [ "`(echo "$TMPDIR"/comis*) 2> /dev/null`" = "$TMPDIR"/'comis*' ] || \
 
202
+    rmdir "$TMPDIR"/comis* > /dev/null 2>&1 || true