setup.nsi 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. !define APP_NAME "SimpleCarApp"
  2. !define APP_VERSION "1.0.0"
  3. !define APP_PUBLISHER "Студенческий проект"
  4. !define APP_EXE "SimpleCarApp.exe"
  5. !define INSTALL_DIR "$PROGRAMFILES\SimpleCarApp"
  6. !define REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
  7. Name "${APP_NAME} ${APP_VERSION}"
  8. OutFile "SimpleCarAppSetup.exe"
  9. InstallDir "${INSTALL_DIR}"
  10. InstallDirRegKey HKLM "${REG_KEY}" "InstallLocation"
  11. RequestExecutionLevel admin
  12. Page directory
  13. Page instfiles
  14. UninstPage uninstConfirm
  15. UninstPage instfiles
  16. Section "MainSection" SEC01
  17. SetOutPath "$INSTDIR"
  18. File /r "files\*.*"
  19. CreateShortcut "$DESKTOP\SimpleCarApp.lnk" "$INSTDIR\${APP_EXE}"
  20. CreateDirectory "$SMPROGRAMS\${APP_NAME}"
  21. CreateShortcut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
  22. CreateShortcut "$SMPROGRAMS\${APP_NAME}\Удалить.lnk" "$INSTDIR\uninstall.exe"
  23. WriteRegStr HKLM "${REG_KEY}" "DisplayName" "${APP_NAME}"
  24. WriteRegStr HKLM "${REG_KEY}" "DisplayVersion" "${APP_VERSION}"
  25. WriteRegStr HKLM "${REG_KEY}" "Publisher" "${APP_PUBLISHER}"
  26. WriteRegStr HKLM "${REG_KEY}" "InstallLocation" "$INSTDIR"
  27. WriteRegStr HKLM "${REG_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
  28. WriteUninstaller "$INSTDIR\uninstall.exe"
  29. MessageBox MB_OK "Installation complete! Please ensure PostgreSQL is running."
  30. SectionEnd
  31. Section "Uninstall"
  32. RMDir /r "$INSTDIR"
  33. Delete "$DESKTOP\SimpleCarApp.lnk"
  34. Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk"
  35. Delete "$SMPROGRAMS\${APP_NAME}\Удалить.lnk"
  36. RMDir "$SMPROGRAMS\${APP_NAME}"
  37. DeleteRegKey HKLM "${REG_KEY}"
  38. MessageBox MB_OK "Uninstall complete."
  39. SectionEnd