Can I call a UNIX script from Nant on an XP machine - nant

I have installed TeamCity and what to call a UNIX script from a step in it using using Nant. Done a simple test to see that I can call a Nant build that simply writes a test message. Now I am tring to build the code to call a Unix script and cannot find anything of use on the WEB. Does anyone know if it can be done?
Thanks
Angus

Windows XP can't execute Unix scripts, so nant can't do it either.
You can install cygwin which can execute Unix scripts and then use that through nant's exec task.
Something like:
<exec program="c:\cygwin\bin\bash.exe" commandline="--login -i myscript.sh" />

Related

Run a [Code] or PowerShell script in Inno Setup compiler

Is there a way to run a [Code] procedure or PowerShell script in the Inno Setup compiler before the installation executable is generated?
You may get better answers, if you explain what you need to run the code for. Anyway...
One way is to compile the script on command-line from a batch file:
powershell -file precompile.ps1
ISCC.exe setup.iss
powershell -file postcompile.ps1
(or you can call ISCC.exe from the PowerShell script itself)
Another way to run some script before compilation is using Exec preprocessor function.
#expr Exec("precompile.bat")
or
#expr Exec("powershell -file precompile.ps1")
See also Is it possible to call a batch file while compiling an Inno Setup script?
If you need a GUI solution, there's ISTool, an Inno Setup extension, that has direct support for Pre Compilation and Post Compilation "Steps". But this project is unfortunately no longer maintained. You might be able to update it to the latest Inno Setup version, as it is open source.

perl automate installation of SAX module

One of my perl script uses XML::SAX module. As this script would be run from any system on the network, I am working on writing a shell script which would automatically download the module and install it in a private lib.
The script works fine but in the middle of it, this question comes up:
Checking if your kit is complete...
Looks good
Warning: prerequisite XML::SAX::Base 1.05 not found. We have 1.04.
Do you want XML::SAX to alter ParserDetails.ini? [Y]
And the program waits for user input. Is there any way to skip this?
These scripts will be run as remote jobs and the people running the jobs aren't going to be looking at the console very often.
Also, I tried working with expect, but I get the error 'spawn' not found. So I'm thinking it's not a part of the standard shell utility.
Please advise if this is possible at all.
Configure your cpan client to use follow as the prerequisites_policy. In the cpan shell, enter:
o conf prerequisites_policy follow
o conf commit

Make a Shell script calling Perl scripts executable in windows

My question is I have folder containing 3 scripts(perlx2 and shellx1) and an internal folder of data that I wish to use in the perl scripts.
The shell script calls the two perl scripts consecutively the first one creating a file and the second one performing an analysis of the data from the created file.
From reading I could use Active perl or something of the sort to package the Perls scripts to be executable for a basic windows user. However I think it would make more sense if I made a sort of Batch file that will run the whole set of programs.
Sorry about my lack of knowledge I would love some help with this.
Thanks!
Running perl scripts from a .bat in Windows
Installation & Configuration of perl
First, install perl (I prefer Strawberry Perl but ActivePerl will work too).
This should put perl in your path, to check open up a command line and type:
echo %PATH%
You should see C:\strawberry\perl\bin in there (perl is in that directory).
Adding perl to your path (skip if already present)
Navigate Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables. Choose Path and append the following to the variable:
;C:\strawberry\c\bin;C:\strawberry\perl\bin
Close your command shell and open a new one. Retry echo %PATH%.
Assuming perl is in your path now...
Make a file called perlscripts.bat and type the following:
perl c:\path\to\scripts\script1.pl
perl c:\path\to\scripts\script2.pl
Running this batch should run the scripts in order as desired.
The shell script calls the two perl scripts consecutively the first one creating a file and the second one performing an analysis of the data from the created file.
You can directly call those perl scripts from perl itself, it will work in both windows& linux, why shell/batch, why need bother every time for different OS.
like, <script to run>

Running Perl Script from Command Line?

I have perl express 2.5 loaded on my server. I would like to be able to run my perl scripts using a command line so they can be scheduled rather than manually bringing up the script in Perl Express and clicking on the run command. Is there a way to execute the script from a command line using this version of Perl or do I need to download a newer or more robust version of the Perl Engine.
You need to export the Perl interpreter (usually named perl) to your path. Then you can simply do
perl path/to/script.pl
In UNIX-based systems you are also able to run the scripts directly if you prepend
#!/usr/bin/perl
to the scripts and give them executable permissions (you might need to replace /usr/bin/perl with the path to your Perl interpreter).
According to the documentation:
Perl Express is not tied to a specific Perl port and should work with any build for Windows.
and the system requirements:
Windows 98/Me/2000/XP/2003, Perl Interpreter
So you, presumably, have a separate Perl distribution already installed somewhere. That should have a perl.exe executable that you can use to run your script.
You just need to give perl command and the path of your perl script.
example :
D:\Project\dir>perl <path_of_perl_script .pl>

What is the most cross-platform way to execute a Perl script from Ant?

What is the most cross platform way to execute a pPerl script from ant?
Windows does not like the Perl script as the executable. Is there any way other than just running Perl using an OS specific executable and passing the Perl script in as an argument?
Have you considered the ant <exec> command? You can use the os attribute to specify which operating system to use.
The catch would be that you would need a specific call for each known operating system the Perl script will be used on. Its probably safer to do an os check anyway.
Have you tried creating a custom Ant target for calling Perl (let's call it call-perl-script), and the implementation of that task switches to another subtask based on the OS (like call-perl-script-windows, call-perl-script-osx, etc.)?
Something based on this previous question, or this or this?
Windows does not like the Perl script as the executable.
Either you configure windows to execute .pl files (help ftype, help assoc)
ftype PerlScript=perl.exe %1 %*
assoc .pl=PerlScript
or you run the script through pl2bat (happens automatically if you use ExtUtils::MakeMaker to install script). If you use pl2bat, please examine the resulting file and make sure you're satisfied with the results.
you could also use PAR/pp to create an .exe