Skip to content
Permalink
Browse files

creatensis.pl: creating the postinstall/preremove batchs is cheap

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14719 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 20, 2010
1 parent c4a15ea commit 69330851199c34d8ecba0ad4320b32d3560a4d1c
Showing with 47 additions and 51 deletions.
  1. +47 −51 ms-windows/osgeo4w/creatensis.pl
@@ -118,63 +118,59 @@ sub getDeps {
# Create postinstall.bat
#

unless(-f "../Installer-Files/postinstall.bat") {
open F, ">../Installer-Files/postinstall.bat";

print F "\@echo off\r\n";
print F "del postinstall.log>>postinstall.log\r\n";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%>>postinstall.log 2>&1\r\n";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>postinstall.log 2>&1\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%\r\n";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%\r\n";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>postinstall.log 2>&1\r\n";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>postinstall.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>postinstall.log 2>&1\r\n";

chdir "unpacked";
for my $p (<etc/postinstall/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;

print F "echo Running postinstall $file...\r\n";
print F "%COMSPEC% /c $p>>postinstall.log 2>&1\r\n";
print F "ren $p $file.done>>postinstall.log 2>&1\r\n";
}
chdir "..";

print F "ren postinstall.bat postinstall.bat.done\r\n";

close F;
open F, ">../Installer-Files/postinstall.bat";

print F "\@echo off\r\n";
print F "del postinstall.log>>postinstall.log\r\n";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%>>postinstall.log 2>&1\r\n";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>postinstall.log 2>&1\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%\r\n";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%\r\n";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>postinstall.log 2>&1\r\n";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>postinstall.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>postinstall.log 2>&1\r\n";

chdir "unpacked";
for my $p (<etc/postinstall/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;

print F "echo Running postinstall $file...\r\n";
print F "%COMSPEC% /c $p>>postinstall.log 2>&1\r\n";
print F "ren $p $file.done>>postinstall.log 2>&1\r\n";
}
chdir "..";

unless(-f "../Installer-Files/preremove.bat") {
open F, ">../Installer-Files/preremove.bat";

print F "\@echo off\r\n";
print F "del preremove.log>>preremove.log\r\n";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%>>preremove.log 2>&1\r\n";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>preremove.log 2>&1\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%\r\n";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%\r\n";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>preremove.log 2>&1\r\n";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>preremove.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>preremove.log 2>&1\r\n";
print F "ren postinstall.bat postinstall.bat.done\r\n";

chdir "unpacked";
for my $p (<etc/preremove/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
close F;

print F "echo Running preremove $file...\r\n";
print F "%COMSPEC% /c $p>>preremove.log 2>&1\r\n";
print F "ren $p $file.done>>preremove.log 2>&1\r\n";
}
chdir "..";
open F, ">../Installer-Files/preremove.bat";

print F "\@echo off\r\n";
print F "del preremove.log>>preremove.log\r\n";
print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%>>preremove.log 2>&1\r\n";
print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>preremove.log 2>&1\r\n";
print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%\r\n";
print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%\r\n";
print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>preremove.log 2>&1\r\n";
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>preremove.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>preremove.log 2>&1\r\n";

chdir "unpacked";
for my $p (<etc/preremove/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;

print F "echo Running preremove $file...\r\n";
print F "%COMSPEC% /c $p>>preremove.log 2>&1\r\n";
print F "ren $p $file.done>>preremove.log 2>&1\r\n";
}
chdir "..";

print F "ren preremove.bat preremove.bat.done\r\n";
print F "ren preremove.bat preremove.bat.done\r\n";

close F;
}
close F;

my($major, $minor, $patch, $release, $revision);

0 comments on commit 6933085

Please sign in to comment.
You can’t perform that action at this time.