mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Rearrange install-fq-mods.cmd to avoid duplicate code and make it easier to understand
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22170 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d2357b256a
commit
26fd475dd2
@ -1,5 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
if not exist ssleay32.dll (
|
if not exist ssleay32.dll (
|
||||||
echo.
|
echo.
|
||||||
@ -7,6 +8,7 @@ if not exist ssleay32.dll (
|
|||||||
echo Please start this cmd file in the bin directory created by the setup.exe.
|
echo Please start this cmd file in the bin directory created by the setup.exe.
|
||||||
goto error
|
goto error
|
||||||
)
|
)
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * Check Perl
|
echo * Check Perl
|
||||||
@ -14,53 +16,50 @@ echo.
|
|||||||
perl -v > NUL 2>&1
|
perl -v > NUL 2>&1
|
||||||
if %errorlevel% equ 0 goto chkver
|
if %errorlevel% equ 0 goto chkver
|
||||||
echo.
|
echo.
|
||||||
echo no perl executable found
|
echo No Perl executable found, attempt to install Strawberry Perl
|
||||||
echo.
|
|
||||||
echo Now finding and installing perl.....
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * download Strawberry perl
|
echo * Download Strawberry Perl package
|
||||||
echo.
|
echo.
|
||||||
call cscript//nologo getperl.vbs %TEMP%\Perl.msi
|
call cscript//nologo getperl.vbs %TEMP%\Perl.msi
|
||||||
if %errorlevel% equ 0 goto donegetperl
|
if %errorlevel% neq 0 (
|
||||||
echo Return Value: "%errorlevel%"
|
echo Return Value: "%errorlevel%"
|
||||||
echo.
|
echo.
|
||||||
echo failed to download perl install file
|
echo failed to download perl install file
|
||||||
echo.
|
echo.
|
||||||
goto error
|
goto error
|
||||||
:donegetperl
|
)
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * automated Perl install
|
echo * Run automated Perl install
|
||||||
echo.
|
echo.
|
||||||
msiexec /qb /l* %TEMP%\perl-log.txt /i %TEMP%\Perl.msi PERL_PATH=Yes PERL_EXT=Yes
|
msiexec /qb /l* %TEMP%\perl-log.txt /i %TEMP%\Perl.msi PERL_PATH=Yes PERL_EXT=Yes
|
||||||
if %errorlevel% equ 0 goto doneperlinst
|
if %errorlevel% neq 0 (
|
||||||
echo Return Value: "%errorlevel%"
|
echo Return Value: "%errorlevel%"
|
||||||
echo.
|
echo.
|
||||||
echo failed to install perl (%TEMP%\Perl.msi)
|
echo failed to install perl from %TEMP%\Perl.msi
|
||||||
echo.
|
echo.
|
||||||
|
del %TEMP%\Perl.msi
|
||||||
goto error
|
goto error
|
||||||
:doneperlinst
|
)
|
||||||
perl -v
|
perl -v
|
||||||
del %TEMP%\Perl.msi
|
del %TEMP%\Perl.msi
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * updating PATH variable to include Perl
|
echo * Update PATH variable to include Perl
|
||||||
echo.
|
echo.
|
||||||
:: delims is a TAB followed by a space
|
:: delims is a TAB followed by a space
|
||||||
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') DO SET NewPath=%%B
|
FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') DO SET NewPath=%%B
|
||||||
ECHO NewPath = %NewPath%
|
ECHO NewPath = %NewPath%
|
||||||
set Path="%NewPath%"
|
set Path=%NewPath%
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
echo.
|
|
||||||
echo * Run gnc-fq-update
|
|
||||||
echo.
|
|
||||||
perl -w gnc-fq-update
|
|
||||||
if %errorlevel% neq 0 goto error
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
:chkver
|
:chkver
|
||||||
echo.
|
echo.
|
||||||
echo * Check Perl Version
|
echo * Check Perl version
|
||||||
echo.
|
echo.
|
||||||
perl -e "exit(int($]));"
|
perl -e "exit(int($]));"
|
||||||
set _perlmajor=%errorlevel%
|
set _perlmajor=%errorlevel%
|
||||||
@ -69,38 +68,26 @@ set _perlminor=%errorlevel%
|
|||||||
if %_perlmajor% equ 5 (
|
if %_perlmajor% equ 5 (
|
||||||
if %_perlminor% geq 10 (
|
if %_perlminor% geq 10 (
|
||||||
set _perlversion=5.10
|
set _perlversion=5.10
|
||||||
goto ccp
|
goto pchk
|
||||||
)
|
)
|
||||||
if %_perlminor% equ 8 (
|
if %_perlminor% equ 8 (
|
||||||
set _perlversion=5.8
|
set _perlversion=5.8
|
||||||
goto ccp
|
goto pchk
|
||||||
)
|
)
|
||||||
|
REM Note: GnuCash no longer "officially" supports perl 5.6, but as long as it works it will be allowed...
|
||||||
if %_perlminor% equ 6 (
|
if %_perlminor% equ 6 (
|
||||||
set _perlversion=5.6
|
set _perlversion=5.6
|
||||||
goto ccp
|
goto pchk
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
echo.
|
echo.
|
||||||
echo Did not find a usable perl.
|
echo Found perl version %_perlmajor%.%_perlminor%, but GnuCash requires at least version 5.8.
|
||||||
echo Please install ActivePerl 5.8, or above (http://www.activestate.com/store/activeperl)
|
echo Please install version 5.8 or above of
|
||||||
|
echo * ActivePerl (http://www.activestate.com/store/activeperl) or
|
||||||
|
echo * Strawberry Perl (http://strawberry-perl.googlecode.com/files/)
|
||||||
echo and add the bin directory to your Path environment variable.
|
echo and add the bin directory to your Path environment variable.
|
||||||
goto error
|
goto error
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
:ccp
|
|
||||||
echo.
|
|
||||||
echo * Test for ActivePerl
|
|
||||||
echo.
|
|
||||||
perl -e "use Win32;if(defined &Win32::BuildNumber){exit 2;}else{exit 3;};"
|
|
||||||
REM echo status = %errorlevel%
|
|
||||||
if %errorlevel% equ 2 (
|
|
||||||
set bld=AS
|
|
||||||
goto pchk
|
|
||||||
)else if %errorlevel% equ 3 (
|
|
||||||
set bld=Other
|
|
||||||
goto pchk
|
|
||||||
)
|
|
||||||
if %errorlevel% equ 0 goto pchk
|
|
||||||
goto error
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
:pchk
|
:pchk
|
||||||
REM echo.
|
REM echo.
|
||||||
@ -108,31 +95,47 @@ REM echo * Run gnc-path-check
|
|||||||
REM echo.
|
REM echo.
|
||||||
REM perl -w gnc-path-check
|
REM perl -w gnc-path-check
|
||||||
REM if %errorlevel% neq 0 goto error
|
REM if %errorlevel% neq 0 goto error
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
|
echo.
|
||||||
|
echo * Determine which Perl flavour we have found
|
||||||
|
echo.
|
||||||
|
perl -e "use Win32;if(defined &Win32::BuildNumber){exit 2;}else{exit 3;};"
|
||||||
|
REM echo status = %errorlevel%
|
||||||
|
if %errorlevel% equ 2 (
|
||||||
|
echo => ActivePerl
|
||||||
|
goto inst_mod_as
|
||||||
|
) else if %errorlevel% equ 3 (
|
||||||
|
echo => Other, probably Strawberry perl ?
|
||||||
|
goto inst_mod_oth
|
||||||
|
) else if %errorlevel% neq 0 goto error
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
:inst_mod_oth
|
||||||
|
echo.
|
||||||
|
echo * Install required perl modules
|
||||||
|
echo.
|
||||||
|
perl -w gnc-fq-update
|
||||||
|
if %errorlevel% neq 0 goto error
|
||||||
|
goto fqchk
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
:inst_mod_as
|
||||||
echo * Install DateManip
|
echo * Install DateManip
|
||||||
echo.
|
echo.
|
||||||
if "%bld%" equ "AS" (
|
|
||||||
perl -x -S ppm install Date-Manip
|
perl -x -S ppm install Date-Manip
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
perl -x -S ppm install DateManip
|
perl -x -S ppm install DateManip
|
||||||
if %errorlevel% neq 0 goto error
|
if %errorlevel% neq 0 goto error
|
||||||
)
|
)
|
||||||
)else if "%bld%" equ "Other" (
|
|
||||||
perl -e "use strict;use CPAN;CPAN::Shell->install('Date::Manip');"
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo failed to install Date::Manip module
|
|
||||||
goto error
|
|
||||||
)
|
|
||||||
)
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * Install Crypt-SSLeay
|
echo * Install Crypt-SSLeay
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
set OLDPATH=%PATH%
|
||||||
if "%bld%" equ "AS" (
|
set PATH=%CD%;%PATH%
|
||||||
set OLDPATH="%PATH%"
|
|
||||||
set PATH="%CD%;%PATH%"
|
|
||||||
if %_perlversion% == 5.6 (
|
if %_perlversion% == 5.6 (
|
||||||
perl -x -S ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Crypt-SSLeay.ppd
|
perl -x -S ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Crypt-SSLeay.ppd
|
||||||
) else if %_perlversion% == 5.8 (
|
) else if %_perlversion% == 5.8 (
|
||||||
@ -141,66 +144,44 @@ if %_perlversion% == 5.6 (
|
|||||||
perl -x -S ppm install Crypt-SSLeay
|
perl -x -S ppm install Crypt-SSLeay
|
||||||
)
|
)
|
||||||
set errlvlbak=%errorlevel%
|
set errlvlbak=%errorlevel%
|
||||||
set PATH="%OLDPATH%"
|
set PATH=%OLDPATH%
|
||||||
if "%errlvlbak%" neq "0" goto error
|
if "%errlvlbak%" neq "0" goto error
|
||||||
)else if "%bld%" equ "Other" (
|
|
||||||
echo using CPAN install for Crypt::SSLeay
|
|
||||||
perl -e "use strict;use CPAN;CPAN::Shell->install('Crypt::SSLeay');"
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo failed to install Crypt::SSLeay module
|
|
||||||
goto error
|
|
||||||
)
|
|
||||||
)
|
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
REM for some reason a CPAN install of Finance::Quote does not install prequisite
|
|
||||||
REM package HTML::Treebuilder
|
|
||||||
echo.
|
|
||||||
echo * Install HTML-TreeBuilder
|
|
||||||
echo.
|
|
||||||
if "%bld%" equ "Other" (
|
|
||||||
perl -e "use strict;use CPAN;CPAN::Shell->install('HTML::TreeBuilder');"
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo failed to install HTML::TreeBuilder module
|
|
||||||
goto error
|
|
||||||
)
|
|
||||||
)
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * Install Finance-Quote
|
echo * Install Finance-Quote
|
||||||
echo.
|
echo.
|
||||||
if "%bld%" equ "AS" (
|
|
||||||
perl -x -S ppm install Finance-Quote
|
perl -x -S ppm install Finance-Quote
|
||||||
if %errorlevel% neq 0 goto error
|
if %errorlevel% neq 0 goto error
|
||||||
)
|
|
||||||
if "%bld%" equ "Other" (
|
|
||||||
perl -e "use strict;use CPAN;CPAN::Shell->install('Finance::Quote');"
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo failed to install Finance::Quote module
|
|
||||||
goto error
|
|
||||||
)
|
|
||||||
)
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
|
:fqchk
|
||||||
echo.
|
echo.
|
||||||
echo * Run gnc-fq-check
|
echo * Run gnc-fq-check
|
||||||
echo.
|
echo.
|
||||||
perl -w gnc-fq-check
|
perl -w gnc-fq-check
|
||||||
if %errorlevel% neq 0 goto error
|
if %errorlevel% neq 0 goto error
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
echo.
|
echo.
|
||||||
echo * Run gnc-fq-helper
|
echo * Run gnc-fq-helper
|
||||||
echo.
|
echo.
|
||||||
echo (yahoo "AMZN") | perl -w gnc-fq-helper
|
echo (yahoo "AMZN") | perl -w gnc-fq-helper
|
||||||
if %errorlevel% neq 0 goto error
|
if %errorlevel% neq 0 goto error
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
|
:success
|
||||||
echo.
|
echo.
|
||||||
echo * Installation succeeded
|
echo * Installation succeeded
|
||||||
echo.
|
echo.
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
:error:
|
:error:
|
||||||
echo.
|
echo.
|
||||||
echo An error occurred, see above.
|
echo An error occurred, see above.
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
:end
|
:end
|
||||||
pause
|
pause
|
||||||
|
Loading…
Reference in New Issue
Block a user