NSIS Uninstaller Data: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:


== Download ==
== Download ==
* Main download link: <attach>UnInst.zip</attach>.
 
* Mirror download link: [http://yadi.sk/d/4tZFXsk-SPZ3K UnInst.zip].
* Main download link: <attach>UnInst.nsh</attach>.
* Mirror download link: [https://yadi.sk/d/rpxItVuTWXizf UnInst.nsh].


== Overview ==
== Overview ==
It's been discussed fairly enough that the File /r command is very useful
It's been discussed fairly enough that the File /r command is very useful
in cases when developers want to add a huge amount of sub directories and
in cases when developers want to add a huge amount of sub directories and
files, nevertheless it has the disadvantage that such an installation should
files, nevertheless it has the disadvantage that such an installation should
be uninstalled with RmDir /r which is risky and removes also data that has
be uninstalled with RmDir /r which is risky and removes also data that has
been added/created before or later within the installation folder.<br>
been added/created before or later within the installation folder. Therefore
Therefore NSIS Uninstaller Data has been madded to removes only files that  
Uninstaller Data has been madded to removes only files that have been installed.
have been installed.<br>


== Features ==
== Features ==


* Creates uninstall files list and can uninstall only installed files<br>
* Creates uninstall files list and can uninstall only installed files
* Supports different uninstall list names, that is useful while installing to the same folder or some components separately
* Skip uninstall of separated components if uninstall list does not exist
* Supports update of uninstall list when using the same list name
* Supports Interactive mode, what will require confirmation to remove every other file except those files that have been installed
* Supports Localization
* Minimal macros in script (only need 3)


* Supports different uninstall list names, that is useful while installing to the same folder or some componets separately<br>
== About ==


* Skip uninstall of separated componets if uninstall list does not exist<br>
Uninstaller Data is a macro system provided in a NSIS header that creates
 
temporary exclude list of current files and checks for new files after
* Supports update of uninstall list when using the same list name<br>
installation to add them to the uninstall list.<br>
 
* Supports Interactive uninstaller mode, what will require confirmation to remove every other file exept those files that have been installed<br>
 
* Supports Localization<br>
 
* Minimal macros in script (only need 3)<br>
 
== About ==
NSIS Uninstaller Data is a macro system provided in a NSIS header that
creates temporary exclude list of current files and checks for new files
after installation to add them to the uninstall list.<br>
Optionally it can interact with user during the uninstall process for every
Optionally it can interact with user during the uninstall process for every
other file found in installation folder and requires permission to remove it.  
other file found in installation folder and requires permission to remove it.  
Also you can specify the terminate switch that will terminate the uninstaller
Also you can specify the terminate switch that will terminate the uninstaller
if the uninstall list has not been found.<br>
if the uninstall list has not been found.


== Disadvantage ==
== Disadvantage ==
If the installation process will be not successfully the uninstall list will
If the installation process will be not successfully the uninstall list will
not contain new created files during that installation.<br>
not contain new created files during that installation.<br>
If some other files during installation process will be added to a destination
If some other files during installation process will be added to a destination
folder they will be also included to the uninstall list.<br>
folder they will be also included to the uninstall list.<br>
If uninstall list file is missing uninstaller won't be able to uninstall files.<br>
If uninstall list file is missing, uninstaller won't be able to uninstall files.  
Therefore sometimes it's better to use [http://nsis.sourceforge.net/Uninstall_Header_Recursive_File_List_Maker Uninstall Header Recursive File List Maker].


== License ==
== License ==
Line 57: Line 55:


*The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file.  
*The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file.  
*If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required.
*If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required.
*Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file.
*Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file.
*This notice may not be removed or altered from any distribution.
*This notice may not be removed or altered from any distribution.



Revision as of 21:19, 13 July 2014

Author: Liteshield (talk, contrib)


Download

Overview

It's been discussed fairly enough that the File /r command is very useful in cases when developers want to add a huge amount of sub directories and files, nevertheless it has the disadvantage that such an installation should be uninstalled with RmDir /r which is risky and removes also data that has been added/created before or later within the installation folder. Therefore Uninstaller Data has been madded to removes only files that have been installed.

Features

  • Creates uninstall files list and can uninstall only installed files
  • Supports different uninstall list names, that is useful while installing to the same folder or some components separately
  • Skip uninstall of separated components if uninstall list does not exist
  • Supports update of uninstall list when using the same list name
  • Supports Interactive mode, what will require confirmation to remove every other file except those files that have been installed
  • Supports Localization
  • Minimal macros in script (only need 3)

About

Uninstaller Data is a macro system provided in a NSIS header that creates temporary exclude list of current files and checks for new files after installation to add them to the uninstall list.
Optionally it can interact with user during the uninstall process for every other file found in installation folder and requires permission to remove it. Also you can specify the terminate switch that will terminate the uninstaller if the uninstall list has not been found.

Disadvantage

If the installation process will be not successfully the uninstall list will not contain new created files during that installation.
If some other files during installation process will be added to a destination folder they will be also included to the uninstall list.
If uninstall list file is missing, uninstaller won't be able to uninstall files. Therefore sometimes it's better to use Uninstall Header Recursive File List Maker.

License

This header file is provided 'as-is', without any express or implied warranty.
In no event will the author be held liable for any damages arising from the use of this header file.

Permission is granted to anyone to use this header file for any purpose, including commercial applications,
and to alter it and redistribute it freely, subject to the following restrictions:

  • The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file.
  • If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  • Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file.
  • This notice may not be removed or altered from any distribution.

How to use

Add the include to the top of your script

!include "UnInst.nsh"
 
;Define uninstall list name (optimal)
!define UninstName "Uninstall"
 
;Localize (optimal)
!define UNINST_DAT_NOT_FOUND "$UNINST_DAT not found, unable to perform uninstall. Manually delete files."
!define UNINST_DAT_MISSING "$UNINST_DAT is missing, some elements could not be removed. These can be removed manually. "
!define UNINST_DEL_FILE "Delete File"
 
Section "Section Name" Sec1
 
  SetOutPath "$INSTDIR"
 
  ;Create exclude list
  !insertmacro UNINST_EXCLUDE
 
  ;Install files
  File /r App\*.*
 
  ;This will redefine ${UninstName} (optimal)
  !insertmacro UNINST_NAME "unins000"
 
  ;Store uninstall data
  !insertmacro UNINST_DATA
 
  ;Create uninstaller
  WriteUninstaller "$OUTDIR\${UninstName}.exe"
 
SectionEnd
 
Section "Uninstall"
 
  ;Require confirmation to delete every other file except installed (optimal)
  !define UNINST_INTERACTIVE
 
  ;Terminate uninstaller if the .dat file does not exist (optimal)
  !define UNINST_TERMINATE
 
  ;Delete files
  !insertmacro UNINST_DELETE "$INSTDIR" "${UninstName}"
 
  ;Remove installation folder if it is empty
  RMDir "$INSTDIR"
 
SectionEnd