suka project an) mungkin ini bisa membantu meringankan beban anda. Awalnya saya bingung
bagaimana membuat web installer dengan mengiclude xampp didalamnya, sehingga user yang tidak
paham teknis nya dapat dengan mudah menginstall aplikasi web di pc nya. Sebelum bertarung
siapkan dulu alat tempurnya:
1.NSIS (Nullsoft Scriptable Install System), ini program yang bertugas mambuat installer dari script
yang akan kita buat, (download).
2.Untuk saat ini saya menggunakan XAMPP 1.7.1
3.Ini contoh file nsi nya xampp 1.7.1 (download)
4.Script yang mau dipackage.
Oke Lanjut..
;---------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;--------------------------------
;Language Selection Dialog Settings
;--------------------------------
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "C:\xampdev\xampp\install\xampp-icon.ico"
!define MUI_UNICON "C:\xampdev\xampp\install\xampp-icon-uninstall.ico"
!define MUI_WELCOMEPAGE
!define MUI_CUSTOMPAGECOMMANDS
!define MUI_COMPONENTSPAGE
!define MUI_COMPONENTSPAGE_NODESC
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Components
; !insertmacro MUI_PAGE_COMPONENTS
; License page
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\license.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
Page custom CustomPageC
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" # first language is the default language
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Japanese"
;--------------------------------
;Reserve Files
;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
ReserveFile "xampp.ini"
ReserveFile "xampp-japanese.ini"
ReserveFile "xampp_home.ini"
ReserveFile "xampp_home-japanese.ini"
ReserveFile "xampp-german.ini"
ReserveFile "xampp_home-german.ini"
!insertmacro MUI_RESERVEFILE_LANGDLL
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
;--------------------------------
;Variables
Var INI_VALUE
Var INI_VALUE2
Var INI_VALUE3
Var INI_VALUE4
Var INI_VALUE5
Var INST_MESS
Var INST_MESS1
Var INST_MESS2
Var INST_MESS3
Var INST_MESS4
Var MESS_INSTDIR1
Var MESS_INSTDIR2
Var FTP_INSTALL
Var MAIL_INSTALL
Var DB_DEL
Var NO_DEL
InstallDir "c:\xampp"
Icon "C:\xampdev\xampp\install\xampp-icon.ico"
UninstallIcon "C:\xampdev\xampp\install\xampp-icon-uninstall.ico"
ShowInstDetails show
ShowUninstDetails show
SectionEnd
; ---------------------------------------
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp-japanese.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp_home.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp_home-japanese.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp-german.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "xampp_home-german.ini"
Function CustomPageC
ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $R1 "" 0 NTsrv
StrCmp $LANGUAGE "1041" japanesehome
StrCmp $LANGUAGE "1031" germanhome
!insertmacro MUI_HEADER_TEXT "XAMPP Options" "Install options on Windows Home systems."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp_home.ini"
Goto no_srv
germanhome:
!insertmacro MUI_HEADER_TEXT "XAMPP Optionen" "Konfiguration für Windows Home Systeme."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp_home-german.ini"
Goto no_srv
japanesehome:
!insertmacro MUI_HEADER_TEXT "XAMPP Options"
"Windows‚̃VƒXƒeƒ€‚̃IƒvƒVƒ‡ƒ“‚ðƒCƒ“ƒXƒg•[ƒ‹‚µ‚Ü‚·•B"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp_home-japanese.ini"
Goto no_srv
NTsrv:
StrCmp $LANGUAGE "1041" japanese
StrCmp $LANGUAGE "1031" german
!insertmacro MUI_HEADER_TEXT "XAMPP Options" "Install options on NT/2000/XP Professional
systems."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp.ini"
Goto no_srv
german:
!insertmacro MUI_HEADER_TEXT "XAMPP Optionen" "Konfiguration für NT/2000/XP Professional
Systeme."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp-german.ini"
Goto no_srv
japanese:
!insertmacro MUI_HEADER_TEXT "XAMPP Options" "Windows
NT/2000/XP/2003‚ɃVƒXƒeƒ€ƒIƒvƒVƒ‡ƒ“‚ðƒCƒ“ƒXƒg•[ƒ‹‚µ‚Ü‚·"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "xampp-japanese.ini"
no_srv:
FunctionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "SERVICES:"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function .onInstSuccess
; SERVICE INSTALLATION
ReadRegStr $4 HKLM "Software\xampp" "lang"
ReadRegStr $0 HKLM "Software\xampp" "services"
StrCmp $0 "0" no_srv
ExecWait 'cmd /C cd "$INSTDIR\install" & portcheck.bat' $7
ReadRegStr $1 HKLM "Software\xampp" "apacheservice"
StrCmp $1 "0" no_httpd
ReadINIStr $R0 "$INSTDIR\install\portcheck.ini" "Ports" "Port80"
StrCmp $R0 "BLOCKED" Port80Abort
ReadINIStr $R1 "$INSTDIR\install\portcheck.ini" "Ports" "Port443"
StrCmp $R1 "BLOCKED" Port80Abort
ExecWait 'cmd /C cd "$INSTDIR\apache\bin" & httpd.exe -k install & net start Apache2.2' $9
Goto no_httpd
Port80Abort:
StrCmp $4 "1031" german
StrCmp $4 "1041" japan
StrCpy $INST_MESS1 "Ports 80 or 443 (SSL) already in use! Installing Apache2.2 service failed!"
Goto mess1
japan:
StrCpy $INST_MESS1 "ƒ|•[ƒg 80 ‚Ü‚½‚Í 443 (SSL) ‚Í‚·‚Å‚É—˜—
p‚³‚ê‚Ä‚¢‚Ü‚·•BApache2.2‚ðƒT•[ƒrƒX‚Æ‚µ‚ăCƒ“ƒXƒg•[ƒ‹‚·‚é‚Ì‚ÉŽ¸”s‚µ‚Ü‚µ‚½•B"
Goto mess1
german:
StrCpy $INST_MESS1 "Ports 80 oder 443 (SSL) bereits in Nutzung! Apache2.2-Dienst konnte nicht
eingerichtet werden."
mess1:
WriteRegStr HKLM "Software\xampp" "apacheservice" "0"
MessageBox MB_OK "$INST_MESS1"
no_httpd:
ReadRegStr $2 HKLM "Software\xampp" "mysqlservice"
StrCmp $2 "0" no_mysql
ReadINIStr $R0 "$INSTDIR\install\portcheck.ini" "Ports" "Port3306"
StrCmp $R0 "BLOCKED" Port3306Abort
ExecWait 'cmd /C cd "$INSTDIR\mysql\bin" & mysqld.exe --install mysql --defaults-
file="$INSTDIR\mysql\bin\my.cnf" & net start mysql' $9
Goto no_mysql
Port3306Abort:
StrCmp $4 "1031" german1
StrCmp $4 "1041" japan1
StrCpy $INST_MESS2 "Port 3306 already in use! Installing MySQL service failed!"
Goto mess2
japan1:
StrCpy $INST_MESS2 "ƒ|•[ƒg3306 ‚Í‚·‚Å‚ÉŽg—
p‚³‚ê‚Ä‚¢‚Ü‚·•BMySQL‚ðƒT•[ƒrƒX‚Æ‚µ‚ăCƒ“ƒXƒg•[ƒ‹‚·‚é‚Ì‚ÉŽ¸”s‚µ‚Ü‚µ‚½•B"
Goto mess2
german1:
StrCpy $INST_MESS2 "Port 3306 bereits in Nutzung! MySQL-Dienst kann nicht eingerichtet werden."
mess2:
WriteRegStr HKLM "Software\xampp" "mysqlservice" "0"
MessageBox MB_OK "$INST_MESS2"
no_mysql:
ReadRegStr $3 HKLM "Software\xampp" "filezillaservice"
StrCmp $3 "0" no_ftp
ReadINIStr $R0 "$INSTDIR\install\portcheck.ini" "Ports" "Port21"
StrCmp $R0 "BLOCKED" Port21Abort
ExecWait '"$INSTDIR\FileZillaFTP\FileZillaServer.exe" /install' $9
ExecWait '"$INSTDIR\FileZillaFTP\FileZillaServer.exe" /start' $9
Goto no_ftp
Port21Abort:
StrCmp $4 "1031" german2
StrCmp $4 "1041" japan2
StrCpy $INST_MESS3 "Port 21 already in use! Installing FileZilla FTPD service failed!"
Goto mess3
japan2:
StrCpy $INST_MESS3 "ƒ|•[ƒg 21 ‚Í‚·‚Å‚ÉŽg—p‚³‚ê‚Ä‚¢‚Ü‚·•BFileZilla FTPD
‚ðƒT•[ƒrƒX‚Æ‚µ‚ăCƒ“ƒXƒg•[ƒ‹‚·‚邱‚Æ‚ÉŽ¸”s‚µ‚Ü‚µ‚½•B"
Goto mess3
german2:
StrCpy $INST_MESS3 "Port 21 bereits in Nutzung! FileZilla-Dienst kann nicht eingerichtet werden!"
mess3:
WriteRegStr HKLM "Software\xampp" "filezillaservice" "0"
MessageBox MB_OK "$INST_MESS3"
no_ftp:
StrCmp $4 "1031" german3
StrCmp $4 "1041" japan3
StrCpy $INST_MESS4 "Service installation finished! Hint: Use also the XAMPP Control Panel to
manage services."
Goto mess4
japan3:
StrCpy $INST_MESS4
"ƒT•[ƒrƒX‚Æ‚µ‚ăCƒ“ƒXƒg•[ƒ‹‚ɬŒ÷‚µ‚Ü‚µ‚½BXamppƒRƒ“ƒgƒ••[ƒ‹ƒpƒlƒ‹‚ðŠm”F‚µ•AƒT•[ƒrƒX‚ðŠÇ—
•‚µ‚Ä‚‚¾‚³‚¢•B"
Goto mess4
german3:
StrCpy $INST_MESS4 "Dienste-Installation abgeschlossen! Tipp: Dienste können Sie auch mit XAMPP
Control Panel verwalten."
mess4:
MessageBox MB_OK "$INST_MESS4"
no_srv:
; DESKTOP & START MENU SECTION
ReadRegStr $0 HKLM "Software\xampp" "desktopicon"
StrCmp $0 "0" no_icon
CreateShortCut "$DESKTOP\XAMPP Control Panel.lnk" "$INSTDIR\xampp-control.exe" ""
no_icon:
ReadRegStr $1 HKLM "Software\xampp" "programfiles"
StrCmp $1 "0" no_pfiles
CreateDirectory "$SMPROGRAMS\Apache Friends\XAMPP"
CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP" "" ""
CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP\XAMPP Control Panel.lnk"
"$INSTDIR\xampp-control.exe" "" "$INSTDIR\install\xampp.ico"
CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP\XAMPP httpdoc folder.lnk"
"$INSTDIR\htdocs" "" "$INSTDIR\install\folder.ico"
;CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP\Port check.lnk" "$INSTDIR\xampp-
portcheck.exe" "" "$INSTDIR\install\xamppcontrol.ico"
;CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP\PHP switch.lnk" "$INSTDIR\php-
switch.bat" "" "$INSTDIR\install\php.ico"
CreateShortCut "$SMPROGRAMS\Apache Friends\XAMPP\Uninstall.lnk" "$INSTDIR\uninstall.exe" ""
"$INSTDIR\install\xampp-icon-uninstall.ico"
no_pfiles:
StrCmp $4 "1041" japanese
Delete "$INSTDIR\xampp-control-jp.exe"
Rename "$INSTDIR\xampp-control-default.exe" "$INSTDIR\xampp-control.exe"
Goto xamppcontrol_out
japanese:
Delete "$INSTDIR\xampp-control-default.exe"
Rename "$INSTDIR\xampp-control-jp.exe" "$INSTDIR\xampp-control.exe"
xamppcontrol_out:
srv_Abort:
RMDir /r "$INSTDIR\anonymous"
RMDir /r "$INSTDIR\apache"
RMDir /r "$INSTDIR\cgi-bin"
RMDir /r "$INSTDIR\FileZillaFTP"
RMDir /r "$INSTDIR\install"
RMDir /r "$INSTDIR\licenses"
RMDir /r "$INSTDIR\MercuryMail"
RMDir /r "$INSTDIR\perl"
RMDir /r "$INSTDIR\php"
RMDir /r "$INSTDIR\phpMyAdmin"
RMDir /r "$INSTDIR\python"
RMDir /r "$INSTDIR\security"
RMDir /r "$INSTDIR\sendmail"
RMDir /r "$INSTDIR\tmp"
RMDir /r "$INSTDIR\tomcat"
RMDir /r "$INSTDIR\webalizer"
RMDir /r "$INSTDIR\webdav"
RMDir /r "$INSTDIR\nsis"
RMDir /r "$INSTDIR\contrib"
Delete "$INSTDIR\apache_start.bat"
Delete "$INSTDIR\apache_stop.bat"
Delete "$INSTDIR\filezilla_setup.bat"
Delete "$INSTDIR\filezilla_start.bat"
Delete "$INSTDIR\filezilla_stop.bat"
Delete "$INSTDIR\mercury_start.bat"
Delete "$INSTDIR\mercury_stop.bat"
Delete "$INSTDIR\mysql_start.bat"
Delete "$INSTDIR\mysql_stop.bat"
Delete "$INSTDIR\php-switch.bat"
Delete "$INSTDIR\readme_de.txt"
Delete "$INSTDIR\readme_en.txt"
Delete "$INSTDIR\service.exe"
Delete "$INSTDIR\setup_xampp.bat"
Delete "$INSTDIR\xampp_restart.exe"
Delete "$INSTDIR\xampp_start.exe"
Delete "$INSTDIR\xampp_stop.exe"
Delete "$INSTDIR\xampp-changes.txt"
Delete "$INSTDIR\xampp-portcheck.exe"
Delete "$INSTDIR\xampp-control.exe"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\javapath.ini"
Delete "$INSTDIR\readme-addon-perl.txt"
Delete "$INSTDIR\readme-addon-tomcat.txt"
Delete "$INSTDIR\tomcat_start.bat"
Delete "$INSTDIR\tomcat_stop.bat"
Delete "$INSTDIR\passwords.txt"
Delete "$INSTDIR\xampp_cli.exe"
Delete "$INSTDIR\xampp_chkdll.exe"
Delete "$INSTDIR\xampp_service_mercury.exe"
;Delete "$INSTDIR\msvcr71.dll"
NoXaDir:
ExitDel:
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd