not so active anymore, yet still stuff and code that works in Perl, bash, sh, PLSQL, TSQL, NZPLSQL , XML, HTML, XSL, C#, Scala , Python, Teradata SQL, cmd batch scripts, Oracle , MySql some old Java stuff , Linux , DB2 , Sun Solaris , NSIS , VB 6.0 , some old Essbase VB API and plain English - all this in non-user friendly fashion combined with occasionally strong statements and opinions about IT best practices, Agile Development , energy ... dump end ...Wait - https://qto.fi
Search This Blog
2008-11-20
how-to create installer for asp.net site
; THIS INSTALLER INSTALLS THE APPLICATION LAYER OF THE SITENAME-Tool
;2008.11.19 Yordan Georgiev
;Purpose: This NSI script packs all the nessessary source files for running the SITENAME site
;--------------------------------
!include "FileFunc.nsh"
!include "MUI2.nsh"
!include "WordFunc.nsh"
!include "Time.nsh"
!include "Sections.nsh"
!insertmacro WordFind
!insertmacro MUI_LANGUAGE "English"
!define /date MYDATE "%Y%b%d.%H%M%S" ;not really needed but yet
!define SERVER $R0 ;Temp variable for holding the option chosen for server
!define CHOSENSERVER $R9 ;Temp variable for holding the NOTE :
LangString MUI_TEXT_INSTALLING_TITLE ${LANG_ENGLISH} "SITENAME SITE Installation"
LangString MUI_TEXT_INSTALLING_SUBTITLE ${LANG_ENGLISH} "Installing SITENAME SITE"
LangString MUI_TEXT_FINISH_TITLE ${LANG_ENGLISH} "SITENAME SITE Ready"
LangString MUI_TEXT_FINISH_SUBTITLE ${LANG_ENGLISH} "SITENAME SITE Installed"
LangString MUI_TEXT_ABORT_TITLE ${LANG_ENGLISH} "Abort SITENAME SITE Installation ?!"
LangString MUI_TEXT_ABORT_SUBTITLE ${LANG_ENGLISH} "Abort SITENAME SITE Installation ?!"
XPStyle On
AutoCloseWindow false
ShowInstDetails show
;Things that need to be extracted on startup (keep these lines before any File command!)
;Only useful for BZIP2 compression
;Use ReserveFile for your own InstallOptions INI files too!
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "SITENAMEsite_conf.ini"
Name "SITENAME-Tool Application Layer installer for Any Environment"
; THIS IS THE SETUP.EXE FILE PRODUCED BY THE SCRIPT
OutFile "G:\Setup_SITENAME.exe"
InstallDir "D:\SITENAME" ; CHANGE THIS PATH AS THE DEFAULT ONE TO PROVIDE THE USER TO INSTALL
;Prompt for Vista Admin Rights
RequestExecutionLevel admin
;--------------------------------
;Pages
;Order of pages
Page custom SetCustom ValidateCustom "Choose the right server to install t" ;Custom page.
Page directory
Page instfiles
Page custom CustomPage
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and copy_'
Var "Info"
Var "InfoOK"
;--------------------------------
; Installer
;**************************************************************************************************
Section "Components"
;Get Install Options dialog user input
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 2" "State"
DetailPrint "Install option=${SERVER}"
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 3" "State"
DetailPrint "Install option=${SERVER}"
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 4" "State"
DetailPrint "Install option=${SERVER}"
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 5" "Text"
DetailPrint "Info=${SERVER}"
DetailPrint "CHOSENSERVER=${CHOSENSERVER}"
SectionEnd
;**************************************************************************************************
Section
;CREATE BACKUP OF THE EXISTING SITE IF ANY
${time::GetLocalTime} $R0
${time::TimeString} "$R0" $0 $1 $2 $3 $4 $5
/*
0 - date
1 - month
2 - year
3 - hour
4 - minute
5 - seconds
*/
;CREATE THE BACKUP DIRECTORY BASED ON THE TIMESTAMP
CreateDirectory "$INSTDIR.$2$1$0.$3$4$5"
Rename $INSTDIR "$INSTDIR.$2$1$0.$3$4$5"
;CopyFiles "$INSTDIR\*.*" "$INSTDIR.$2$1$0.$3$4$5" 0
SectionEnd
;**************************************************************************************************
;**************************************************************************************************
Section "Unpacking" SecDummy
; MessageBox MB_OK "The installation directory you choosed is $INSTDIR . Press OK to proceed"
CreateDirectory $INSTDIR
SetOutPath $INSTDIR
; HERE UNZIP ACTUALLY THE FILES
; DO NOT INCLUDE FILES CONTAINING "test" *.MDF *.ldf
File /r /x *.MDF /x *.exclude /x *.ldf /x *.pl /x *.nsis /x *.cmd *.cs *.aspx *.aspx.cs *.dll *.css *.resx *.config *.dll *.pdb *.js *.bmp *.gif *.jpg *.png *.master *.master.cs
SectionEnd
;**************************************************************************************************
;**************************************************************************************************
Section "Unpacking bin folder" SecUnpackBin
; HERE WE UNZIP THE FILES FOR THE BIN DIRECTOR
;CreateDirectory "D:\bin\SITENAME_TEST\"
;SetOutPath "D:\bin\SITENAME_TEST\"
;File /r *.cmd *.dll *.exe
;DELETE ALL EXE FILES
SectionEnd
;**************************************************************************************************
;**************************************************************************************************
Section
;FIND OUT WHICH APPLICATION ARE WE INSTALLING
;NOTE THIS ASSUMES INSTALLATION IN THE D:\ DRIVE
;SO LETS ASSUME INSTALLING D:\SITENAME
StrCpy $R0 "$INSTDIR"
${WordFind} $R0 "\" "-02" $R1
DetailPrint "I saw $R1"
WriteUninstaller "$R1\Uninstall_SITENAMESITE.exe"
SectionEnd
;$R1=D:
Section
StrCpy $R2 "$INSTDIR"
${WordFind} $R2 "\" "-01" $R3
DetailPrint "I saw $R3"
SectionEnd
;$R3=SITENAME
Section "SETUPCONNECTION ENVIRONMENT"
;INFORM THE STARTING OF THE COPY
DetailPrint "Setting up the resource file for the server "
;COPY THE SERVER CONFIG FILES FOR THIS APPLICATION
;COPY THE SERVER FILE AS FROM SERVER.FILE TO FILE
;Delete the Web.config file from the development
Delete "$INSTDIR\Web.config"
;server = heitv156lab.devlab.nokia.com
DetailPrint "I saw ${CHOSENSERVER} Followed by space"
CopyFiles "$INSTDIR\INSTALL\${CHOSENSERVER}.$R3.Web.config" "$INSTDIR\Web.config"
;${CHOSENSERVER}
;COPY THE App_GlobalResources folder
;Delete the App_GlobalResources from the development
Delete "$INSTDIR\App_GlobalResources\*.*"
;Copy the server.app.App_GlobalResources to it's correct place
CopyFiles "$INSTDIR\INSTALL\${CHOSENSERVER}.$R3.App_GlobalResources\*.*" "$INSTDIR\App_GlobalResources\"
;NOW DELETE THE INSTALL DIRECTORY CONTAINING THE DIFFERENT SETUP FILES
; Var /GLOBAL "AnotherVar"
; StrCpy $AnotherVar "test"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
StrCpy $Info "SITENAME SITE uninstalled successfully."
Delete "$R1\Uninst.exe"
RmDir $INSTDIR
SectionEnd
Function un.OnUninstSuccess
HideWindow
MessageBox MB_OK "$Info"
FunctionEnd
Function OnInstSuccess
StrCpy $Info "SITENAME SITE installed successfully !!!"
HideWindow
MessageBox MB_OK "$InfoOK"
FunctionEnd
;------------------------------------------------------------------------------------
Function CustomPage
SectionGetFlags ${Section_Name} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show
Abort
show:
FunctionEnd
Function .onInit
;Extract InstallOptions files
;$PLUGINSDIR will automatically be removed when the installer closes
InitPluginsDir
File /oname=$PLUGINSDIR\SITENAMEsite_conf.ini "SITENAMEsite_conf.ini"
FunctionEnd
Function SetCustom
;Display the InstallOptions dialog
Push ${SERVER}
InstallOptions::dialog "$PLUGINSDIR\SITENAMEsite_conf.ini"
Pop ${SERVER}
Pop ${SERVER}
FunctionEnd
Function ValidateCustom
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 2" "State"
ReadINIStr ${CHOSENSERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 2" "Text"
StrCmp ${SERVER} 1 done
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 3" "State"
ReadINIStr ${CHOSENSERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 3" "Text"
StrCmp ${SERVER} 1 done
ReadINIStr ${SERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 4" "State"
ReadINIStr ${CHOSENSERVER} "$PLUGINSDIR\SITENAMEsite_conf.ini" "Field 4" "Text"
StrCmp ${SERVER} 1 done
MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
Abort
done:
FunctionEnd
Function .onInstSuccess
MessageBox MB_OK "SITENAME site installed correctly"
FunctionEnd
Function un.onUserAbort
MessageBox MB_YESNO "Abort uninstall?" IDYES NoCancelAbort
Abort ; causes uninstaller to not quit.
NoCancelAbort:
FunctionEnd
Function un.onInit
MessageBox MB_YESNO "This will uninstall. Continue?" IDYES NoAbort
Abort ; causes uninstaller to quit.
NoAbort:
FunctionEnd
1 comment:
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!
About Me
Labels
Blog Archive
- November (1)
- December (1)
- November (1)
- January (3)
- December (1)
- November (2)
- August (7)
- July (1)
- May (3)
- April (1)
- March (5)
- February (1)
- January (1)
- December (7)
- November (1)
- October (2)
- September (3)
- August (4)
- July (1)
- June (1)
- May (7)
- April (5)
- March (3)
- January (2)
- December (3)
- November (1)
- October (5)
- September (3)
- July (3)
- April (1)
- March (4)
- February (4)
- November (2)
- September (5)
- August (3)
- June (3)
- May (6)
- April (8)
- March (1)
- February (4)
- January (1)
- December (5)
- November (4)
- October (7)
- September (3)
- August (3)
- May (1)
- April (2)
- March (1)
- December (5)
- November (5)
- October (4)
- September (4)
- August (1)
- July (13)
- June (1)
- May (13)
- April (14)
- March (10)
- February (7)
- January (3)
- December (4)
- November (3)
- October (8)
- September (5)
- August (9)
- July (4)
- May (10)
- April (6)
- March (11)
- February (4)
- January (13)
- December (19)
- November (15)
- October (32)
- September (16)
- August (26)
- July (37)
- June (34)
- May (26)
- April (32)
- March (26)
- February (8)
- December (2)
- November (5)
- October (10)
- September (17)
- August (6)
- July (15)
- June (24)
- May (26)
- April (29)
- March (18)
- February (26)
- January (16)
- December (7)
- November (16)
- October (4)
- September (10)
- June (3)
- May (21)
- April (4)
- March (13)
- February (3)
- January (14)
- December (12)
- November (1)
- October (3)
- September (6)
- August (2)
- July (4)
- June (4)
- May (3)
- April (11)
- March (11)
- February (16)
- January (5)
- December (22)
- November (23)
- October (5)
- July (14)
Translate with Google Translate
My Blog List
-
Getting the Current TabItem when the Tab is not selected in WPF - [image: Banner] This is a quick reminder to self on how to retrieve a TabItem from a WPF TabControl *when the tab is not currently selected* because I ru...2 weeks ago
-
Major solar energy project operational in western Michigan - TV reports 11,000 solar panels are installed on a 17-acre plot of land just south of Grand Valley State University's main campus in Allendale. Consumers ...8 years ago
-
-
-
Hello Yordan
ReplyDeleteNice blog.
I need someone to write a custom script for a installer. Do youwrite the custom script ? How much do you charge?
Here is what I need
1) Create a installer with a folder structure
2) Add custom logo, license agreemnt
3) Add license key
2) Install .NET 3.5 SP1 if not available
3) Create a virtual directory in IIS
4) Give permission to certain predefine users on couple of folders
5) Create a shortcut on the desktop
6) Option to overwrite or not overwrite certain files or folders( for
applying patches etc and not to overwrite the customized folders)
Thanks
Sheetal
sheetalkjain at gmail