[sword-svn] r100 - trunk/app/install
Apache
apache at www.crosswire.org
Mon Dec 4 11:35:54 MST 2006
Author:
Date: 2006-12-04 11:35:53 -0700 (Mon, 04 Dec 2006)
New Revision: 100
Removed:
trunk/app/install/flashcards.jar
trunk/app/install/lessons.jar
Modified:
trunk/app/install/FlashCards.nsi
Log:
update NSIS for running from a CD/USB stick
Modified: trunk/app/install/FlashCards.nsi
===================================================================
--- trunk/app/install/FlashCards.nsi 2006-12-04 00:14:30 UTC (rev 99)
+++ trunk/app/install/FlashCards.nsi 2006-12-04 18:35:53 UTC (rev 100)
@@ -4,16 +4,16 @@
!include LogicLib.nsh
!define PRODUCT_NAME "FlashCards"
-!define PRODUCT_VERSION "1.0"
+!define PRODUCT_VERSION "1.0.1"
!define CLASS "org.crosswire.flashcards.Quiz"
-!define JAVALIB "$EXEDIR"
-!define JRE_VERSION "1.4.2"
-!define JRE_URL "http://dlc.sun.com/jdk/j2re-1_4_2_07-windows-i586-p.exe"
+!define JRE_VERSION "1.5.0"
+!define JRE_URL "http://dlc.sun.com/jdk/jre-1_5_0_01-windows-i586-p.exe"
SetCompressor lzma
Var HasJRE
+Var JavaLIB
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
Caption "${PRODUCT_NAME} ${PRODUCT_VERSION}"
@@ -26,11 +26,23 @@
Section ""
+ Call FindJRE
+ Pop $R0
+
+ ${If} $R0 == "No"
+ MessageBox MB_OK "Could not find Java.$\rPlease install Java and try again."
+ Quit
+ ${EndIf}
+
+ StrCpy $JavaLib "$EXEDIR"
Call BuildClassPath
Pop $R1
- Call FindJRE
- Pop $R0
+ ${If} $R1 == ""
+ StrCpy $JavaLib "$EXEDIR/lib"
+ Call BuildClassPath
+ Pop $R1
+ ${EndIF}
StrCpy $0 '"$R0" -classpath "$R1" ${CLASS}'
@@ -46,7 +58,7 @@
SectionEnd
Function BuildClassPath
-; Builds the class path with all the jars in JAVALIB
+; Builds the class path with all the jars in JavaLib
; and puts the results on the stack.
; save state
@@ -58,13 +70,13 @@
StrCpy $R0 ""
; Iterate over all the jar files in JAVALIB
- FindFirst $R1 $R2 "${JAVALIB}\*.jar"
+ FindFirst $R1 $R2 "$JavaLib\*.jar"
${Unless} ${Errors}
${Do}
${If} $R0 == ""
- StrCpy $R0 "${JAVALIB}\$R2"
+ StrCpy $R0 "$JavaLib\$R2"
${Else}
- StrCpy $R0 "$R0;${JAVALIB}\$R2"
+ StrCpy $R0 "$R0;$JavaLib\$R2"
${EndIf}
FindNext $R1 $R2
${LoopUntil} ${Errors}
@@ -78,7 +90,7 @@
FunctionEnd
Function .onInit
- Call DetectJRE
+ Call FindJRE
pop $HasJRE
${If} $HasJRE == "No"
@@ -89,48 +101,64 @@
FunctionEnd
Function GetJRE
- MessageBox MB_OK "$(^NAME) uses Java ${JRE_VERSION} or later, it will now be downloaded and installed."
+ MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} or later, it will now be downloaded and installed."
StrCpy $2 "$TEMP\Java Runtime Environment.exe"
InetLoad::load /POPUP "Getting Java for ${PRODUCT_NAME}" ${JRE_URL} $2
Pop $R0 ;Get the return value
- StrCmp $R0 "OK" +3
+ StrCmp $R0 "OK" +5
;NSISdl::download /TIMEOUT=30000 ${JRE_URL} $2
;Pop $R0 ;Get the return value
- ;StrCmp $R0 "success" +3
- MessageBox MB_OK "Download failed: $R0"
+ ;StrCmp $R0 "success" +5
+ MessageBox MB_OK "Could not install Java for you. Please install Java from http://www.java.com then re-run ${PRODUCT_NAME}."
+ StrCpy $0 "http://www.java.com"
+ Call openLinkNewWindow
Quit
ExecWait $2
Delete $2
FunctionEnd
-Function DetectJRE
- ; Put "Yes" or "No" on the stack
-
- ; save state
- push $R0
-
- ; When the JRE is installed so is Web Start.
- ; The current version of WebStart is something like 1.4.2_07
- ; This is more fine grained than Java Runtime Environment
- ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Web Start" "CurrentVersion"
-
- ${If} ${JRE_VERSION} S> $R0
- StrCpy $R0 "No"
- ${Else}
- StrCpy $R0 "Yes"
- ${EndIf}
-
- ; restore state and put results in R0
- Exch $R0
+# uses $0
+Function openLinkNewWindow
+ Push $3
+ Push $2
+ Push $1
+ Push $0
+ ReadRegStr $0 HKCR "http\shell\open\command" ""
+# Get browser path
+ DetailPrint $0
+ StrCpy $2 '"'
+ StrCpy $1 $0 1
+ StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
+ StrCpy $2 ' '
+ StrCpy $3 1
+ loop:
+ StrCpy $1 $0 1 $3
+ DetailPrint $1
+ StrCmp $1 $2 found
+ StrCmp $1 "" found
+ IntOp $3 $3 + 1
+ Goto loop
+
+ found:
+ StrCpy $1 $0 $3
+ StrCmp $2 " " +2
+ StrCpy $1 '$1"'
+
+ Pop $0
+ Exec '$1 $0'
+ Pop $1
+ Pop $2
+ Pop $3
FunctionEnd
Function FindJRE
;
; Find JRE (javaw.exe) and put it on the stack
-; 1 - in .\jre directory (JRE Installed with application)
-; 2 - in JAVA_HOME environment variable
-; 3 - in the registry
+; 1 - in ..\Java\Win32\jre*
+; 2 - in .\jre directory (JRE Installed with application)
+; 3 - in JAVA_HOME environment variable
+; 4 - in the registry
; Else an error
;
; Note: It is possible that this will find a version of java
@@ -139,8 +167,10 @@
; save state
Push $R0
- ${If} ${FileExists} "$EXEDIR\jre\bin\javaw.exe"
- StrCpy $R0 "$EXEDIR\jre\bin\javaw.exe"
+ ${If} ${FileExists} "$EXEDIR\..\Java\win32\jre\bin\javaw.exe"
+ StrCpy $R0 "$EXEDIR\..\Java\win32\jre\bin\javaw.exe"
+ ${ElseIf} ${FileExists} "$EXEDIR\Java\win32\jre\bin\javaw.exe"
+ StrCpy $R0 "$EXEDIR\Java\win32\jre\bin\javaw.exe"
${Else}
ReadEnvStr $R0 "JAVA_HOME"
${If} ${FileExists} "$R0\bin\javaw.exe"
@@ -156,8 +186,7 @@
${If} ${FileExists} "$R0\bin\javaw.exe"
StrCpy $R0 "$R0\bin\javaw.exe"
${Else}
- MessageBox MB_OK "Could not find Java.$\rPlease install Java and try again."
- Quit
+ StrCpy $R0 "No"
${EndIf}
${EndIf}
${EndIf}
Deleted: trunk/app/install/flashcards.jar
===================================================================
(Binary files differ)
Deleted: trunk/app/install/lessons.jar
===================================================================
(Binary files differ)
More information about the sword-cvs
mailing list