- NSIS Discussion
- I just want to create a installer for firefox plugin - need help
Archive: I just want to create a installer for firefox plugin - need help
Inspirator
16th May 2006 17:21 UTC
I just want to create a installer for firefox plugin - need help
Hi I searched for a good programm to get my issue done. Hopefully it is nsis I know for quite a long time but was never to deep into it.
If there is someone here helping me out it would make be very happy.
I just want an installer for install a firefox plugin.
For that I have 3 files. A html file, update file and .xpi file. Of course normally user just have to load the html file where they have to click a link to perform an install of the plugin. But there are reason that make other ways needed much. Such as sending customers a plugin to install that do not know how to cope with archive like .zip and so on. Besides an installer is able to give more informations and details.
I realized that in many install maker programs a .exe file is needed that one has to perform and to include in the installer file. In my case there is no need for that.
I just will need to install 3 files and to provide a link (message screen with some information) that will open up firefox. That's it.
How is it possible. I guess it is not much to do - but I couldn't find out how to put in the right way.
Please help!
Thanks a lot.
Regards
Inspirator
Red Wine
16th May 2006 18:50 UTC
step1:
check if firefox is installed on target machine and get its version to verify if your plugin is compatible with the installed version
step2:
extract your files into $PLUGINSDIR and show a welcome page with all needed info and user interaction
step3:
execwait firefox and load your html file where must exists a link to .xpi, and a prompt to install the plugin.
that's all, when your installer is finished all files from $PLUGINSDIR removed
Inspirator
17th May 2006 04:17 UTC
understand but can not solve
Thanks a lot for this step-by-step solution.
I can understand but can't realize that.
I checked viewhtml.nsi in Example directory of NSIS.
I look to me like a good template for it but of couse for the wrong browser. I tried to use venis IX to help me.
step1
is the check just the way to take the standard firefox installation folder? My firefox extention will be compatible with I guess almost all firefox versions?
Probably I want not need it. But not sure if this check is basis for other following operations.
step2
extracting to which pluginsdir, that from firefox oder from windows??? So this is the same operation as saying where to copy the files ?!? A welcome page means a custom message or ? So one also can implement a lisense text or better have a check box to be check to accept lisense in order to go on and call the html file.
step3
is is the same as calling a .exe file? I mean I relaized a lot of function that probably have to do with calling a file. But don't know how to do that exactly.
I am very bloddy beginner and just know the helper programms to NSIS but not to deep. So will need further help on that.
The News Script Wizard on Venis IX ist okay ?? or. But I guess it will not ask me all I need to set up.
Regards
Inspirator
Red Wine
17th May 2006 05:38 UTC
hmm, seems to me that you should get your self a bit deeper into nsis. play a little with included examples to understand the basics.
step1 is usually the .onInit function before the nsis gui comes up.
check if firefox is installed means that obviously you don't want to offer an installation for a system without firefox, instead a messagebox must pop up i.e. "firefox not found" and exit installer.
version compatibility is something you have to test and know, obviously you don't want to cause stability issues on target.
$PLUGINSDIR is temporary and is used by nsis, see manual.
so the procedure should be like this:
set up the pages you want to show, directory page not needed.
in .onInit function grab the required info from registry, and extract your files to $PLUGINSDIR.
now let the gui comes up, show the license etc.
next use the collected info to launch firefox with parameter your html file.
onad
17th May 2006 08:27 UTC
To install a .xpi based plugin one does not need NSIS, just drag and drop the .xpi on a firefox browser Window, firefox then alsready asks to install the plugin.
BioDuo
17th May 2006 08:46 UTC
Actually I once wrote a similar script for that
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" ""
StrCmp $0 "" NoFireFox 0
WriteRegStr HKEY_CLASSES_ROOT ".xpi" "" "BioDuo"
WriteRegStr HKEY_CLASSES_ROOT "BioDuo\shell\open\command" "" '"$0" "%1"'
CreateDirectory "$TEMP\BioDuo"
SetOutPath "$TEMP\BioDuo\"
File flashgot-0.5.9.995-fx+fl+mz+ns+zm+tb.xpi
ExecShell open "$TEMP\BioDuo\flashgot-0.5.9.995-fx+fl+mz+ns+zm+tb.xpi"
DeleteRegKey HKEY_CLASSES_ROOT ".xpi"
DeleteRegKey HKEY_CLASSES_ROOT "BioDuo"
Goto End
NoFireFox:
MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system, installation failed"
End:
flashgot-0.5.9.995-fx+fl+mz+ns+zm+tb.xpi is the plug-in ;)
Yathosho
17th May 2006 09:05 UTC
problem is that mozilla. extensions files aren't associated with firefox. so, your script adds this capability, but xpi also work for other programs but firefox, so people might not like this. you can install them using this commandline
nsExec::Exec '"path/to/firefox.exe" -install-global-extension "path/to/extension.xpi"'
this brings up the problem, that the extension will be installed for all user-profiles. don't know if there's a workaround.
onad
17th May 2006 15:15 UTC
Yathosho mentioned:
> this brings up the problem, that the extension
> will be installed for all user-profiles.
> don't know if there's a workaround.
see: http://kb.mozillazine.org/Installing_extensions
thus,
nsExec::Exec '"path/to/firefox.exe" "path/to/extension.xpi"'
should be good.
IMHO, to install .XPI via NSIS is NOT such a good idea (Now I cannoy use ones extention om my Linux and not on my Apple OSX.
Just @#%$#% drop the XPI on you Firefox browser window!
Inspirator
17th May 2006 16:14 UTC
okay I will try to get it together
Thank you all very much for your quick response and comments. It seems different way will lead to aim. After all it seem to be not to be to easy to get it done.
So the easiest is perhaps the one Red Wine discribed?!?
I am not sure.
I try to sum up:
1. I have the html file I want to show, where the user just
has to click a link and the plugin will be installed
> this causes no problem ;)
2. Checking Registry seems to be the way BioDuo solved his
issue
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" ""
StrCmp $0 "" NoFireFox 0
NoFireFox:
MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system, installation failed"
End:
I guess this is for get to know if Firefox is installed or not and if not a message should pop up saying no firefox installed on system.
My question : is the path to firefox standard?
How does the version extraction works exactly.
I have just one examples for IE and Windows version check.
3. copy the files to $PLUGINSDIR I understand, also that this has to be initiated first
4. License text will be displayed and if checkbox is selected it should start firefox calling html.
I tried to collect all into one file now. But I guess it is still far away from working :igor:
; Script generated with the Venis Install Wizard
; Define your application name
!define APPNAME "WM Begleiter - Firefox - Free"
!define APPNAMEANDVERSION "WM Begleiter - Firefox - Free 1.1."
; is this need for my case ???
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PLUGINSDIR\WM Begleiter"
OutFile "wm_begleiter_firefox_free.exe"
; Modern interface settings
!include "MUI.nsh"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "WM Begleiter - Firefox - Free" Section1
nsExec::Exec '"$1/firefox.exe" "$PLUGINSDIR/file1.html"'
; or do I need such : ExecWait '"$1/firefox.exe"'
; do not know if that makes sense : !execute '"$1/firefox.exe" "$PLUGINSDIR/file1.html"'
SectionEnd
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
; On initialization
Function .onInit
MessageBox MB_YESNO "This will install My Program. Do you wish to continue?" IDYES gogogo
Abort
gogogo:
ReadRegStr $1 HKCR "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" ""
StrCmp $0 "" NoFireFox 0
NoFireFox:
MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system, installation failed"
Function .onInstFailed
MessageBox MB_OK "Please install firefox first and try again."
FunctionEnd
!insertmacro MUI_PAGE_LICENSE
; try to have a checkbox that has to be checked agreeing to the license before able to go on
; (checkbox [accept_text])
; LicenseForceSelection checkbox "i accept"
; [back button text [next])
InitPluginsDir
File /oname=$PLUGINSDIR\file1.htm "file1.htm"
File /oname=$PLUGINSDIR\file2.xpi "file2.xpi"
FunctionEnd
; want to show the name of the installer that way ?
; /TRIM(CENTER) WM-Begleiter Firefox Setup
BrandingText "WM Begleiter - Firefox - Free"
; eof
I guess I totally made it wrong, but based on the given suggestion I can not realize myself which way it the better or how to take them together. Is seems there a different ways to realize it.
The problem with other OS is important - sure. But otherwise I want to support the firefox plugin in a way also people with no software expierence can use it. They will need the easy way. :tinfoil:
I am very thankful for any further hints and tipss and help on that issue.
Red Wine
17th May 2006 16:46 UTC
a very quick look on your script :-)
InitPluginsDir
File /oname=$PLUGINSDIR\file1.htm "file1.htm"
File /oname=$PLUGINSDIR\file2.xpi "file2.xpi"
These lines should go in function .onInit
Brand text should go where the name the caption the outfile etc are.
I have not idea how this is done on other OS.
Firefox location is stored in registry, look the example by BioDuo.
Inspirator
17th May 2006 17:53 UTC
Thanks Red Wine for your reply.
Thought I placed in the right place.
But I guess I have other things put to
.onInit that are not right in place there ?!?
I also add what BioDuo posted ?!?
Red Wine
17th May 2006 18:13 UTC
OK let me check your script and I'll come back later :-)
Red Wine
17th May 2006 18:52 UTC
The basics:
!define APPNAME "WM Begleiter - Firefox - Free"
!define APPNAMEANDVERSION "WM Begleiter - Firefox - Free 1.1."
Name "${APPNAMEANDVERSION}"
OutFile "wm_begleiter_firefox_free.exe"
BrandingText "WM Begleiter - Firefox - Free"
!include "MUI.nsh"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section -
ExecWait '"$1" "$PLUGINSDIR\file1.html"'
SectionEnd
Function .onInit
;MessageBox MB_YESNO "This will install My Program. Do you wish to continue?" IDYES gogogo
;Abort
;gogogo:
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" ""
StrCmp $1 "" NoFireFox ok
NoFireFox:
MessageBox MB_OK|MB_ICONSTOP "FireFox wasn't found on your system, installation failed"
Abort
ok:
!insertmacro MUI_LANGDLL_DISPLAY
InitPluginsDir
File /oname=$PLUGINSDIR\file1.htm "file1.htm"
File /oname=$PLUGINSDIR\file2.xpi "file2.xpi"
functionend
Inspirator
17th May 2006 23:25 UTC
Wow thanks a lot Red Wine for you efforts and time you spent on my issue. I don't now why I will not work. It can find my files right now. I though I put it in the rigth place. Do you know perhaps where they have to be placed.
Regards
Inspirator
Inspirator
18th May 2006 02:26 UTC
Okay I got it working and it works. Great !!! Thanks.
Now I have to play around for modifying little things.
Thanks Red Wine for you efforts. I am happy :-)
Red Wine
18th May 2006 05:30 UTC
You welcome,
keep on try, NSIS is a real stuff that makes you feel happy :-)
Inspirator
18th May 2006 05:42 UTC
Yep I guess i slightly coming into deeper NSIS.
It is really nice and I playes around some with the skins and UIs. But I also discovered that InstallJammer ist also a good opensource installer progy. It is worth a try.
Thanks again.
Regards
Stephan
RobGrant
18th May 2006 14:52 UTC
Don't be silly enough to associate .xpi files with firefox - especially on someone else's machine - thunderbird uses them as well.
Yathosho
23rd May 2006 23:14 UTC
cheers for the link onad.. (just read this now)