@@ -90,7 +90,7 @@ SpaceTexts none
9090; Finish page
9191!define MUI_FINISHPAGE_NOAUTOCLOSE
9292!define MUI_FINISHPAGE_SHOWREADME_TEXT " show config"
93- !define MUI_FINISHPAGE_SHOWREADME " $INSTDIR\mamonsu.conf "
93+ !define MUI_FINISHPAGE_SHOWREADME " $INSTDIR\${CONFIG_FILE} "
9494!insertmacro MUI_PAGE_FINISH
9595
9696; Uninstall
@@ -120,15 +120,15 @@ Section "${NAME} ${VERSION}" SectionMamonsu
120120 ${endif}
121121
122122 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} "
126126 CreateDirectory " $log_dir"
127127 WriteUninstaller " $INSTDIR\Uninstall.exe"
128128
129129 ; create user
130130 Call CreateUser
131- ; create mamonsu .conf
131+ ; create agent .conf
132132 Call CreateConfig
133133 ; create service
134134 Call CreateService
@@ -468,21 +468,21 @@ Function CreateConfig
468468 ${if} $action == ' downgrade'
469469 ${OrIf} $action == ' upgrade'
470470
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
473473 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
476476 StrCpy $5 " exist"
477477 Goto recreate_config
478478 ${else} ; do not exist
479479 Goto recreate_config
480480 ${endif}
481481
482482 ${elseif} $action == ' reinstall'
483- ${if} ${FileExists} " $ext_inst_dir\mamonsu.conf "
483+ ${if} ${FileExists} " $ext_inst_dir\${CONFIG_FILE} "
484484 # 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
486486 Goto cancel
487487 ${else}
488488 Goto recreate_config
@@ -511,7 +511,7 @@ Function CreateConfig
511511[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 \
512512[log]$\r$\n file = $log_dir\${LOG_FILE}$\r$\n level = INFO$\r$\n '
513513 FileClose $0
514- Rename $1 " $INSTDIR\mamonsu.conf "
514+ Rename $1 " $INSTDIR\${CONFIG_FILE} "
515515 ${endif}
516516
517517 AccessControl::DisableFileInheritance " $INSTDIR"
@@ -535,11 +535,11 @@ Function CreateConfig
535535 AccessControl::GrantOnFile " $log_dir" " ${USER}" " FullAccess"
536536 AccessControl::GrantOnFile " $log_dir" " ${USER}" " AddFile"
537537
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"
540540
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"
543543 cancel:
544544FunctionEnd
545545
@@ -596,7 +596,7 @@ Function CreateService
596596 ${OrIf} $action == ' downgrade'
597597 DetailPrint " It`s upgrade/downgrade, service must be updated to reflect new path to binary"
598598 DetailPrint " Updating service ..."
599- nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\service_win32.exe " update'
599+ nsExec::ExecToStack /TIMEOUT= 10000 ' "$INSTDIR\${SERVICE_FILE} " update'
600600 Pop $0
601601 Pop $1
602602 ${if} $0 == 0
@@ -616,7 +616,7 @@ Function CreateService
616616 ${endif}
617617 ${endif}
618618 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'
620620 Pop $0
621621 Pop $1
622622 ${if} $0 == 0
@@ -660,9 +660,13 @@ Function DeleteDirectory
660660 ${if} $action == ' downgrade'
661661 ${orif} $action == ' upgrade'
662662 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}"
666670 Delete " $ext_inst_dir\Uninstall.exe"
667671 compare_log_dirs:
668672 ${if} $ext_log_dir != $log_dir
@@ -677,7 +681,8 @@ FunctionEnd
677681; Uninstall functions
678682Function un.CheckExist
679683 ; добавить проверку директории
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"
681686FunctionEnd
682687
683688Function un.DeleteService
@@ -690,9 +695,9 @@ Function un.DeleteService
690695 DetailPrint " Result: error"
691696 ${EndIf}
692697
693- # remove
698+ # remove service
694699 DetailPrint " Removing service mamonsu ..."
695- nsExec::ExecToStack ' "$INSTDIR\service_win32.exe " remove'
700+ nsExec::ExecToStack ' "$INSTDIR\${SERVICE_FILE} " remove'
696701 Pop $0
697702 Pop $1
698703 ${if} $0 == 0
@@ -733,9 +738,10 @@ Function un.DeleteReg
733738FunctionEnd
734739
735740Function 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}"
739745 Delete " $INSTDIR\Uninstall.exe"
740746 Delete " $ext_log_dir\${LOG_FILE}"
741747 RMDir " $ext_log_dir"
0 commit comments