Simple Addon Installer

From World Wind Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:43, 26 May 2005 (edit)
Jessi (Talk | contribs)
m (Reverted edit of 195.175.37.54, changed back to last version by Jessi)
← Previous diff
Revision as of 22:41, 8 June 2005 (edit) (undo)
Jessi (Talk | contribs)
(from f0urtyfive: appending to config file)
Next diff →
Line 37: Line 37:
I hope it's helpfull, please feel free to comment. Special thanks for Nowak for designing the original quick and easy nsi script, and showing me how it's done. I hope it's helpfull, please feel free to comment. Special thanks for Nowak for designing the original quick and easy nsi script, and showing me how it's done.
 +
 +==Installing an add-on that appends to an XML config file==
 +
 +(Sample NSI script by Matt Mills.)
 +
 +<pre>
 +; The name of the installer
 +Name "Colored SRTM Elevation"
 +
 +; The file to write
 +OutFile "vissrtm.exe"
 +
 +; The default installation directory
 +
 +;Name "NAME"
 +;OutFile "NAME.exe"
 +;InstallDir "$PROGRAMFILES\NASA\World Wind v1.3"
 +;InstallDirRegKey HKCU "Software\NASA\World Wind" ""
 +
 +InstallDir "$PROGRAMFILES\NASA\World Wind 1.3\"
 +
 +
 +;--------------------------------
 +
 +; Pages
 +
 +Page directory
 +Page instfiles
 +
 +;--------------------------------
 +
 +
 +
 +
 +; The stuff to install
 +Section "" ;No components page, name is not important
 +
 +SetOutPath "$INSTDIR\Data\Icons\Interface\"
 +File vissrtm.png
 +
 +CopyFiles /silent $INSTDIR\Config\Earth\Images.xml $INSTDIR\Images.vissrtm.bak.xml
 +
 +
 +ClearErrors
 +FileOpen $0 $INSTDIR\Config\Earth\Images.xml a
 +IfErrors done
 +FileSeek $0 -31 END
 +
 +
 +FileWrite $0 " <QuadTileSet ShowAtStartup="
 +FileWriteByte $0 "34"
 +FileWrite $0 "false"
 +FileWriteByte $0 "34"
 +FileWrite $0 ">"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <Name>Colored SRTM Elevation</Name>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <DistanceAboveSurface>10</DistanceAboveSurface>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <BoundingBox>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <North>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <Value>90.0</Value> "
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </North>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <South>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <Value>-90.0</Value> "
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </South>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <West>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <Value>-180.0</Value> "
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </West>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <East>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <Value>180.0</Value> "
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </East>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </BoundingBox>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <TerrainMapped>true</TerrainMapped>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ImageAccessor>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <LevelZeroTileSizeDegrees>20</LevelZeroTileSizeDegrees>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <NumberLevels>8</NumberLevels>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <TextureSizePixels>150</TextureSizePixels>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ImageFileExtension>jpg</ImageFileExtension>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ImageTileService>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ServerUrl>http://www.worldwinddata.com/redir.php</ServerUrl>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <DataSetName>vissrtm</DataSetName>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ServerLogoFilePath>Data\Icons\Interface\vissrtm.png</ServerLogoFilePath>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </ImageTileService>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </ImageAccessor>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ExtendedInformation>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " <ToolBarImage>Data\Icons\Interface\vissrtm.png</ToolBarImage>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </ExtendedInformation>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </QuadTileSet>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 " </ChildLayerSet>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +FileWrite $0 "</LayerSet>"
 +FileWriteByte $0 "13"
 +FileWriteByte $0 "10"
 +
 +FileClose $0
 +done:
 +
 +
 +SectionEnd ; end the section
 +</pre>
[[Category:Add-ons]] [[Category:Add-ons]]
[[Category:Installer]] [[Category:Installer]]

Revision as of 22:41, 8 June 2005

I promised a few people this, so here goes.

  • Any place where you see NAME, replace with your add-ons name.
  • Download NSIS and install.
  • Create a directory to work in such as "NAME"
  • Inside this directory create another directory named "Install"
  • Create your .nsi script. Open up notepad (or another favorite text editor) and paste the following:
Name "NAME"
OutFile "NAME.exe"
InstallDir "$PROGRAMFILES\NASA\World Wind v1.3"
InstallDirRegKey HKCU "Software\NASA\World Wind" ""

Section "Main Install"
  SetOutPath $INSTDIR
  File /r "Install\*.*"
SectionEnd

Page directory
Page instfiles

Save as NAME.nsi

  • Inside the "Install" directory is where you put your files. Commonly for WW this would be a "Configuration" directory, subdirectory and files, and also a "Data" directory et all. Do not put the "NASA" Directory or "Worldwind v1.3" directory in there. You want only directories and files inside of those. Hopefully this makes sense.
  • Right click on NAME.nsi and choose "Compile NSIS Script" You may also choose the compresser to use. LZMA is the best but most of the add-ons are small so this is trivial.

You should be done! A few notes:

It is pointless to zip up an exe installer, it doesn't save much room (may actually cost some).

So far the best naming convention I've seen has been.

Worldwind_1.3_NAME_0.1.exe

It would be nice if Add-on developers stuck to the same convention especially putting in WW's version number in there. Of course adjust accordingly :)

I hope it's helpfull, please feel free to comment. Special thanks for Nowak for designing the original quick and easy nsi script, and showing me how it's done.

Installing an add-on that appends to an XML config file

(Sample NSI script by Matt Mills.)

; The name of the installer
Name "Colored SRTM Elevation"

; The file to write
OutFile "vissrtm.exe"

; The default installation directory

;Name "NAME"
;OutFile "NAME.exe"
;InstallDir "$PROGRAMFILES\NASA\World Wind v1.3"
;InstallDirRegKey HKCU "Software\NASA\World Wind" ""

InstallDir "$PROGRAMFILES\NASA\World Wind 1.3\"


;--------------------------------

; Pages

Page directory
Page instfiles

;--------------------------------




; The stuff to install
Section "" ;No components page, name is not important

SetOutPath "$INSTDIR\Data\Icons\Interface\"
File vissrtm.png

CopyFiles /silent $INSTDIR\Config\Earth\Images.xml $INSTDIR\Images.vissrtm.bak.xml


ClearErrors
FileOpen $0 $INSTDIR\Config\Earth\Images.xml a
IfErrors done
FileSeek $0 -31 END


FileWrite $0 "		<QuadTileSet ShowAtStartup="
FileWriteByte $0 "34"
FileWrite $0 "false"
FileWriteByte $0 "34"
FileWrite $0 ">"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<Name>Colored SRTM Elevation</Name>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<DistanceAboveSurface>10</DistanceAboveSurface>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<BoundingBox>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<North>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<Value>90.0</Value> "
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				</North>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<South>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<Value>-90.0</Value> "
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				</South>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<West>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<Value>-180.0</Value> "
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				</West>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<East>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<Value>180.0</Value> "
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				</East>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			</BoundingBox>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<TerrainMapped>true</TerrainMapped>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<ImageAccessor>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<LevelZeroTileSizeDegrees>20</LevelZeroTileSizeDegrees>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<NumberLevels>8</NumberLevels>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<TextureSizePixels>150</TextureSizePixels>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<ImageFileExtension>jpg</ImageFileExtension>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<ImageTileService>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<ServerUrl>http://www.worldwinddata.com/redir.php</ServerUrl>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<DataSetName>vissrtm</DataSetName>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "					<ServerLogoFilePath>Data\Icons\Interface\vissrtm.png</ServerLogoFilePath>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				</ImageTileService>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			</ImageAccessor>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			<ExtendedInformation>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "				<ToolBarImage>Data\Icons\Interface\vissrtm.png</ToolBarImage>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "			</ExtendedInformation>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "		</QuadTileSet>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "	</ChildLayerSet>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "</LayerSet>"
FileWriteByte $0 "13"
FileWriteByte $0 "10"

FileClose $0
done:

  
SectionEnd ; end the section
Personal tools