# HG changeset patch # User stooke@redhat.com # Date 1503678385 14400 # Node ID 3d69f746e18fecdc6a041be6fb493acbd5c4ddd1 # Parent 255adf10b4fd16313b644dca50dad6905e227725 Restore windows compatibility for thermostat-ng.sh This patch restores Windows compatibility for thermostat-ng.sh. Under Cygwin, $HOME points into the Cygwin install directory, but Thermostat uses the user's Windows home directory ( supplied as $USERPROFILE). This patch writes the agent.auth file to the correct location. Other changes a syntax error that only seemed to be triggered under macOS, ensuring the sense of all Windows if() are the same, and correcting the credentials message displayed at start up. Reviewed-by: neugens, aazores Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-August/024687.html diff -r 255adf10b4fd -r 3d69f746e18f thermostat-ng.sh --- a/thermostat-ng.sh Tue Aug 22 14:04:45 2017 +0200 +++ b/thermostat-ng.sh Fri Aug 25 12:26:25 2017 -0400 @@ -80,9 +80,7 @@ mongodb() { local action="$1" case $action in - start) - ;& # fall-through - stop) + start|stop) if [ $CYGWIN_MODE == 1 ] ; then $WEB_GATEWAY_ROOT/distribution/target/image/bin/thermostat-mongodb.sh $action & else @@ -208,7 +206,11 @@ } config_agent() { - local agent_conf_dir="$HOME/.thermostat/etc" + if [ $CYGWIN_MODE == 1 ] ; then + local agent_conf_dir="`cygpath -u ${USERPROFILE}`/.thermostat/etc" + else + local agent_conf_dir="$HOME/.thermostat/etc" + fi local agent_conf="${agent_conf_dir}/agent.auth" if [ ! -d "$agent_conf" ]; then mkdir -p "$agent_conf_dir" @@ -216,10 +218,10 @@ echo "username=agent" > $agent_conf echo "password=agent-pwd" >> $agent_conf ## convert Windows backslashes in paths to '/' - if [ $CYGWIN_MODE == 0 ] ; then + if [ $CYGWIN_MODE == 1 ] ; then + sed sX\\\\X/Xg $AGENT_ROOT/distribution/target/image/etc/examples/ssl.properties.example >$AGENT_ROOT/distribution/target/image/etc/ssl.properties + else cp $AGENT_ROOT/distribution/target/image/etc/examples/ssl.properties.example $AGENT_ROOT/distribution/target/image/etc/ssl.properties - else - sed sX\\\\X/Xg $AGENT_ROOT/distribution/target/image/etc/examples/ssl.properties.example >$AGENT_ROOT/distribution/target/image/etc/ssl.properties fi } @@ -250,7 +252,7 @@ idle() { echo "Thermostat started. Stop with CTRL+C" echo "The web client can be accessed at: $GATEWAY_URL/web-client/" - echo "Use credentials 'test-user':'test-pass' to log in." + echo "Use credentials 'client':'client-pwd' to log in." while true; do sleep 60 done