mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #670355 - Automated install of Perl with Finance-Quote
With these changes install-fq-mods.cmd will automatically download and install Strawberry perl if now perl version if found on the system. Patches by Dave Roberts git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22169 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
7dfb8145dd
commit
d2357b256a
@ -4,6 +4,8 @@ EXTRA_DIST = \
|
||||
dist.sh \
|
||||
exetype.pl \
|
||||
functions.sh \
|
||||
getperl.vbs \
|
||||
gnc-path-check \
|
||||
goffice-0.7.2-patch.diff \
|
||||
gwenhywfar-3.6.0-patch.diff \
|
||||
install.sh \
|
||||
|
@ -255,7 +255,7 @@ function dist_gnucash() {
|
||||
cp -a $_INSTALL_UDIR/lib/lib*.la $DIST_UDIR/bin
|
||||
mkdir -p $DIST_UDIR/share
|
||||
cp -a $_INSTALL_UDIR/share/{doc,gnucash,locale} $DIST_UDIR/share
|
||||
cp -a $_REPOS_UDIR/packaging/win32/install-fq-mods.cmd $DIST_UDIR/bin
|
||||
cp -a $_REPOS_UDIR/packaging/win32/{getperl.vbs,gnc-path-check,install-fq-mods.cmd} $DIST_UDIR/bin
|
||||
|
||||
_QTDIR_WIN=$(unix_path $QTDIR | sed 's,^/\([A-Za-z]\)/,\1:/,g' )
|
||||
if [ "$AQBANKING5" != "yes" ] ; then
|
||||
|
49
packaging/win32/getperl.vbs
Normal file
49
packaging/win32/getperl.vbs
Normal file
@ -0,0 +1,49 @@
|
||||
' script to download perl install file and save on local disc
|
||||
' the location of which is provided by first argument
|
||||
|
||||
|
||||
Const WindowsFolder = 0
|
||||
Const SystemFolder = 1
|
||||
Const TemporaryFolder = 2
|
||||
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)
|
||||
|
||||
strHDLocation = Wscript.Arguments.Item(0)
|
||||
|
||||
' Set your settings
|
||||
strFileURL = "http://strawberry-perl.googlecode.com/files/strawberry-perl-5.12.3.0.msi"
|
||||
|
||||
Wscript.Echo " copying " & strFileURL
|
||||
Wscript.Echo " to " & strHDLocation
|
||||
|
||||
|
||||
' Fetch the file
|
||||
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
|
||||
|
||||
objXMLHTTP.open "GET", strFileURL, false
|
||||
objXMLHTTP.send()
|
||||
|
||||
If objXMLHTTP.Status = 200 Then
|
||||
Set objADOStream = CreateObject("ADODB.Stream")
|
||||
objADOStream.Open
|
||||
objADOStream.Type = 1 'adTypeBinary
|
||||
|
||||
objADOStream.Write objXMLHTTP.ResponseBody
|
||||
objADOStream.Position = 0 'Set the stream position to the start
|
||||
|
||||
Set objFSO = Createobject("Scripting.FileSystemObject")
|
||||
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
|
||||
|
||||
objADOStream.SaveToFile strHDLocation
|
||||
objADOStream.Close
|
||||
Set objADOStream = Nothing
|
||||
If objFSO.Fileexists(strHDLocation) Then
|
||||
Wscript.Echo " "
|
||||
Wscript.Echo " " & strHDLocation & " downloaded OK"
|
||||
Wscript.Echo " "
|
||||
Set objFSO = Nothing
|
||||
wscript.quit 0
|
||||
End if
|
||||
End if
|
||||
|
||||
wscript.quit 1
|
71
packaging/win32/gnc-path-check
Normal file
71
packaging/win32/gnc-path-check
Normal file
@ -0,0 +1,71 @@
|
||||
#!/bin/perl -w
|
||||
######################################################################
|
||||
### gnc-path-check - verify the windows path
|
||||
###
|
||||
### This script verifies the window path. It is used to check for an error
|
||||
### condition identified in Bug 657117
|
||||
### (https://bugzilla.gnome.org/show_bug.cgi?id=657117)
|
||||
###
|
||||
### Verifying that all directies in the path environment will avoid
|
||||
### the glib bug conditioned identified bug 670233.
|
||||
###
|
||||
### Copyright © Dave Roberts 2012 (droberts@cpan.org)
|
||||
###
|
||||
### This program is free software; you can redistribute it and/or
|
||||
### modify it under the terms of the GNU General Public License as
|
||||
### published by the Free Software Foundation; either version 2 of
|
||||
### the License, or (at your option) any later version.
|
||||
###
|
||||
### This program is distributed in the hope that it will be useful,
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
### GNU General Public License for more details.
|
||||
###
|
||||
### You should have received a copy of the GNU General Public License
|
||||
### along with this program# if not, contact:
|
||||
###
|
||||
### Free Software Foundation Voice: +1-617-542-5942
|
||||
### 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
### Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
######################################################################
|
||||
|
||||
use strict;
|
||||
use English;
|
||||
use Win32;
|
||||
|
||||
# Input: <none>
|
||||
#
|
||||
# Output:
|
||||
#
|
||||
# A list of directory names in the PATH that are not valid. The normal
|
||||
# output (no error found) is nothing.
|
||||
#
|
||||
# Exit status
|
||||
#
|
||||
# 0 - success
|
||||
# non-zero - failure - number of invalid directories found
|
||||
|
||||
my $path = Win32::ExpandEnvironmentStrings("%Path%");
|
||||
my(@path) = split(/;/,$path);
|
||||
my($error) = 0;
|
||||
my($msg) = << "EOT";
|
||||
|
||||
The following directory name(s) were found in the PATH environment
|
||||
which are invalid. This may cause the Finance Quote function to fail
|
||||
depending on the order of directories in the PATH. Please correct the
|
||||
system PATH variable.
|
||||
|
||||
EOT
|
||||
|
||||
foreach my $_ (@path){
|
||||
my($dir) = Win32::ExpandEnvironmentStrings("$_");
|
||||
unless (-d $dir){
|
||||
$msg .= " $dir\n";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($error){
|
||||
print STDERR $msg;
|
||||
}
|
||||
exit $error;
|
||||
|
@ -1,16 +1,67 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
if not exist ssleay32.dll (
|
||||
echo.
|
||||
echo Did not find ssleay32.dll in current directory.
|
||||
echo Please start this cmd file in the bin directory created by the setup.exe.
|
||||
goto error
|
||||
)
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Check Perl
|
||||
echo.
|
||||
perl -v > NUL 2>&1
|
||||
if %errorlevel% equ 0 goto chkver
|
||||
echo.
|
||||
echo no perl executable found
|
||||
echo.
|
||||
echo Now finding and installing perl.....
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * download Strawberry perl
|
||||
echo.
|
||||
call cscript//nologo getperl.vbs %TEMP%\Perl.msi
|
||||
if %errorlevel% equ 0 goto donegetperl
|
||||
echo Return Value: "%errorlevel%"
|
||||
echo.
|
||||
echo failed to download perl install file
|
||||
echo.
|
||||
goto error
|
||||
:donegetperl
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * automated Perl install
|
||||
echo.
|
||||
msiexec /qb /l* %TEMP%\perl-log.txt /i %TEMP%\Perl.msi PERL_PATH=Yes PERL_EXT=Yes
|
||||
if %errorlevel% equ 0 goto doneperlinst
|
||||
echo Return Value: "%errorlevel%"
|
||||
echo.
|
||||
echo failed to install perl (%TEMP%\Perl.msi)
|
||||
echo.
|
||||
goto error
|
||||
:doneperlinst
|
||||
perl -v
|
||||
del %TEMP%\Perl.msi
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * updating PATH variable to include Perl
|
||||
echo.
|
||||
:: 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
|
||||
ECHO NewPath = %NewPath%
|
||||
set Path="%NewPath%"
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Run gnc-fq-update
|
||||
echo.
|
||||
perl -w gnc-fq-update
|
||||
if %errorlevel% neq 0 goto error
|
||||
REM ----------------------------------------------------------------------------
|
||||
:chkver
|
||||
echo.
|
||||
echo * Check Perl Version
|
||||
echo.
|
||||
perl -e "exit(int($]));"
|
||||
set _perlmajor=%errorlevel%
|
||||
perl -e "$ver=1000*sprintf(\"%%.3f\", $]); exit(int($ver)-5000);"
|
||||
@ -34,21 +85,54 @@ echo Did not find a usable perl.
|
||||
echo Please install ActivePerl 5.8, or above (http://www.activestate.com/store/activeperl)
|
||||
echo and add the bin directory to your Path environment variable.
|
||||
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 ----------------------------------------------------------------------------
|
||||
:pchk
|
||||
REM echo.
|
||||
REM echo * Run gnc-path-check
|
||||
REM echo.
|
||||
REM perl -w gnc-path-check
|
||||
REM if %errorlevel% neq 0 goto error
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo * Install DateManip
|
||||
echo.
|
||||
if "%bld%" equ "AS" (
|
||||
perl -x -S ppm install Date-Manip
|
||||
if %errorlevel% neq 0 (
|
||||
perl -x -S ppm install DateManip
|
||||
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 ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Install Crypt-SSLeay
|
||||
echo.
|
||||
set OLDPATH=%PATH%
|
||||
set PATH=%CD%;%PATH%
|
||||
|
||||
|
||||
if "%bld%" equ "AS" (
|
||||
set OLDPATH="%PATH%"
|
||||
set PATH="%CD%;%PATH%"
|
||||
if %_perlversion% == 5.6 (
|
||||
perl -x -S ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Crypt-SSLeay.ppd
|
||||
) else if %_perlversion% == 5.8 (
|
||||
@ -57,36 +141,67 @@ if %_perlversion% == 5.6 (
|
||||
perl -x -S ppm install Crypt-SSLeay
|
||||
)
|
||||
set errlvlbak=%errorlevel%
|
||||
set PATH=%OLDPATH%
|
||||
if %errlvlbak% neq 0 goto error
|
||||
|
||||
set PATH="%OLDPATH%"
|
||||
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 ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Install Finance-Quote
|
||||
echo.
|
||||
if "%bld%" equ "AS" (
|
||||
perl -x -S ppm install Finance-Quote
|
||||
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 ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Run gnc-fq-check
|
||||
echo.
|
||||
perl -w gnc-fq-check
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Run gnc-fq-helper
|
||||
echo.
|
||||
echo (yahoo "AMZN") | perl -w gnc-fq-helper
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
echo.
|
||||
echo * Installation succeeded
|
||||
echo.
|
||||
goto end
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
:error:
|
||||
echo.
|
||||
echo An error occurred, see above.
|
||||
echo.
|
||||
|
||||
REM ----------------------------------------------------------------------------
|
||||
:end
|
||||
pause
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user