Re: [opennms-devel] Debian packaging

Alex Bennee <[email protected]>
Newsgroups gmane.network.opennms.bugs
Message-ID <1216650397.27548.14.camel__26388.2150793963$1216650427$gmane$org@pitcairn.cambridgebroadband.com>
On Mon, 2008-07-21 at 13:54 +0000, Alex Bennee wrote:
> Hi,
> 
> I'm having trouble working out the correct way to fix this. On an
> upgrade to opennms with a new package I've built it fails as JAVA_HOME
> is not set in /etc/default/opennms.
> 
> The postinst script should work, although the current logic prefers
> runjava -s over manually hacking the JAVA_HOME:
> 
> 	if [ -x /usr/lib/jvm/java-6-openjdk/bin/java ]; then
> 		/usr/share/opennms/bin/runjava -q -S /usr/lib/jvm/java-6-openjdk/bin/java || :
> 		(grep -v ^JAVA_HOME /etc/default/opennms ; echo 'JAVA_HOME=/usr/lib/jvm/java-6-openjdk') > /etc/default/opennms.new
> 		mv /etc/default/opennms.new /etc/default/opennms
> 

Ok, I'm obviously missing some subtle bash-ism, because the grep magic
is run but the echo of "JAVA_HOME" only occurs if there is a comment
line:

root@vnms1:~# cat /etc/default/opennms
root@vnms1:~# sh +x ./opennms-common.postinst configure
+ [ -x /usr/lib/jvm/java-6-openjdk/bin/java ]
+ /usr/share/opennms/bin/runjava -q -S /usr/lib/jvm/java-6-openjdk/bin/java
+ grep -v ^JAVA_HOME /etc/default/opennms
+ mv /etc/default/opennms.new /etc/default/opennms
+ exit 0
root@vnms1:~# echo "# hello hello" > /etc/default/opennms
root@vnms1:~# sh +x ./opennms-common.postinst configure
+ [ -x /usr/lib/jvm/java-6-openjdk/bin/java ]
+ /usr/share/opennms/bin/runjava -q -S /usr/lib/jvm/java-6-openjdk/bin/java
+ grep -v ^JAVA_HOME /etc/default/opennms
+ echo JAVA_HOME=/usr/lib/jvm/java-6-openjdk
+ mv /etc/default/opennms.new /etc/default/opennms
+ exit 0
root@vnms1:~# cat /etc/default/opennms
# hello hello
JAVA_HOME=/usr/lib/jvm/java-6-openjdk
root@vnms1:~# echo "JAVA_HOME=/usr/lib/jvm/java-6-openjdk" > /etc/default/opennms
root@vnms1:~# sh +x ./opennms-common.postinst configure
+ [ -x /usr/lib/jvm/java-6-openjdk/bin/java ]
+ /usr/share/opennms/bin/runjava -q -S /usr/lib/jvm/java-6-openjdk/bin/java
+ grep -v ^JAVA_HOME /etc/default/opennms
+ mv /etc/default/opennms.new /etc/default/opennms
+ exit 0
root@vnms1:~# cat /etc/default/opennms
root@vnms1:~# 

Or is this simply a bug in bash?

-- 
Alex Bennee, Software Engineer
Does the same as the system call of that name. If you don't know what it
does, don't worry about it. -- Larry Wall in the perl man page regarding
chroot(2)


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.