Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
public:computer:nsis [2022/07/20 11:14] – [Setting Environment] alex | public:computer:nsis [2022/07/20 15:43] – alex | ||
---|---|---|---|
Line 11: | Line 11: | ||
===== Preparing Files ===== | ===== Preparing Files ===== | ||
- | * 설치 패키지를 위한 파일을 준비한다. | + | * 설치 패키지를 위한 파일을 준비한다. |
- | * NSIS Script file; 설치 패키지를 만드는 스크립트, | + | * NSIS Script file; 설치 패키지를 만드는 스크립트, |
* Prepare files to install; 설치할 파일을 준비한다. | * Prepare files to install; 설치할 파일을 준비한다. | ||
- | * make 7z file into Input directory < | + | * make 7z file into Input directory; 생성한 ustra.7z 파일을 Input 디렉토리에 넣는다. |
├─tools | ├─tools | ||
│ ├─apache-maven-3.8.1 | │ ├─apache-maven-3.8.1 | ||
Line 28: | Line 28: | ||
</ | </ | ||
* Create Output Directory; 설치 패키지의 최종 결과 파일을 저장할 디렉토리를 생성한다. | * Create Output Directory; 설치 패키지의 최종 결과 파일을 저장할 디렉토리를 생성한다. | ||
- | * Structures; 설치 패키지를 위한 디렉토리 구조는 아래와 같다. < | + | * Structures; 설치 패키지를 위한 디렉토리 구조는 아래와 같다. < |
└─*.nsi | └─*.nsi | ||
| | ||
Line 38: | Line 38: | ||
===== Scripts ===== | ===== Scripts ===== | ||
- | * 스크립트를 작성한다. | + | |
+ | | ||
+ | ; Script generated by the HM NIS Edit Script Wizard. | ||
+ | |||
+ | ; HM NIS Edit Wizard helper defines | ||
+ | !define PRODUCT_NAME " | ||
+ | !define PRODUCT_VERSION " | ||
+ | !define PRODUCT_UNINST_KEY " | ||
+ | !define PRODUCT_UNINST_ROOT_KEY " | ||
+ | |||
+ | ; MUI 1.67 compatible ------ | ||
+ | !include " | ||
+ | |||
+ | ; MUI Settings | ||
+ | !define MUI_ABORTWARNING | ||
+ | ;!define MUI_ICON " | ||
+ | !define MUI_ICON " | ||
+ | ;!define MUI_UNICON " | ||
+ | !define MUI_UNICON " | ||
+ | |||
+ | ; Welcome page | ||
+ | !insertmacro MUI_PAGE_WELCOME | ||
+ | ; Directory page | ||
+ | !insertmacro MUI_PAGE_DIRECTORY | ||
+ | ; Instfiles page | ||
+ | ;!define MUI_FINISHPAGE_NOAUTOCLOSE | ||
+ | !insertmacro MUI_PAGE_INSTFILES | ||
+ | ; Finish page | ||
+ | !insertmacro MUI_PAGE_FINISH | ||
+ | |||
+ | ; Uninstaller pages | ||
+ | !insertmacro MUI_UNPAGE_INSTFILES | ||
+ | |||
+ | ; Language files | ||
+ | !insertmacro MUI_LANGUAGE " | ||
+ | |||
+ | ; MUI end ------ | ||
+ | |||
+ | Name " | ||
+ | OutFile " | ||
+ | ;InstallDir " | ||
+ | InstallDir " | ||
+ | ShowInstDetails show | ||
+ | ShowUnInstDetails show | ||
+ | |||
+ | ; Global Variables -------- | ||
+ | Var fileSTS4Ini | ||
+ | Var fileGitInstaller | ||
+ | Var fileNodejsInstaller | ||
+ | Var fileYarnInstaller | ||
+ | |||
+ | |||
+ | Function InitInstallers | ||
+ | StrCpy $fileSTS4Ini " | ||
+ | StrCpy $fileGitInstaller " | ||
+ | StrCpy $fileNodejsInstaller " | ||
+ | StrCpy $fileYarnInstaller " | ||
+ | FunctionEnd | ||
+ | |||
+ | Function WriteSTS4IniFile | ||
+ | ; Write SpringToolSuite4.ini file | ||
+ | ;FileOpen $9 $INSTDIR\tools\sts-4.7.1\SpringToolSuite4.ini w ; Opens a Empty File and fills it | ||
+ | FileOpen $9 $fileSTS4Ini w ; Opens a Empty File and fills it | ||
+ | FileWrite $9 " | ||
+ | plugins/ | ||
+ | --launcher.library$\r$\n\ | ||
+ | plugins/ | ||
+ | -product$\r$\n\ | ||
+ | org.springframework.boot.ide.branding.sts4$\r$\n\ | ||
+ | --launcher.defaultAction$\r$\n\ | ||
+ | openFile$\r$\n\ | ||
+ | -vm$\r$\n\ | ||
+ | $INSTDIR\tools\java\java-1.8.0-openjdk-1.8.0.212-1\bin\javaw.exe$\r$\n\ | ||
+ | -vmargs$\r$\n\ | ||
+ | -Dosgi.requiredJavaVersion=1.8$\r$\n\ | ||
+ | -Dosgi.dataAreaRequiresExplicitInit=true$\r$\n\ | ||
+ | -Xms256m$\r$\n-Xmx2048m$\r$\n\ | ||
+ | --add-modules=ALL-SYSTEM$\r$\n\ | ||
+ | -javaagent: | ||
+ | -Dfile.encoding=UTF-8$\r$\n" | ||
+ | FileClose $9 ; Closes the filled file | ||
+ | FunctionEnd | ||
+ | |||
+ | Function AddEnvironmentVariablesInHKCU | ||
+ | ; add Environment Variables | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | ; JAVA_HOME | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | ; GRADLE_HOME | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | ; MAVEN_HOME | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | FunctionEnd | ||
+ | |||
+ | Function AddPathsInHKCU | ||
+ | ; add Paths | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | EnVar:: | ||
+ | Pop $0 | ||
+ | DetailPrint " | ||
+ | ; | ||
+ | ; | ||
+ | ;Pop $0 | ||
+ | ; | ||
+ | FunctionEnd | ||
+ | |||
+ | Function InstallGit | ||
+ | ; Install git | ||
+ | ; ExecWait " | ||
+ | ExecWait $fileGitInstaller ;" | ||
+ | FunctionEnd | ||
+ | |||
+ | Function InstallNodejs | ||
+ | ; Install Node.js v12.22.9 | ||
+ | ${If} $R0 == "" | ||
+ | ;ExecWait ' | ||
+ | ExecWait ' | ||
+ | ${Else} | ||
+ | ${If} $R0 == " | ||
+ | ; already installed, skip this step | ||
+ | ${Else} | ||
+ | ; uninstall different version and install v12.22.9 version | ||
+ | ExecWait " | ||
+ | ;ExecWait ' | ||
+ | ExecWait ' | ||
+ | ${EndIf} | ||
+ | ${EndIf} | ||
+ | FunctionEnd | ||
+ | |||
+ | Function InstallYarn | ||
+ | ; Install Yarn | ||
+ | ; ExecWait ' | ||
+ | ExecWait ' | ||
+ | FunctionEnd | ||
+ | |||
+ | Function CreateDesktopShortcuts | ||
+ | ; Create Desktop Shortcuts | ||
+ | CreateShortCut " | ||
+ | CreateShortCut " | ||
+ | FunctionEnd | ||
+ | |||
+ | Section " | ||
+ | SetOutPath " | ||
+ | SetOverwrite ifnewer | ||
+ | File " | ||
+ | |||
+ | ; First above all, Extract Compressed file | ||
+ | Nsis7z:: | ||
+ | |||
+ | ; Set Variables to Install | ||
+ | Call InitInstallers | ||
+ | ; Set SpringToolSuite4.ini File | ||
+ | Call WriteSTS4IniFile | ||
+ | |||
+ | ; Install Utilities | ||
+ | ; Install Node.js | ||
+ | Call InstallNodejs | ||
+ | ; Install Yarn | ||
+ | Call InstallYarn | ||
+ | ; Install Git | ||
+ | Call InstallGit | ||
+ | |||
+ | ; Set Environment Variables, HKEY_CURRENT_USER | ||
+ | ; Add Environment Values; JAVA_HOME, GRADLE_HOME, | ||
+ | Call AddEnvironmentVariablesInHKCU | ||
+ | ; Add Paths; %JAVA_HOME%\bin, | ||
+ | Call AddPathsInHKCU | ||
+ | |||
+ | ; Create Desktop Shortcuts for VSCode, STS4 | ||
+ | Call CreateDesktopShortcuts | ||
+ | |||
+ | ; When installation completed, delete compressed file | ||
+ | Delete " | ||
+ | |||
+ | SectionEnd | ||
+ | |||
+ | Section -AdditionalIcons | ||
+ | CreateDirectory " | ||
+ | CreateShortCut " | ||
+ | SectionEnd | ||
+ | |||
+ | Section -Post | ||
+ | WriteUninstaller " | ||
+ | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " | ||
+ | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " | ||
+ | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " | ||
+ | SectionEnd | ||
+ | |||
+ | |||
+ | Function un.onUninstSuccess | ||
+ | HideWindow | ||
+ | MessageBox MB_ICONINFORMATION|MB_OK " | ||
+ | FunctionEnd | ||
+ | |||
+ | Function un.onInit | ||
+ | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 " | ||
+ | Abort | ||
+ | FunctionEnd | ||
+ | |||
+ | Section Uninstall | ||
+ | ; Delete " | ||
+ | ; Delete " | ||
+ | ; Delete " | ||
+ | |||
+ | ; Delete environment variables | ||
+ | ; JAVA_HOME | ||
+ | ; | ||
+ | EnVar:: | ||
+ | ; GRADLE_HOME | ||
+ | ; | ||
+ | EnVar:: | ||
+ | ; MAVEN_HOME | ||
+ | ; | ||
+ | EnVar:: | ||
+ | EnVar:: | ||
+ | |||
+ | ; Delete Path | ||
+ | EnVar:: | ||
+ | EnVar:: | ||
+ | EnVar:: | ||
+ | |||
+ | Delete " | ||
+ | |||
+ | Delete " | ||
+ | Delete " | ||
+ | |||
+ | RMDir " | ||
+ | RMDir /r " | ||
+ | |||
+ | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} " | ||
+ | SetAutoClose true | ||
+ | SectionEnd | ||
+ | </ | ||
===== Build & Test ===== | ===== Build & Test ===== | ||
- | * Build; 작성한 스크립트를 빌드한다. 오류가 없으면 설치 파일이 생성된다. | + | * Build; 작성한 스크립트를 빌드한다. 오류가 없으면 설치 파일이 생성된다. |
* Test on Windows | * Test on Windows | ||
* 설치 테스트를 위한 Windows 운영체제를 준비한다; | * 설치 테스트를 위한 Windows 운영체제를 준비한다; | ||
Line 53: | Line 298: | ||
* Git | * Git | ||
* 시스템 환경 변수 편집 혹은 CMD 등에서 환경 설정 내용을 확인한다; | * 시스템 환경 변수 편집 혹은 CMD 등에서 환경 설정 내용을 확인한다; | ||
- | * 확인 후 의도한 대로 설치되지 않았으면 스크립트 수정 후 빌드 -> 테스트를 다시 진행하고, | + | * 확인 후 의도한 대로 설치되지 않았으면 스크립트 수정 후 빌드 -> 테스트를 다시 진행하고, |
* 확인이 완료되면 배포한다. | * 확인이 완료되면 배포한다. | ||
Line 66: | Line 311: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | * {{: |