meaningoflights
Junior Member
Registered: Jan 2008
From:
|
quote: [ps.:Its a little bit urgent, bear with me please] [/B]
Here, here!! Its sad because there isn't a solid example out there..
Hi All,
I too am in an really bad position, marketing jumped the gun and now mgt are going to kick my arse if I cant write an installer before advertisements come out.. ! arrhhhh!
To test the installation, I am using a program called MojoPac.com on a external HDD, instead of VMware so I'm not sure if thats the root cause.
Problem
============
Run the following script, it doesn't install WindowsInstaller3.1, or .Net2.0 or SQLExpress.
Here is the log it produces:
Windows Version Analysis
Windows Version Determined
Windows Permission Analysis
Windows Permission Determined
Windows Installer Analysis
Windows Installer complete
.Net Analysis
SQL Server Analysis
Checking for existing SQL Server Instance
SQL Server Analysis Completed
Cause
===========
Maybe because MojoPac uses the host OS??? I cant install on my local PC cos I have SQL Ent edition, Win 3.1 and .Net 2 already installed.
Resolution
===========
I'm in process of getting VM ware setup on a scsi disk.
Please help me guys, thanks in advance, its heaps urgent!
Here are the references I found to make this script
http://nsis.sourceforge.net/NSISLog_plug-in
http://www.johnsadventures.com/arch...n_and_nsis.html
http://nsis.sourceforge.net/Install..._.NET_Framework
http://msdn2.microsoft.com/en-us/library/ms144259.aspx
http://blogs.msdn.com/sanchan/archi.../28/609097.aspx
http://forums.winamp.com/showthread...=run+sql+script
HEre's the script
!include WinVer.nsh
!include x64.nsh
XPStyle on
;funky little splash fade in effect!
Function .onInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "c:\myprog\logo.bmp"
#optional
#File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav"
;MessageBox MB_OK "Fading"
advsplash::show 4000 600 400 -1 $PLUGINSDIR\splash
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.
Delete $PLUGINSDIR\csplash.bmp
FunctionEnd
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "REPLACE_WITH_APP_NAME"
!define PRODUCT_VERSION "3.0"
!define PRODUCT_PUBLISHER "REPLACE_WITH_APP_NAME"
!define PRODUCT_WEB_SITE "http://www.REPLACE_WITH_YOUR_WEBSITE.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\REPLACE_WITH_APP_NAME CE.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define BRANDINGTEXT "REPLACE_WITH_APP_NAME Pty Ltd"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "..\License.rtf"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
;==================================
!macro CHECK_MIN_WIN_VER
var /GLOBAL WIN_VER_PASSED ;Win98?
var /GLOBAL WIN_SERVICEPACK_PASSED ;Win2kSP3
var /GLOBAL SQL_SERVICEPACK_PASSED ;Win2kSP4,Win2k3SP1,WinXPSP2
StrCpy $WIN_VER_PASSED “1?
StrCpy $WIN_SERVICEPACK_PASSED “1?
StrCpy $SQL_SERVICEPACK_PASSED “1?
ReadRegDWORD $R0 HKLM "System\CurrentControlSet\Control\Windows" "CSDVersion"
IntOp $R0 $R0 / 256 ;get service pack major version
nsislog::log "$INSTDIR\install.log" "Windows Version Analysis"
${If} ${IsWin2000}
${If} $R0 < “3? ; SP3
StrCpy $WIN_SERVICEPACK_PASSED “0?
${ElseIf} $R0 < “4? ; SP4
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${IsWin2003}
${If} $R0 < “1? ; SP1
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${IsWinXP}
${If} $R0 < “2? ; SP2
StrCpy $SQL_SERVICEPACK_PASSED “0?
${EndIf}
${ElseIf} ${AtMostWin2000}
StrCpy $WIN_VER_PASSED “0?
${EndIf}
nsislog::log "$INSTDIR\install.log" "Windows Version Determined"
!macroend
;==================================
!macro CHECK_ADMIN_RIGHTS
nsislog::log "$INSTDIR\install.log" "Windows Permission Analysis"
var /GLOBAL USER_ADMIN_PASSED ;Administrator
StrCpy $USER_ADMIN_PASSED “1?
userInfo::getAccountType
pop $0
${If} $0 != “Admin”
StrCpy $USER_ADMIN_PASSED “0?
${EndIf}
nsislog::log "$INSTDIR\install.log" "Windows Permission Determined"
!macroend
!macro MSI_INSTALL installer_path
nsislog::log "$INSTDIR\install.log" "Windows Installer Analysis"
;install msi version 3
GetDllVersion “$SYSDIR\msi.dll” $1 $2
IntOp $3 $1 / 0×00010000
IntOp $4 $1 & 0×0000FFFF
;IntOp $5 $2 / 0×00010000
;IntOp $6 $2 & 0×0000FFFF
StrCpy $0 ‘$3.$4'
IntCmp $0 “3.1? MSI_NO_INSTALL MSI_INSTALL
MSI_INSTALL: ;may be 3.0 or 3.1
SetDetailsPrint both
DetailPrint "Updating Windows Installer"
SetDetailsPrint none
ExecWait "${installer_path}\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart"
Sleep 2000 ; wait for a 2 seconds
;!insertmacro EXEC_SUBINSTALLER “Windows Installer 3.1? \
;‘”${installer_path}\WindowsInstaller-KB893803-v2-x86.exe” /quiet /norestart’
MSI_NO_INSTALL:
nsislog::log "$INSTDIR\install.log" "Windows Installer complete"
!macroend
;==================================
!macro NET_INSTALL installer_path
nsislog::log "$INSTDIR\install.log" ".Net Analysis"
;Check for framework 2.0————————————–
StrCpy $1 “0?
ReadRegDword $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
;MessageBox MB_OK $1
${If} $1 == “”
${If} ${RunningX64}
StrCpy $9 '"${installer_path}\netfx64.exe" /q /c:"install.exe /qb /noaspupgrade"'
${Else}
StrCpy $9 '"${installer_path}\dotnetfx2.0.exe" /q /c:"install.exe /qb /noaspupgrade"'
${EndIf}
SetDetailsPrint both
DetailPrint "Installing .Net Framework"
nsislog::log "$INSTDIR\install.log" "Installing .Net 2.0"
SetDetailsPrint none
;!insertmacro EXEC_SUBINSTALLER “Microsoft .Net Framework 2.0? $9
ExecWait $9
nsislog::log "$INSTDIR\install.log" "Installation of .Net 2.0 complete"
${EndIf}
!macroend
;==================================
!macro IS_SQL_INSTALLED instance_name
;original version returned a 1..
;!macro IS_SQL_INSTALLED instance_name ;return
nsislog::log "$INSTDIR\install.log" "SQL Server Analysis"
;original version returned a 1 or 0..
;strcpy ${return} “0?
StrCpy $0 “0?
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion\" "CurrentVersion"
${If} $0 != “” ;should = 9.if 2005 8. if 2000
!insertmacro SQL_INSTALL $INSTDIR "REPLACE_WITH_APP_NAME" "passw0rd" "$PROGRAMFILES\Microsoft SQL Server"
nsExec::ExecToLog '"$INSTDIR\CreateDatabase.cmd" "REPLACE_WITH_APP_NAME" "REPLACE_WITH_APP_NAME" "$INSTDIR\CreateDatabase.sql"'
;strcpy ${return} “1?
${EndIf}
!macroend
;==================================
!macro SQL_INSTALL installer_path instance_name password install_dir
nsislog::log "$INSTDIR\install.log" "Checking for existing SQL Server Instance"
;Check for existing instance
AddSize 358400
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\${instance_name}\MSSQLServer\CurrentVersion\" "CurrentVersion"
${If} $0 == “” ;should = 9.if 2005 8. if 2000
;!insertmacro EXEC_SUBINSTALLER “Microsoft SQL Server 2005 Express Edition” \
;‘”${installer_path}\SQLEXPR.exe” /settings ${settings_file} -q /norebootchk /qb reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=”${install_dir} SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0”‘
nsislog::log "$INSTDIR\install.log" "Installing SQL Server"
${If} ${IsWin2000}
ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\SYSTEM SQLACCOUNT=NT AUTHORITY\SYSTEM AGTACCOUNT=NT AUTHORITY\SYSTEM ASACCOUNT=NT AUTHORITY\SYSTEM RSACCOUNT=NT AUTHORITY\SYSTEM SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"
${Else}
ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLACCOUNT=NT AUTHORITY\NETWORK SERVICE AGTACCOUNT=NT AUTHORITY\NETWORK SERVICE ASACCOUNT=NT AUTHORITY\NETWORK SERVICE RSACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"
;troubleshooting change qn to qb
;ExecWait "${installer_path}\SQLEXPR.exe -q /norebootchk /qb reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name} SAPWD=${password} INSTALLSQLDIR=${install_dir} SQLBROWSERACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLACCOUNT=NT AUTHORITY\NETWORK SERVICE AGTACCOUNT=NT AUTHORITY\NETWORK SERVICE ASACCOUNT=NT AUTHORITY\NETWORK SERVICE RSACCOUNT=NT AUTHORITY\NETWORK SERVICE SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0 SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0 ADDUSERASADMIN=0"
${EndIf}
;ExecWait 'net start mssql$$$REPLACE_WITH_APP_NAME'
Sleep 10000 ; wait for a 10 seconds
${EndIf}
nsislog::log "$INSTDIR\install.log" "SQL Server Analysis Completed"
!macroend
;==================================
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\REPLACE_WITH_APP_NAME"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "..\REPLACE_WITH_APP_NAME CE.exe"
CreateDirectory "$SMPROGRAMS\REPLACE_WITH_APP_NAME"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\REPLACE_WITH_APP_NAME.lnk" "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
CreateShortCut "$DESKTOP\REPLACE_WITH_APP_NAME.lnk" "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
File "..\CSHttpClient.dll"
File "..\m4usms.dll"
File "..\TimeSync.exe"
;add the windows installer, .net 2.0, sql express exe's to the InstallDirectory
;The 64 or 32 bit switch
File "..\Components\dotnetfx2.0.exe"
;File "..\Components\netfx64.exe"
File "..\Components\WindowsInstaller-KB893803-v2-x86.exe"
File "..\Components\SQLEXPR.exe"
File "..\Components\CreateDatabase.cmd"
File "..\Components\CreateDatabase.sql"
!insertmacro CHECK_MIN_WIN_VER
!insertmacro CHECK_ADMIN_RIGHTS
!insertmacro MSI_INSTALL $INSTDIR
!insertmacro NET_INSTALL $INSTDIR
!insertmacro IS_SQL_INSTALLED "REPLACE_WITH_APP_NAME"
Delete "$INSTDIR\dotnetfx2.0.exe"
;File "..\Components\netfx64.exe"
Delete "$INSTDIR\WindowsInstaller-KB893803-v2-x86.exe"
Delete "$INSTDIR\SQLEXPR.exe"
Delete "$INSTDIR\CreateDatabase.cmd"
Delete "$INSTDIR\CreateDatabase.sql"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\REPLACE_WITH_APP_NAME\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\REPLACE_WITH_APP_NAME CE.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\REPLACE_WITH_APP_NAME CE.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\TimeSync.exe"
Delete "$INSTDIR\REPLACE_WITH_APP_NAME.exe"
RMDir "$INSTDIR\Styles"
RMDir "$SMPROGRAMS\REPLACE_WITH_APP_NAME"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
Quick Link | Report this post to a moderator | IP: Logged
|