@@ -90,7 +90,7 @@ SpaceTexts none
90
90
; Finish page
91
91
!define MUI_FINISHPAGE_NOAUTOCLOSE
92
92
!define MUI_FINISHPAGE_SHOWREADME_TEXT " show config"
93
- !define MUI_FINISHPAGE_SHOWREADME " $INSTDIR\mamonsu.conf "
93
+ !define MUI_FINISHPAGE_SHOWREADME " $INSTDIR\${CONFIG_FILE} "
94
94
!insertmacro MUI_PAGE_FINISH
95
95
96
96
; Uninstall
@@ -120,15 +120,15 @@ Section "${NAME} ${VERSION}" SectionMamonsu
120
120
${endif}
121
121
122
122
SetOutPath " $INSTDIR"
123
- File " ..\..\dist\service_win32.exe "
124
- File " ..\..\dist\mamonsu.exe "
125
- File " ..\..\packaging\conf\template_win32.xml "
123
+ File " ..\..\dist\${SERVICE_FILE} "
124
+ File " ..\..\dist\${EXE_FILE} "
125
+ File " ..\..\packaging\conf\${TEMPLATE_FILE} "
126
126
CreateDirectory " $log_dir"
127
127
WriteUninstaller " $INSTDIR\Uninstall.exe"
128
128
129
129
; create user
130
130
Call CreateUser
131
- ; create mamonsu .conf
131
+ ; create agent .conf
132
132
Call CreateConfig
133
133
; create service
134
134
Call CreateService
@@ -468,21 +468,21 @@ Function CreateConfig
468
468
${if} $action == ' downgrade'
469
469
${OrIf} $action == ' upgrade'
470
470
471
- ${if} ${FileExists} " $ext_inst_dir\mamonsu.conf "
472
- ${ConfigRead} " $ext_inst_dir\mamonsu.conf " " file =" $0 ; put log_file_name in $0
471
+ ${if} ${FileExists} " $ext_inst_dir\${CONFIG_FILE} "
472
+ ${ConfigRead} " $ext_inst_dir\${CONFIG_FILE} " " file =" $0 ; put log_file_name in $0
473
473
DetailPrint " Copying config file to new install directory ..."
474
- CopyFiles " $ext_inst_dir\mamonsu.conf " " $INSTDIR"
475
- ${ConfigWrite} " $INSTDIR\mamonsu.conf " " file = " " $log_dir\${LOG_FILE}" $0
474
+ CopyFiles " $ext_inst_dir\${CONFIG_FILE} " " $INSTDIR"
475
+ ${ConfigWrite} " $INSTDIR\${CONFIG_FILE} " " file = " " $log_dir\${LOG_FILE}" $0
476
476
StrCpy $5 " exist"
477
477
Goto recreate_config
478
478
${else} ; do not exist
479
479
Goto recreate_config
480
480
${endif}
481
481
482
482
${elseif} $action == ' reinstall'
483
- ${if} ${FileExists} " $ext_inst_dir\mamonsu.conf "
483
+ ${if} ${FileExists} " $ext_inst_dir\${CONFIG_FILE} "
484
484
# if user decided to choose different log directory while reinstalling
485
- ${ConfigWrite} " $ext_inst_dir\mamonsu.conf " " file = " " $log_dir\${LOG_FILE}" $0
485
+ ${ConfigWrite} " $ext_inst_dir\${CONFIG_FILE} " " file = " " $log_dir\${LOG_FILE}" $0
486
486
Goto cancel
487
487
${else}
488
488
Goto recreate_config
@@ -511,7 +511,7 @@ Function CreateConfig
511
511
[postgres]$\r$\n user = $pg_user$\r$\n database = $pg_db$\r$\n password = $2$\r$\n host = $pg_host$\r$\n port = $pg_port$\r$\n$\r$\n \
512
512
[log]$\r$\n file = $log_dir\${LOG_FILE}$\r$\n level = INFO$\r$\n '
513
513
FileClose $0
514
- Rename $1 " $INSTDIR\mamonsu.conf "
514
+ Rename $1 " $INSTDIR\${CONFIG_FILE} "
515
515
${endif}
516
516
517
517
AccessControl::DisableFileInheritance " $INSTDIR"
@@ -535,11 +535,11 @@ Function CreateConfig
535
535
AccessControl::GrantOnFile " $log_dir" " ${USER}" " FullAccess"
536
536
AccessControl::GrantOnFile " $log_dir" " ${USER}" " AddFile"
537
537
538
- AccessControl::SetFileOwner " $INSTDIR\service_win32.exe " " ${USER}"
539
- AccessControl::GrantOnFile " $INSTDIR\service_win32.exe " " (S-1-3-0)" " FullAccess"
538
+ AccessControl::SetFileOwner " $INSTDIR\${SERVICE_FILE} " " ${USER}"
539
+ AccessControl::GrantOnFile " $INSTDIR\${SERVICE_FILE} " " (S-1-3-0)" " FullAccess"
540
540
541
- AccessControl::SetFileOwner " $INSTDIR\mamonsu.conf " " ${USER}"
542
- AccessControl::GrantOnFile " $INSTDIR\mamonsu.conf " " (S-1-3-0)" " FullAccess"
541
+ AccessControl::SetFileOwner " $INSTDIR\${CONFIG_FILE} " " ${USER}"
542
+ AccessControl::GrantOnFile " $INSTDIR\${CONFIG_FILE} " " (S-1-3-0)" " FullAccess"
543
543
cancel:
544
544
FunctionEnd
545
545
@@ -596,7 +596,7 @@ Function CreateService
596
596
${OrIf} $action == ' downgrade'
597
597
DetailPrint " It`s upgrade/downgrade, service must be updated to reflect new path to binary"
598
598
DetailPrint " Updating service ..."
599
- nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\service_win32.exe " update'
599
+ nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\${SERVICE_FILE} " update'
600
600
Pop $0
601
601
Pop $1
602
602
${if} $0 == 0
@@ -616,7 +616,7 @@ Function CreateService
616
616
${endif}
617
617
${endif}
618
618
DetailPrint " Creating service ${SERVICE_NAME} ... "
619
- nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\service_win32.exe " --username "$hostname\${USER}" --password "$user_password" --startup delayed install'
619
+ nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\${SERVICE_FILE} " --username "$hostname\${USER}" --password "$user_password" --startup delayed install'
620
620
Pop $0
621
621
Pop $1
622
622
${if} $0 == 0
@@ -660,9 +660,13 @@ Function DeleteDirectory
660
660
${if} $action == ' downgrade'
661
661
${orif} $action == ' upgrade'
662
662
DetailPrint " Deleting old install directory ..."
663
- Delete " $ext_inst_dir\mamonsu.conf"
664
- Delete " $ext_inst_dir\mamonsu.exe"
665
- Delete " $ext_inst_dir\service_win32.exe"
663
+ Delete " $ext_inst_dir\${SERVICE_FILE}"
664
+ Delete " $ext_inst_dir\${CONFIG_FILE}"
665
+ Delete " $ext_inst_dir\${EXE_FILE}"
666
+ ${if} ${FileExists} " $ext_inst_dir\${OLD_EXE_FILE}"
667
+ Delete " $ext_inst_dir\${OLD_EXE_FILE}"
668
+ ${endIf}
669
+ Delete " $ext_inst_dir\${TEMPLATE_FILE}"
666
670
Delete " $ext_inst_dir\Uninstall.exe"
667
671
compare_log_dirs:
668
672
${if} $ext_log_dir != $log_dir
@@ -677,7 +681,8 @@ FunctionEnd
677
681
; Uninstall functions
678
682
Function un.CheckExist
679
683
; добавить проверку директории
680
- ReadRegStr $ext_log_dir HKLM " ${MAMONSU_REG_PATH}" " LogDir"
684
+ ReadRegStr $ext_log_dir HKLM " ${MAMONSU_REG_PATH}\${VERSION}" " LogDir"
685
+ MessageBox MB_OK " $ext_log_dir"
681
686
FunctionEnd
682
687
683
688
Function un.DeleteService
@@ -690,9 +695,9 @@ Function un.DeleteService
690
695
DetailPrint " Result: error"
691
696
${EndIf}
692
697
693
- # remove
698
+ # remove service
694
699
DetailPrint " Removing service mamonsu ..."
695
- nsExec::ExecToStack ' "$INSTDIR\service_win32.exe " remove'
700
+ nsExec::ExecToStack ' "$INSTDIR\${SERVICE_FILE} " remove'
696
701
Pop $0
697
702
Pop $1
698
703
${if} $0 == 0
@@ -733,9 +738,10 @@ Function un.DeleteReg
733
738
FunctionEnd
734
739
735
740
Function un.DeleteDirectory
736
- Delete " $INSTDIR\mamonsu.conf"
737
- Delete " $INSTDIR\mamonsu.exe"
738
- Delete " $INSTDIR\service_win32.exe"
741
+ Delete " $INSTDIR\${CONFIG_FILE}"
742
+ Delete " $INSTDIR\${EXE_FILE}"
743
+ Delete " $INSTDIR\${SERVICE_FILE}"
744
+ Delete " $INSTDIR\${TEMPLATE_FILE}"
739
745
Delete " $INSTDIR\Uninstall.exe"
740
746
Delete " $ext_log_dir\${LOG_FILE}"
741
747
RMDir " $ext_log_dir"
0 commit comments