Archive: Problem with NSIS install


Problem with NSIS install
Hi

I have a problem with the install file I have made with NSIS. When I make the exe file it all works fine and I can run the Install shield and then the program that I want to install is installed. But then I place the file on a ftp server and something goes wrong. I can download the file but when I go through some of the custom made windows the install wizard freezes just before it should start installing the files. Is there any one that has had the same problem and knows how to fix it?


when I go through some of the custom made windows the install wizard freezes
I suppose by that you mean that your installer includes InstallOptions custom page(s). If this is indeed the case, verify that you've include the proper ini for each custom page, and that the ini is extracted and called properly.
e.g.
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\custom.ini custom.ini
FunctionEnd

Section -
ReadIniStr $R0 '$PLUGINSDIR\custom.ini' 'Field 1' 'State'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'State' 'boo'

This is how I have used the custom page:

; Customer page
Page custom SetCustom ValidateCustom
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

When I press on install from the page det install wizard freezes.

the .onInit look like this

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

I don't know way the wizard stopped working.


yes, not extracting to $PLUGINSDIR can cause many issues, so you might want to check that all external files referenced in your code are properly extracted.


If you don't mind attach the script, only the 2 functions SetCustom ValidateCustom.


Function SetCustom

!insertmacro MUI_HEADER_TEXT "$(LABEL_TITEL)" ""

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "Custom.ini"

!insertmacro MUI_INSTALLOPTIONS_WRITE "Custom.ini" "Field 1" "Text" "$(LABEL_NAME)"

!insertmacro MUI_INSTALLOPTIONS_WRITE "Custom.ini" "Field 2" "Text" "$(LABEL_NAME_TEXT)"

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "Custom.ini"

FunctionEnd

Function ValidateCustom

ReadINIStr $0 "$PLUGINSDIR\Custom.ini" "Field 3" "State"

StrCmp $0 "" message1 done

message1:
MessageBox MB_ICONEXCLAMATION|MB_OK "$(LABEL_MESSAGE1)"
Abort

done:
${GetTime} "" "LS" $3 $4 $5 $6 $7 $8 $9

ClearErrors
FileOpen $2 $INSTDIR\Programs\ls.ini w
IfErrors done
FileWrite $2 "#X © Defaults$\r$\n"
FileWrite $2 "#Date=$3/$4/$5 ($6)Time=$7:$8:$9$\r$\n"
FileWrite $2 "Name=$0$\r$\n"
${WordReplace} $INSTDIR "\" "/" "+" $3
FileWrite $2 "defaultDataDir=$3/Data$\r$\n"
FileWrite $2 "Company=X$\r$\n"

StrCmp "1030" "$LANGUAGE" languageWriteDK languageWriteEN

languageWriteDK:
FileWrite $2 "defaultLanguage=da"
Goto close

languageWriteEN:
FileWrite $2 "defaultLanguage=en"
Goto close

close:
FileClose $2

FunctionEnd


Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\custom.ini custom.ini
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Function SetCustom
!insertmacro MUI_HEADER_TEXT "$(LABEL_TITEL)" ""
WriteIniStr "$PLUGINSDIR\Custom.ini" "Field 1" "Text" "$(LABEL_NAME)"
WriteIniStr "$PLUGINSDIR\Custom.ini" "Field 2" "Text" "$(LABEL_NAME_TEXT)"
push $R0
InstallOptions::Dialog "$PLUGINSDIR\Custom.ini"
pop $R0
pop $R0
FunctionEnd


EDIT:
Also I noticed that you're referring $INSTDIR on ValidateCustom function.
$INSTDIR has to be initialized either in directory page (that you probably already had before the custom page), or in InstallDir if you don't include directory page.

It seams to work but I will try to test it some on another machine tomorrow thanks for the help :)