Jump to content


Schoelje

Member Since 13 Aug 2013
Offline Last Active Aug 18 2017 06:28 PM
-----

Posts I've Made

In Topic: url rewrite from IP to localhost

04 November 2013 - 08:23 PM

I presume hostInfo is used to handle relative URL's.

 

I'm going to continue testing my above startup script, but I would very much appreciate it if you can post back your findings on you workaround.


In Topic: url rewrite from IP to localhost

04 November 2013 - 01:47 PM

Update

 

I am testing the following startup script.

I'll post back with the results when I'm done.

#!/bin/bash

# Short-Description: Write network lan ip to perInstance.php

# =========== manual configuration - start ===========
# Local www directory
LOCALBASEDIR='/var/www'
# Local Zurmo sub-direcotry from LOCALBASEDIR
ZURMODIR='zurmo'
# ==================================== end ===========

# Path to perInstance.php
INSTANCE='app/protected/config/perInstance.php'

if [ -e "$LOCALBASEDIR/$ZURMODIR/$INSTANCE" ]; then
  # GET network IP
  NWIP=$(ifconfig | grep inet.*Bcast | awk -F: '{print $2}' | sed -e 's/Bcast//' | sed -e 's/ //g')

  if [ "$NWIP" != "" ]; then
    # Check if page exists
    NOTFOUND=$(wget -nv "http://$NWIP/$ZURMODIR/$INSTANCE" -o /tmp/wget-output; grep "404" /tmp/wget-output)

    # Replace if no 404 was returned, and the IP is not already in the perInstance.php file
    if [ "$NOTFOUND" == "" ] && ! grep -Fq "http://$NWIP" "$LOCALBASEDIR/$ZURMODIR/$INSTANCE"; then
      sed -i "s/'http:\/\/.*'/'http:\/\/$NWIP'/" "$LOCALBASEDIR/$ZURMODIR/$INSTANCE"
    fi
  fi
fi

# Open Zurmo in the default browser
xdg-open http://localhost/zurmo/


In Topic: url rewrite from IP to localhost

19 October 2013 - 09:00 PM

Yes, I've been thinking about that too, but I preferred a more elegant solution than a sed hack.

 

That said, I'd like to share what I've come up with.

I've packaged Zurmo to be able to easily install through our repository. After the installation has completed, I need to find out what's the network IP address, and write that to perInstance.php.

 

You would get something like (not tested):

$NWIP=$(ifconfig | grep inet.*Bcast | awk -F: '{print $2}' | sed -e 's/Bcast//' | sed -e 's/ //g')
sed -i "s/localhost/$NWIP/" app/protected/config/perInstance.php

The problem is handling errors being returned, checking if it's a real IP before the sed command to be sure we're not making things worse. Any workaround is just asking for trouble.

 

I will have some time this week to test this, and report back when I'm done.


In Topic: url rewrite from IP to localhost

18 October 2013 - 04:49 PM

Thank you eamoros, for your reply.

 

However, that same answer has already been given by raysto here: http://zurmo.org/for...host/#entry8134

and my following answer is still valid.

 

The Zurmo install I'm talking about is distributed with SolydK Back Office. After install, an administrator would have to change the file manually, but I cannot expect that all users are confident to do that.

 

If you want to know more about SolydK Back Office: http://solydxk.com/products/solydkbo/


In Topic: Zurmo 2.0.18 - Install halts

07 September 2013 - 11:32 AM

Do you have any feedback on the Debian package I created?