Old 11th February 2015, 07:33   #1
yzldni
Junior Member
 
Join Date: Mar 2014
Posts: 26
Question About uninstaller

hello ,

my problem is:

how can i create two or three uninstaller in a installer,,

beause i have some module ex: module1, module2 ....

and i want to module1 have an uninstaller,, module2 have an uninstaller too..

my code:
Section "un.module1"

Section

Section "un.module2"

Section

i want to have two uninstaller is uninstall1 and uninstall2 ,,when i click uninstall1, it will uninstall module1,,when i click uninstall2,,,it will uninstall module2
yzldni is offline   Reply With Quote
Old 11th February 2015, 13:57   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,267
NSIS was not really designed to support this scenario, you might want to consider creating a full installer/uninstaller for each module.

If you really must do this:

Quote:
InstallDir $temp\Test
Page Components
Page Directory
Page InstFiles
UninstPage Components
UninstPage InstFiles

!include Sections.nsh
Function un.onInit
FileOpen $0 "$EXEPATH" r
FileSeek $0 -1 END
FileReadByte $0 $1
FileClose $0
!insertmacro SelectSection $1
FunctionEnd
!macro WriteOneSectionUninstaller sid path
WriteUninstaller "${path}"
FileOpen $0 "${path}" a
FileSeek $0 0 END
FileWriteByte $0 ${sid}
FileClose $0
!macroend

Section /o "un.Product A" SID_UNA
Delete "$InstDir\A.exe"
Delete "$InstDir\UninstA.exe"
RMDIr "$InstDir"
SectionEnd

Section /o "un.Product B" SID_UNB
Delete "$InstDir\B.exe"
Delete "$InstDir\UninstB.exe"
RMDIr "$InstDir"
SectionEnd

Section "Product A"
SetOutPath "$InstDir"
File "/oname=$InstDir\A.exe" "${__FILE__}"
!insertmacro WriteOneSectionUninstaller ${SID_UNA} "$InstDir\UninstA.exe"
SectionEnd

Section "Product B"
SetOutPath "$InstDir"
File "/oname=$InstDir\B.exe" "${__FILE__}"
!insertmacro WriteOneSectionUninstaller ${SID_UNB} "$InstDir\UninstB.exe"
SectionEnd

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
nsis, uninstaller

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump