-
Notifications
You must be signed in to change notification settings - Fork 42
/
urbackup_x64.nsi
144 lines (108 loc) · 4.34 KB
/
urbackup_x64.nsi
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
!define MUI_BRANDINGTEXT "UrBackup 0.22"
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
!include WinVer.nsh
!include "x64.nsh"
!define MUI_ICON "backup-ok.ico"
SetCompressor /FINAL /SOLID lzma
CRCCheck On
Name "UrBackup 0.22"
OutFile "UrBackup Client 0.22-1-x64.exe"
InstallDir "$PROGRAMFILES\UrBackup"
RequestExecutionLevel highest
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "German"
Section "install"
${IfNot} ${RunningX64}
MessageBox MB_OK "Dies ist die Installationsdatei fuer das 64Bit Betriebssystem. Das momentane Betriebssystem ist nicht 64-bittig. Benutzen sie die andere Installationsdatei."
Abort "Falsche Installationsdatei"
${EndIf}
!insertmacro DisableX64FSRedirection
SetRegView 64
StrCpy $0 "UrBackupClient.exe"
KillProc::KillProcesses
SimpleSC::StopService "UrBackupServer"
Pop $0
SimpleSC::RemoveService "UrBackupServer"
Pop $0
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninstall.exe"
CreateDirectory "$SMPROGRAMS\UrBackup"
CreateShortCut "$SMPROGRAMS\UrBackup\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\UrBackup\UrBackup.lnk" "$INSTDIR\UrBackupClient.exe" "" "$INSTDIR\UrBackupClient.exe" 0
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "DisplayName" "UrBackup (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "UninstallString" "$INSTDIR\Uninstall.exe"
File "data\args.txt"
File "data\backup-bad.ico"
File "data\backup-ok.ico"
File "data\backup-ok-big.ico"
File "data\backup-progress.ico"
File "data_x64\fileservplugin.dll"
File "data_x64\fsimageplugin.dll"
File "data\new.txt"
File "data_x64\urbackup.dll"
File "data_x64\UrBackupClient.exe"
File "data_x64\urbackupsrv.exe"
File "data\logo1.png"
File "data\backup-progress-pause.ico"
SetOutPath "$INSTDIR\urbackup"
File "data\urbackup\backup_client_new.db"
CreateDirectory "$INSTDIR\urbackup\data"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "UrBackupClient" "$INSTDIR\UrBackupClient.exe"
;${If} ${IsWinXP}
; StrCpy $0 "$INSTDIR\args_xp.txt" ;Path of copy file from
; StrCpy $1 "$INSTDIR\args.txt" ;Path of copy file to
; StrCpy $2 0 ; only 0 or 1, set 0 to overwrite file if it already exists
; System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
; Pop $0
;${EndIf}
;${If} ${IsWin2003}
; StrCpy $0 "$INSTDIR\args_server03.txt" ;Path of copy file from
; StrCpy $1 "$INSTDIR\args.txt" ;Path of copy file to
; StrCpy $2 0 ; only 0 or 1, set 0 to overwrite file if it already exists
; System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
; Pop $0
;${EndIf}
IfFileExists "$INSTDIR\urbackup\backup_client.db" next_s do_copy
do_copy:
StrCpy $0 "$INSTDIR\urbackup\backup_client_new.db" ;Path of copy file from
StrCpy $1 "$INSTDIR\urbackup\backup_client.db" ;Path of copy file to
StrCpy $2 0 ; only 0 or 1, set 0 to overwrite file if it already exists
System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
Pop $0
next_s:
Delete "$INSTDIR\urbackup\backup_client_new.db"
nsisFirewall::AddAuthorizedApplication "$INSTDIR\urbackupsrv.exe" "UrBackup Server"
Pop $0
SimpleSC::InstallService "UrBackupServer" "UrBackup Server for doing backups" "16" "2" "$INSTDIR\urbackupsrv.exe" "" "" ""
Pop $0
SimpleSC::StartService "UrBackupServer" ""
Pop $0
SectionEnd
Section "Uninstall"
!insertmacro DisableX64FSRedirection
SetRegView 64
StrCpy $0 "UrBackupClient.exe"
KillProc::KillProcesses
SimpleSC::StopService "UrBackupServer"
Pop $0
SimpleSC::RemoveService "UrBackupServer"
Pop $0
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\UrBackup\*.*"
RMDir "$SMPROGRAMS\UrBackup"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup"
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "UrBackupClient"
SectionEnd
Function .onInstSuccess
Exec "$INSTDIR\UrBackupClient.exe"
FunctionEnd
Function un.onUninstSuccess
MessageBox MB_OK "UrBackup wurde erfolgreich deinstalliert."
FunctionEnd