Details on the scripts available for customising the default templates

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion 2004-07-05 05:29:02 +00:00
parent 8fb33b4a12
commit bcfcbdea89

View File

@ -171,6 +171,87 @@
</section>
<section name="Default Template Scripts">
<p>
There are several .nsh files that you can place in <code>${maven.nsis.src}</code>
directory to add functionality to the installer. In this section, we'll look
at an example for each of the scripts included by the default template that
will be overridden.
</p>
<subsection name="before-install.nsh">
<p>
This file is used to do any pre-installation checks. It can hold any
<a href="http://nsis.sourceforge.net/Docs/">valid NSIS code</a>.
</p>
<p>
One example is to check the environment has been correctly set up, e.g.
</p>
<source>Call AssertJavaHome</source>
<p>
This will check, using the function provided in <code>JDK.nsh</code>,
that an environment variable for <code>JAVA_HOME</code> is available,
and abort the installation if it's not.
</p>
</subsection>
<subsection name="desktop-shortcuts.nsh">
<p>
If you provide this file, the installer will allow the user to choose
whether or not to create shortcuts on the desktop. The shortcuts specified
in this file will be created.
</p>
<p>
As always, see the <a href="http://nsis.sourceforge.net/Docs/">NSIS docs</a>
for details on the code to use. The example below creates a shortcut
on the desktop to <code>maven.bat</code> from the installation directory
the user has chosen.
</p>
<source>CreateShortCut "$DESKTOP\Maven.lnk" "$INSTDIR\bin\maven.bat" "" "$INSTDIR\bin\maven.bat" 0</source>
</subsection>
<subsection name="registry.nsh">
<p>
During installation, you may want to add entries to the user's registry
or environment for use either in your application, the installation process, or uninstall.
Here's a small example that adds an environment variable called <code>MYAPP_HOME</code>
with the value of the installation directory.
</p>
<source>
Push "MYAPP_HOME"
Push "$INSTDIR"
Call WriteEnvStr
</source>
<p>
Note: this relies on the included functions from <code>Environment.nsh</code>.
</p>
</subsection>
<subsection name="registry-uninstall.nsh">
<p>
During uninstallation, you must remove any entries to the user's registry
or environment. Here's a small example that removes an environment variable
called <code>MYAPP_HOME</code>.
</p>
<source>
Push "MYAPP_HOME"
Call un.DeleteEnvStr
</source>
</subsection>
<subsection name="startmenu-shortcuts.nsh">
<p>
If you provide this file, the installer will allow the user to choose
whether or not to create shortcuts in the <code>Start Menu</code>.
The shortcuts specified in this file will be created.
</p>
<source>
CreateShortCut "${PROJECT_STARTMENU_FOLDER}\Myapp.lnk" "$INSTDIR\bin\myapp.bat" "" "$INSTDIR\bin\myapp.bat" 0
CreateShortCut "${PROJECT_STARTMENU_FOLDER}\Uninstall.lnk" "$INSTDIR\Uninst.exe" "" "$INSTDIR\Uninst.exe" 0
CreateShortCut "${PROJECT_STARTMENU_FOLDER}\Homepage.lnk" "http://www.myapp.nfi/"
CreateShortCut "${PROJECT_STARTMENU_FOLDER}\User Guide.lnk" "http://www.myapp.nfi/user-guide.html"
</source>
</subsection>
</section>
<section name="Custom Templates">