Contents
- 1. NSIS
- 1.1. Opening Statement
- 1.2. ์ฐธ์กฐ ๋งํฌ
- 1.3. ์ ์ฒด ๊ณผ์
- 1.4. MakeNSIS usage
- 1.5. ํจ์จ์ ์ธ ๊ฐ๋ฐ์์ ํ๊ฒฝ
- 1.6. .NSI script ๊ธฐ๋ณธ ๋ฌธ๋ฒ
- 1.7. NSI Script Study
- 1.8. CHM Document
- 1.9. NSIS ์์ ์ธ์คํจ ์ค Explorer ์ฐฝ ์ ๋ถ ๋ซ๊ธฐ
- 1.10. ํด๋น dll ๋ค system32 ์ ๋๋ ํ ๋ฆฌ์ ๋ณต์ฌํด์ฃผ๊ธฐ
- 1.11. windows ๊น๋ฆฐ ์์น ์ฐพ์์ค๊ธฐ
- 1.12. ExecWait
- 1.13. NSIS ์์ ํน์ Process ๊ฐ ์ด์์๋์ง ์ฌ๋ถ ํ์ธ
- 1.14. NSIS ์์ ActiveX Component ๋ฑ๋กํ๊ธฐ
- 1.15. NSIS ์์ uninstall.exe ๋ง๋ค๊ธฐ
- 2. Thread
1.1. Opening Statement ¶
๋ณดํต ํ๋ก๊ทธ๋จ์ ๊ฐ๋ฐํ๊ณ ๋์ '๋ง๋ค์๋ค' ๋ก ๋๋๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค. ํ์ง๋ง, ์ ์ ๋ฐฐํฌ๋์๋ ํ ์ผ์ด ๋ง๋ค. ํนํ ์ ์ดํ ํ๋ก๊ทธ๋จ ๋ฑ๋ก/์ญ์ ์ ๋ฑ๋ก๋๋ ๋ฐฉ์์ด๋ผ๋์ง, ๋ ์ง์คํธ๋ฆฌ๋ฅผ ๊ฑด๋๋ฆฐ๋ค๋์ง, Program Files ํด๋์ ๋ณต์ฌํ๋ค๋์ง. ์ด ๊ฒฝ์ฐ์๋ ๋ณดํต ์ ์ฉ Installer ํ๋ก๊ทธ๋จ์ ์ฐ๊ฒ ๋์ง๋ง, ์์ง ์ ๋๋ก ์จ๋ณธ ์ ์ด ์์๋ ๊ฒ ๊ฐ๋ค.
์ด๋ฒ์๋ '๋ฐฐํฌ' ๋ผ๋ ๋
์์ ๋ํด ์ด์ ์ ๋ง์ถฐ๋ณด๊ณ ์, ์ธ์คํจ๋ฌ์ค ํ๋์ธ NSIS ์ ๋ํด ๊ฐ๋จํ ์ ๋ฆฌํ๊ณ ์ ํ๋ค. (์.. ์ด์ ํผ์ข ๋ด๋ฉด์ ๋ง๋ ํ๋ก๊ทธ๋จ ๋ณด์ฌ์ฃผ์. ^^; ์ด๊ฒ ๊ฐ์ฅ ํฐ ๋ชฉ์ . --;)
nsis ๋ free software ์ด๋ฉฐ, ์์ค๊ฐ ๊ณต๊ฐ๋์ด์๋ค. ๊ด์ฌ์๋ ์ฌ๋๋ค์ ๋ถ์ํด๋ณด์๊ธธ.
1.2. ์ฐธ์กฐ ๋งํฌ ¶
- http://www.nullsoft.com/free/nsis/ - null software ์ nsis ๊ด๋ จ ํํ์ด์ง.
- http://forums.winamp.com/forumdisplay.php?forumid=65 - nsis discussion
- http://www.nullsoft.com/free/nsis/makensitemplate.phtml - .nsi code generator
1.3. ์ ์ฒด ๊ณผ์ ¶
NSIS์ ์๋ฆฌ๋ ๊ฐ๋จํ๋ค. nsi ๋ผ๋ ์คํฌ๋ฆฝํธ ํ์ผ์ ํด์ํด์ ํด๋น ๋ง๋ ํ๋ก๊ทธ๋จ๋ค์ ํ๋์ ํ์ผ๋ก ์์ถ์ํค๊ณ ์คํํ๋ก๊ทธ๋จ์ผ๋ก ๋ง๋๋ ๊ฒ์ด๋ค. (๋ง์น ๋ฐฐ์นํ์ผ์ ์์ฑํ๋ค๊ณ ์๊ฐํ ์๋ ์๊ฒ ๋ค.)
- ํ๋ก๊ทธ๋จ์ ๊ฐ๋ฐํ๋ค.
- NSI Script ๋ฅผ ์์ฑํ๋ค.
- makensis ๋ก Script ๋ฅผ ์ปดํ์ผํ๋ค. ๊ทธ๋ฌ๋ฉด makensis ๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ถ์ํ๋ฉด์ ํฌํจํด์ผ ํ ํ์ผ๋ค์ ํ๋๋ก ๋ฌถ์ด์ค๋ค. ๊ทธ๋ฆฌ๊ณ zip์ ํ์์ผ๋ก ์์ถํด์ค๋ค. (๋ด๋ถ์ ์ผ๋ก zip2exe ๊ฐ ์ด์ฉ๋๋ค. ์ด๊ฑด zlib ์ฌ์ฉ๋จ.)
- ํ๋์ Install ํ์ผ ์์ฑ. ์๋ฃ. (๋ฟ๋ฆฌ์~ -_-v)
1.4. MakeNSIS usage ¶
NSIS installer๋ค์ 'MakeNSIS' ํ๋ก๊ทธ๋จ์ ์ํด์ NSI script (.NSI) ๋ฅผ ์ปดํ์ผํจ์ผ๋ก์ ๋ง๋ค์ด์ง๋ค.
makensis ์ ์คํ ๋ฌธ๋ฒ์ ๋๊ฐ ๋ค์๊ณผ ๊ฐ๋ค.
makensis ์ ์คํ ๋ฌธ๋ฒ์ ๋๊ฐ ๋ค์๊ณผ ๊ฐ๋ค.
~cpp Makensis [/Vx] [/Olog] [/LICENSE] [/PAUSE] [/NOCONFIG] [/CMDHELP [command]] [/HDRINFO] [/CD] [/Ddefine[=value] ...] ["/XCommand parameter" ...] [Script.nsi | - [...]]
- /LICENSE - license page๋ฅผ ๋ณด์ฌ์ค๋ค.
- /Vx (x๋ 0~4) - output ์ ํ์ ์ ๋๋ฅผ ์กฐ์ ํ๋ค.
0 : no output
1 : errors only
2 : warnings and errors
3 : info, warnings, and errors
4 : all output
- /Olog (log ๋ filename) - compile ์ค screen ์์ ํด๋น ํ์ผ์ ๋ํ log๋ฅผ ํ์ํ๋ ๋์ ํ์ผ๋ก ์ค์ ํ๋ค.
- /PAUSE - Makensis ๊ฐ ์ข
๋ฃ๋๊ธฐ ์ ์ค๊ฐ์ ์ผ์์ ์งํด์ค๋ค. ์ด๋ Windows ์์ ์ง์ ์คํํ ๋ ์ ์ฉํ๋ค.
- /NOCONFIG - nsisconfi.nsi ์ ํฌํจํ์ง ์๋๋ค. ์ด ํ๋ผ๋ฉํฐ๊ฐ ์๋ ๊ฒฝ์ฐ, ์ธ์คํจ๋ฌ๋ ๊ธฐ๋ณธ์ ์ผ๋ก nsisconf.nsi ๋ก๋ถํฐ ๊ธฐ๋ณธ์ค์ ์ด ์ธํ
๋๋ค. (NSIS Configuration File ์ฐธ์กฐ)
- /CMDHELP - command ์ ๋ํ ๊ธฐ๋ณธ์ ์ธ ์ฌ์ฉ์ ๋ณด๋ฅผ ์ถ๋ ฅํด์ค๋ค.
1.5. ํจ์จ์ ์ธ ๊ฐ๋ฐ์์ ํ๊ฒฝ ¶
NSIS ๋ ์ธ์คํจํ๊ณ ๋ ๋ค์๋ ์ค๋ฅธ์ชฝ๋ฒํผ shell-extension ์ ํด๋น ํ์ฅ์ ์ปดํ์ผ์ด ๋ฑ๋ก๋๋ค. ํ์ง๋ง command ๋ก ์๋์ผ๋ก ์ต์
์ ์ค์ ํ๋ฉด์ ์
๋ ฅํด์ฃผ๋ ๊ฒ์ด ๋ ํธํ๋ค.
๋๋ Editplus ์ ์ฌ์ฉ์๋๊ตฌ๊ทธ๋ฃน์ makensis ์ ๋ฑ๋ก์์ผ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ๋ ์๊ฒ ๋ค. (nsis ๋ฅผ ์ํ ๊ฐ๋จํ ide ๋ง๋ค์ด์ ์จ๋จน์ด๋ณด๋์ค.. ์ด์์ง๋ง. ์์.. ๊ทธ๋๋ editplus ๊ฐ ํจ ํธํ๊ธด ํ๋ค. --;)
1.6. .NSI script ๊ธฐ๋ณธ ๋ฌธ๋ฒ ¶
NSIS Script File (.nsi) ๋ command ๋ค์ ๋ฌถ์์ธ batch-file์๋ ๊ฐ์๋ณด์ด๋ text file์ด๋ค.
- ; ๋ # ์ผ๋ก ์์๋๋ ํ๋ค์ ์ ๋ถ comment ์ด๋ค.
- ;, # ๋ค์ ๋์ค๋ ๊ฒ ๋ํ comment ๋ก ์ทจ๊ธ๋๋ค.
- ์ฃผ์์ด ์๋ ํ๋ค์ 'command parameter' ์ ํํ๋ฅผ ๋ค๋ค.
- parameter ์ ์ซ์๋ค์ 10์ง์, 16์ง์, 8์ง์๋ค์ ์ด์ฉํ ์ ์๋ค. (์ผ๋ฐ ์ซ์, 0x__, 0124 ์์ผ๋ก..)
- ํํํ๊ณ ์ํ๋ string ์ ๊ณต๋ฐฑ์ด ์์ผ๋ฉด ๋ฐ์ดํ๋ฅผ ์ด์ฉํ๋ค.
ex)
~cpp MessageBox MB_OK "I'll be happy" ; this one puts a ' inside a string MessageBox MB_OK 'And he said to me "Hi there!"' ; this one puts a " inside a string MessageBox MB_OK `And he said to me "I'll be fucked!"` ; this one puts both ' and "s inside a string:
- ํ๋์ command ๊ฐ ์ฌ๋ฌ์ค์ ์ด์ฉํ๋ ๊ฒฝ์ฐ '' ๋ฅผ ์ฌ์ฉํ๋ค.
~cpp CreateShortCut "$SMPROGRAMS\NSIS\ZIP2EXE project workspace.lnk" \ "$INSTDIR\source\zip2exe\zip2exe.dsw" MessageBox MB_YESNO|MB_ICONQUESTION \ "Remove all files in your NSIS directory? (If you have anything \ you created that you want to keep, click No)" \ IDNO NoRemoveLabel
1.7. NSI Script Study ¶
NSIS ๋ ์คํฌ๋ฆฝํธ ๊ธฐ๋ฐ์ผ๋ก ์ผ์ข
์ ๋ฐฐ์นํ์ผ๊ณผ ๊ฐ์ผ๋ฏ๋ก, ์์ ์์ฃผ์ ์ ๊ทผ์ ํ๋ฉด ์ฝ๊ฒ ์ด์ฉํ ์ ์๋ค. NSIS/์์ 1, NSIS/์์ 2, NSIS/์์ 3 ๋ฑ์ ๋ถ์ํ๊ณ ์์ค๋ฅผ ์กฐ๊ธ์ฉ ์ฉ๋์ ๋ง๊ฒ ์์ ํ์ฌ ์์ฑํ๋ฉด ์ฝ๊ฒ ์ ๊ทผํ ์ ์์ ๊ฒ์ด๋ค. ์๋ฌธ์ด ์๊ธฐ๋ ๋ช
๋ น์ด๋ ์์ฑ(attribute)์ ๋ํด์๋ NSIS/Reference ๋ฅผ ์ฐธ์กฐํ๊ธฐ ๋ฐ๋๋ค.
1.8. CHM Document ¶
NSIS ์ windows installer ๋ฒ์ ์ ์ค์นํ๋ฉด NSIS.CHM ํ์ผ์ด ๊ฐ์ด ์๋ค.
1.10. ํด๋น dll ๋ค system32 ์ ๋๋ ํ ๋ฆฌ์ ๋ณต์ฌํด์ฃผ๊ธฐ ¶
~cpp ;copy files File /r `.\tmp\*.*` ;system32 ์ ๋ณต์ฌํด์ค dll ๋ค๋ ์ผ๋จ ๋ณต์ฌํด์ค๋ค. File /r `.\AdditionalDLL\*.dll` ;move system addtinoal dlls to system folder Rename "$INSTDIR\MSVCP60.dll" "$SYSDIR\MSVCP60.dll"
1.11. windows ๊น๋ฆฐ ์์น ์ฐพ์์ค๊ธฐ ¶
์ด์ฉ ์ : windows ์ system32 ๋๋ ํ ๋ฆฌ์ dll ๋ค์ ๋ณต์ฌํด์ค ๋.
~cpp Section "ThisNameIsIgnoredSoWhyBother?" . . MessageBox MB_OK "$WINDIR" MessageBox MB_OK "$SYSDIR" ; ๋ณต์ฌํ ํ์ผ์ ์ถ๊ฐํ๊ธฐ. SectionEnd ; section ์๋ฃ
1.12. ExecWait ¶
exec ๋ก ํด๋น ํ๋ก์ธ์ค๋ฅผ ์คํํ ๋ ํด๋น ํ๋ก์ธ์ค๊ฐ ์ฃฝ์ ๋ ๊น์ง wait.
regsvr32.exe ๋ก dll ์ unregister ํ ๋ค์์ ์ ์ฒด ํด๋๋ฅผ ์ญ์ ํ ๋, regsvr32.exe ๋ Exec ๊ฐ ์๋ ExecWait ๋ก ์คํํด์ฃผ์ด์ผ ํ๋ค. (๊ทธ๋ ์ง ์์ผ๋ฉด ํด๋น dll ์ด unregister ๋๊ธฐ ์ ์ dll ํ์ผ์ด delete ๋์ด ์ ์์ ์ธ uninstall ์ด ๋์ง ์์ ์๋ ์๋ค.)
regsvr32.exe ๋ก dll ์ unregister ํ ๋ค์์ ์ ์ฒด ํด๋๋ฅผ ์ญ์ ํ ๋, regsvr32.exe ๋ Exec ๊ฐ ์๋ ExecWait ๋ก ์คํํด์ฃผ์ด์ผ ํ๋ค. (๊ทธ๋ ์ง ์์ผ๋ฉด ํด๋น dll ์ด unregister ๋๊ธฐ ์ ์ dll ํ์ผ์ด delete ๋์ด ์ ์์ ์ธ uninstall ์ด ๋์ง ์์ ์๋ ์๋ค.)
1.13. NSIS ์์ ํน์ Process ๊ฐ ์ด์์๋์ง ์ฌ๋ถ ํ์ธ ¶
FindProc Plugin ์ ์ค์นํ๋ค.
์ฌ์ฉ ์ : exec ๋ก regsvr32.exe ํธ์ถ์ ๋น๋๊ธฐ ํธ์ถ์ด ๋์ด ๋ค์ delete ๋ฌธ์ด ์คํ๋๋ค. ์ด๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํ ๋ฐฉ๋ฒ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ด ํ๋ค.
~cpp Exec 'regsvr32.exe /u /s "$INSTDIR\COMDLL.dll"' waitloop: FindProcDLL::FindProc "regsvr32.exe" IntCmp $R0 0 waitdone Sleep 500 Goto waitloop waitdone: Delete "$INSTDIR\*.*" RMDir /r "$INSTDIR"
1.14. NSIS ์์ ActiveX Component ๋ฑ๋กํ๊ธฐ ¶
http://nsis.sourceforge.net/archive/viewpage.php?pageid=435
~cpp ;Inside the -Post section Exec 'regsvr32.exe /s "$INSTDIR\${NAME_OF_MY_DLL}"' ;And Inside the Uninstall Section Exec 'regsvr32.exe /s /u "$INSTDIR\${NAME_OF_MY_DLL}"'
1.15. NSIS ์์ uninstall.exe ๋ง๋ค๊ธฐ ¶
ํ ์ผ : 1. 'Uninstall' Section ์ ๋ง๋ ๋ค. 2. WriteInstaller ๋ฅผ ์ด์ฉํด์ค๋ค.
~cpp ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;Delete Files RMDir /r "$INSTDIR\*.*" ;Remove the installation directory RMDir "$INSTDIR" ;Delete Start Menu Shortcuts Delete "$DESKTOP\${MUI_PRODUCT}.lnk" Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*" RmDir "$SMPROGRAMS\${MUI_PRODUCT}" ;Delete Uninstaller And Unistall Registry Entries DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" SectionEnd Section "" . . . ;๋ ์ง์คํธ๋ฆฌ์ uninstall ํ๋ก๊ทธ๋จ ์ ํ ํด์ฃผ๋ ๋ถ๋ถ ;write uninstall information to the registry WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} (remove only)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninstall.exe" ; Uninstaller ๋ฅผ ๋ง๋๋ ๋ถ๋ถ WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd
2. Thread ¶
--fnwinter ํ ๊ณ ๋ง์์ฌ~ NSIS ์ฐ๋๊ฑฐ ์ ๋ฆฌ ํ ํ์๊ฐ ์์๋ ๋ฐ , PS ์ด๊ฑฐ ๋ง๊ณ ๋ INNO SETUP ์ด๋ผ๋ ํ๋ก๊ทธ๋จ์ด ์๊ฑฐ๋ ์. ๊ทธ๊ฒ๋ ๊ด์ฐฎ์๋ฐ, ํ๋ฒ ์จ๋ณด์ธ์~
๋ช๋ช ์ ํธ๋ฆฌํฐ ์ธ์คํจ๋ฌ์์ InnoSetup ์ฐ๋๊ฑฐ ์ข
์ข
๋ณด์์๋๋ฐ, ์ด๊ฒ๋ ๊ณต์ง์๊ตฐ..~ ๊ทธ๋์ ๋, http://isfd.kaju74.de/index.php?screenshots . ๋๋ฌด ๋ฝ๋๋๋๊ฑฐ ์๋?;; --1002