Ksu
9th August 2007 10:11 UTC
How to use AWK in my Install Script?
Hi everyone,
first off english isn't my main language so I hope I can explain my problem somehow clear :)
I have an urgent problem that I need to solve asap, hope someone can help me.
I'm making an installer for an application I made. For this application I need apache to be installed for the web interface. Now I have included apache into my installer, but I need to edit the httpd.conf so it points to the install dir where the user wants to install the application.
After some searching I found that AWK is the tool I need.
But the problem is when I want to substitute a placeholder in the httpd.conf with my installation direcotry, the direcotry needs to be passed to AWK like C:\\Program Files\\MyApplication for AWK to recognize the "\"
So my question is, how can I add the additional "\\" to the $INSTDIR variable of NSIS?
Thanks in advance for any help!
Greetings
Red Wine
9th August 2007 10:26 UTC
There's a function in wiki tailored for the case,
http://nsis.sourceforge.net/Convert_...ng_or_dir_path
Ksu
9th August 2007 10:34 UTC
Ahh I overlooked this one! Perfect, thanks!
Ksu
16th August 2007 10:33 UTC
Ok I have another problem with AWK and NSIS.
In a DOS box I would type my command like this in the directory C:\Test\install\:
awk.exe -v DIR="C:\\Test" "{gsub(/PLACEHOLDER/, DIR; print}" test.cfg > C:\Test\config\test.cfg
This will replace all the words PLACEHOLDER in my test.cfg with the DIR Variable and save it to C:\Test\config\test.cfg.
Works perfect.
But when I call this command with nsexec, I always get an error from awk stating: "Can't open file >" so it looks like the ">" character makes a problem?
Here is how I call my awk command from NSIS:
SetOutPath $INSTDIR\install
nsexec::exectolog 'awk.exe -v DIR=$\"$R0$\" $\"{gsub(/PLACEHOLDER/, DIR); print}$\" test.cfg > "$INSTDIR\config\test.cfg"'
I always get the error "Can't open file >", so do I need to escape > somehow? I didn't find anything in the manual.
Or is there a problem with my quoting in this command?