summaryrefslogtreecommitdiffstats
path: root/data/liveusb-creator.nsi
blob: 73ffde00002fbfd6b22452c1405bbcabdb15b6f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Name "LiveUSB Creator 3.9.4"
OutFile "liveusb-creator-3.9.4-setup.exe"

SetCompressor lzma

InstallDir "$PROGRAMFILES\LiveUSB Creator"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\LiveUSB Creator" ""

DirText "Select the directory to install LiveUSB Creator in:"

Icon liveusb-creator.ico

Section ""

	; Install files.

	SetOverwrite on

	SetOutPath $INSTDIR

	File vcredist_x86.exe
	IfFileExists "$WINDIR\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375" vcredist_install_finished vcredist_silent_install
	vcredist_silent_install:
	DetailPrint "Installing the Microsoft Visual C++ 2008 Redistributable Package"
	ExecWait '"$INSTDIR\vcredist_x86.exe" /q'
	vcredist_install_finished:
	Delete "$INSTDIR\vcredist_x86.exe"

	File liveusb-creator.exe
	File LICENSE.txt
	File README.txt
	File w9xpopen.exe
	
	SetOutPath $INSTDIR\tools
	File tools\7z.dll
	File tools\7z.exe
	File tools\7-Zip-License.txt
	File tools\dd.exe
	File tools\syslinux.exe
	
	; Create shortcut.

	SetOutPath -
	CreateDirectory "$SMPROGRAMS\LiveUSB Creator"
	CreateShortCut "$SMPROGRAMS\LiveUSB Creator\LiveUSB Creator.lnk" "$INSTDIR\liveusb-creator.exe"
	CreateShortCut "$SMPROGRAMS\LiveUSB Creator\Uninstall LiveUSB Creator.lnk" "$INSTDIR\uninst.exe" "" "$INSTDIR\uninst.exe" 0

	; Optionally start program.

	MessageBox MB_YESNO|MB_ICONQUESTION "Run LiveUSB Creator now?" IDNO SkipRunProgram
	Exec "$INSTDIR\liveusb-creator.exe"
SkipRunProgram:

	; Create uninstaller.

	WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\LiveUSB Creator" "" "$INSTDIR"
	WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\LiveUSB Creator" "DisplayName" "LiveUSB Creator (remove only)"
	WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\LiveUSB Creator" "UninstallString" '"$INSTDIR\uninst.exe"'
	WriteUninstaller "$INSTDIR\uninst.exe"

SectionEnd

UninstallText "This will uninstall LiveUSB Creator from your system."

Section Uninstall

	; Delete shortcuts.

	Delete "$SMPROGRAMS\LiveUSB Creator\LiveUSB Creator.lnk"
	Delete "$SMPROGRAMS\LiveUSB Creator\Uninstall LiveUSB Creator.lnk"
	RMDir "$SMPROGRAMS\LiveUSB Creator"
	Delete "$DESKTOP\LiveUSB Creator.lnk"

	; Delete registry keys.

	Delete "$INSTDIR\uninst.exe"
	DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\LiveUSB Creator"
	DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LiveUSB Creator"

	; Delete files.

	Delete "$INSTDIR\liveusb-creator.exe"
	Delete "$INSTDIR\LICENSE.txt"
	Delete "$INSTDIR\README.txt"
	Delete "$INSTDIR\w9xpopen.exe"
	
	Delete "$INSTDIR\tools\7z.dll"
	Delete "$INSTDIR\tools\7z.exe"
	Delete "$INSTDIR\tools\7-Zip-License.txt"
	Delete "$INSTDIR\tools\dd.exe"
	Delete "$INSTDIR\tools\syslinux.exe"

	Delete "$INSTDIR\liveusb-creator.exe.log"

	; Remove the installation directories.

	RMDir "$INSTDIR\tools"
	RMDir "$INSTDIR"

SectionEnd