Running "rhqctl install" on a Solaris 10 fails with:
./rhq-server.sh: syntax error at line 569: `max_wait_seconds=$' unexpected
15:35:29,279 INFO [org.jboss.modules] JBoss Modules version 1.2.2.Final-redhat-1
15:35:29,380 INFO [org.rhq.enterprise.server.installer.InstallerServiceImpl] The server is preconfigured and ready for auto-install.
15:35:29,473 INFO [org.xnio] XNIO Version 3.0.7.GA-redhat-1
15:35:29,488 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.7.GA-redhat-1
15:35:29,496 INFO [org.jboss.remoting] JBoss Remoting version 3.2.16.GA-redhat-1
15:35:39,802 ERROR [org.rhq.enterprise.server.installer.Installer] The installer will now exit due to previous errors: java.lang.Exception: Cannot obtain client connection to the RHQ app server!!
Caused by: java.io.IOException: java.net.ConnectException: JBAS012144: Could not connect to remote://127.0.0.1:9999. The connection timed out
The reason is simple:
max_wait_seconds=$(expr $RHQ_SERVER_STOP_DELAY \* 60)
and line 572:
waited_seconds=$(expr $waited_seconds + 2)
The $() syntax does not work on Solaris 10 (it does on Solaris 11)
Those lines need to become:
max_wait_seconds=`expr $RHQ_SERVER_STOP_DELAY \* 60`
waited_seconds=`expr $waited_seconds + 2`
which will work on all *NIX based platforms (old and new)
To be clear, this issue is not limited to Solaris 10. This issue is a result of using /bin/sh as the command interpreter. /bin/sh is Bourne shell while /bin/bash is Bourne Again SHell. The scripts appear to be written for BASH as their target.
The default file system layout for many operating systems do not install /bin/sh by default. As such, the system installed/default command interpreter creates a symbolic link to itself as /bin/sh. Meaning:
/bin/sh -> /bin/bash
However, if /bin/sh is really installed, it will be used. In the case of rhq-server.sh (and the other JBoss ON scripts) we define the command interpreter as:
That being said, I think that we should probably aim for making the scripts work with Bourne shell as it is still in use by some of the supported platforms used today.
needed to fix rhq-agent-wrapper.sh, rhq-server.sh, and rhq-data-migration.sh since they all used the $() syntax.
git commit to master: 6cfdf2d
since this is targeted for 3.2.2, I fixed this in release/jon3.2.x branch as well.
There was only one file that needed to be fixed in this branch (rhq-server.sh), the other files hadn't yet used the bad syntax).
release/3.2.x commit: ea6fdbd
forgot to fix rhqctl script - committed that fix to master: 1b82fcd5c1e557e4d76cb367bf029c9dca2cb461
Via product triage, determined that this bug is to be included for DR01 target milestone.
The update script "apply-updates.sh" for JON 3.2.0 Update 01 is also affected by this problem.
This script uses the Bash-specific "if [[ ... ]]" syntax. When the script is run on Ubuntu 12.04 LTS, error messages like
./apply-updates.sh: 48: ./apply-updates.sh: [[: not found
are displayed. This happens because Ubuntu uses Dash instead of Bash for /bin/sh.
Moving to ON_QA as available for test in latest cumulative patch build(DR01):
Reproduced the issue on JBoss ON 3.2 GA when running 'rhqctl install' on solaris 10 box.
Applied 3.2.0.GA-Update-02 and tried 'rhqctl install'. The installer completed without error.
Marking this bug as verified.
This has been verified and released in Red Hat JBoss Operations Network 3.2 Update 02 (3.2.2) available from the Red Hat Customer Portal.