Skip to content

Commit 8920391

Browse files
committed
Java 5 to Java 8 BND script
1 parent 09baab6 commit 8920391

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Diff for: bnd.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
3+
JAVA_HOME=/opt/jdk1.5.0
4+
export JAVA_HOME
5+
6+
PATH=$JAVA_HOME/bin:$PATH
7+
export PATH
8+
9+
for jarFile in $*
10+
do
11+
base=`basename $jarFile .jar`
12+
javaVersion=`echo $base | sed -e "s/.*\(jdk..\).*/\\1/"`
13+
name=`echo $base | sed -e "s/\([^-]*\)-jdk.*/\\1/"`
14+
bcVersion=`echo $base | sed -e "s/$name-${javaVersion}.*-\(1.*\)/\\1/" | sed -e "s/b/.0./"`
15+
baseVersion=`echo $bcVersion | sed -e "s/[^.]*.\([0-9]*\).*/\\1/"`
16+
bcMaxVersion="`expr "${baseVersion}" "+" "1"`"
17+
18+
if [ "`echo $bcVersion | fgrep b`" = "$bcVersion" ]
19+
then
20+
bcVersion=`echo $bcVersion | sed -e "s/50b/49./"`
21+
fi
22+
23+
if `echo $jarFile | fgrep bcprov > /dev/null`
24+
then
25+
cat > /tmp/bnd.props <<%
26+
Bundle-Version: $bcVersion
27+
Bundle-Name: $name
28+
Bundle-SymbolicName: $name
29+
Bundle-RequiredExecutionEnvironment: J2SE-1.5
30+
Export-Package: org.bouncycastle.*;version=$bcVersion
31+
Import-Package: *;resolution:=optional
32+
%
33+
else
34+
cat > /tmp/bnd.props <<%
35+
Bundle-Version: $bcVersion
36+
Bundle-Name: $name
37+
Bundle-SymbolicName: $name
38+
Bundle-RequiredExecutionEnvironment: J2SE-1.5
39+
Export-Package: org.bouncycastle.*;version=$bcVersion
40+
Import-Package: org.bouncycastle.*;version="[${bcVersion},1.${bcMaxVersion})",*;resolution:=optional
41+
%
42+
fi
43+
44+
java -jar $BND_HOME/biz.aQute.bnd-2.2.0.jar wrap --properties /tmp/bnd.props $jarFile
45+
mv $base.jar $jarFile
46+
done

0 commit comments

Comments
 (0)