-
Notifications
You must be signed in to change notification settings - Fork 0
/
serialver.csh
executable file
·134 lines (110 loc) · 3.18 KB
/
serialver.csh
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/sh
#
# Script to run the serialver tool on a JMRI class
#
# First argument is fully=qualified class name.
#
# Made from the runtest.csh script, January 2010
#
# If you need to add any additional Java options or defines,
# include them in the JMRI_OPTIONS environment variable
#
# You can run separate instances of the program with their
# own preferences and setup if you either
# *) Provide the name of a configuration file as the 1st argument
# or
# *) Copy and rename this script.
#
# If you rename the script to e.g. JmriNew, it will use "JmriNewConfig2.xml"
# as it's configuration file. You can then set and save the preferences for
# the next time you rerun the script.
#
# If you are getting X11 warnings about meta keys, uncomment the next line
# xprop -root -remove _MOTIF_DEFAULT_BINDINGS
#
# For more information, please see
# http://jmri.org/install/ShellScripts.shtml
#
SYSLIBPATH=
if [ -z "$OS" ]
then
# start finding the architecture specific library directories
OS=`uname -s`
# normalize to match our standard names
if [ "$OS" = "Linux" ]
then
OS="linux"
fi
if [ "$OS" = "Darwin" ]
then
OS="macosx"
fi
fi
if [ -d "lib/$OS" ]
then
SYSLIBPATH="lib/$OS"
fi
# one or another of these commands should return a useful value, except that sometimes
# it is spelled funny (e,g, amd64, not x86_64).
if [ -z "$ARCH" ]
then
for cmd in "arch" "uname -i" "uname -p"
do
ARCH=`$cmd 2>/dev/null`
if [ -n "$ARCH" ]
then
if [ "$ARCH" = "amd64" ]
then
ARCH="x86_64"
fi
if [ "$ARCH" = "i686" ]
then
ARCH="i386"
fi
if [ -d "lib/$OS/$ARCH" ]
then
SYSLIBPATH="lib/$OS/$ARCH:$SYSLIBPATH"
# we're only interested in ONE of these values, so as soon as we find a supported
# architecture directory, continue processing and start up the program
break
fi
fi
done
fi
# define the class to be invoked
CLASSNAME=$1
# set DEBUG to anything to see debugging output
# DEBUG=yes
# if JMRI_HOME is defined, go there, else
# change directory to where the script is located
if [ "${JMRI_HOME}" ]
then
cd "${JMRI_HOME}"
else
cd `dirname $0`
fi
[ "${DEBUG}" ] && echo "PWD: '${PWD}'"
# build classpath dynamically
CP=".:classes:target/classes"
# list of jar files in home, not counting jmri.jar
LOCALJARFILES=`ls *.jar | grep -v jmri.jar | tr "\n" ":"`
if [ ${LOCALJARFILES} ]
then
CP="${CP}:${LOCALJARFILES}"
fi
# add jmri.jar
CP="${CP}:jmri.jar"
# and contents of lib
CP="${CP}:`ls -m lib/*.jar | tr -d ' \n' | tr ',' ':'`"
# add a stand-in for ${ant.home}/lib/ant.jar
CP="${CP}:/usr/share/ant/lib/ant.jar"
[ "${DEBUG}" ] && echo "CLASSPATH: '${CP}'"
# create the option string
#
# Add JVM and RMI options to user options, if any
OPTIONS=" ${JMRI_OPTIONS} "
# Format to add more options:
#OPTIONS="${OPTIONS} -Djava.library.path=.:lib:$SYSLIBPATH"
[ "${DEBUG}" ] && echo "OPTIONS: '${OPTIONS}'"
[ "${DEBUG}" ] && echo java ${OPTIONS} -cp "${CP}" "${CLASSNAME}" ${CONFIGFILE}
serialver ${OPTIONS} -classpath "${CP}" "${CLASSNAME}" $2 $3