<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: glossword code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 07 Sep 2008 08:53:59 GMT</pubDate>
    <description>DZone Snippets: glossword code</description>
    <item>
      <title>Glossword WAMP source code (NSIS)</title>
      <link>http://snippets.dzone.com/posts/show/4135</link>
      <description>// NSIS (http://nsis.sourceforge.net/)&lt;br /&gt;// Glossword WAMP (http://sourceforge.net/projects/glossword/)&lt;br /&gt;// Apache, MySQL and PHP are stored in archive usr.exe, directory /usr/local&lt;br /&gt;// phpMyAdmin is in archive htdocs.exe, directory /htdocs/phpmyadmin&lt;br /&gt;// Additionaly you need files with phrases: English.nsh and Russian.nsh&lt;br /&gt;// ------------------------------------------&lt;br /&gt;// English.nsh:&lt;br /&gt;// LangString SECT_01 ${LANG_ENGLISH} "Glossword ${PRODUCT_VERSION}"&lt;br /&gt;// LangString TXT_02 ${LANG_ENGLISH} "Thank you for installing Glossword.\r\nFor news and updates go to http://sourceforge.net/projects/glossword/"&lt;br /&gt;// LangString DESC_SecGw ${LANG_ENGLISH} "Glossword program core files."&lt;br /&gt;// ------------------------------------------&lt;br /&gt;// install.bat&lt;br /&gt;// @echo on&lt;br /&gt;// cls&lt;br /&gt;// SET ipath=%1&lt;br /&gt;// cd "%ipath%/usr/local/apache2/bin"&lt;br /&gt;// httpd.exe -k install -n Apache2_GW&lt;br /&gt;// httpd.exe -k start -n Apache2_GW&lt;br /&gt;// cd "%ipath%/usr/local/mysql5/bin"&lt;br /&gt;// mysqld-nt.exe --install MySQL50_GW --defaults-file="%ipath%/usr/local/mysql5/bin/my-custom.cnf"&lt;br /&gt;// net start MySQL50_GW&lt;br /&gt;// ------------------------------------------&lt;br /&gt;// uninstall.bat&lt;br /&gt;// @echo off&lt;br /&gt;// cls&lt;br /&gt;// SET ipath=%1&lt;br /&gt;// cd "%ipath%/usr/local/apache2/bin"&lt;br /&gt;// httpd.exe -k stop -n Apache2_GW&lt;br /&gt;// httpd.exe -k uninstall -n Apache2_GW&lt;br /&gt;// net stop MySQL50_GW&lt;br /&gt;// cd "%ipath%/usr/local/mysql5/bin"&lt;br /&gt;// mysqld-nt.exe --remove MySQL50_GW&lt;br /&gt;// ------------------------------------------&lt;br /&gt;// unpack.bat&lt;br /&gt;// @echo off&lt;br /&gt;// usr.exe -y&lt;br /&gt;// htdocs.exe -y&lt;br /&gt;// del usr.exe&lt;br /&gt;// del htdocs.exe&lt;br /&gt;// del unpack.bat&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now you can create your own WAMP package.&lt;br /&gt;&lt;br /&gt;; Glossword Desktop edition: Apache, MySQL, PHP&lt;br /&gt;; Written by Dmitry Shilnikov (c) 2002-2007&lt;br /&gt;; tty01@rambler.ru&lt;br /&gt;;--------------------------------&lt;br /&gt;;Include Modern UI&lt;br /&gt;&lt;br /&gt;  	!include "MUI.nsh"&lt;br /&gt;&lt;br /&gt;; replace in file with count of changes&lt;br /&gt;	!include "FileFunc.nsh"&lt;br /&gt;	&lt;br /&gt;;--------------------------------&lt;br /&gt;;Custom variables&lt;br /&gt;&lt;br /&gt;	!define PRODUCT_NAME "Apache, MySQL, PHP"&lt;br /&gt;	!define PRODUCT_VERSION "Apache/2.2.4, MySQL 5.0.41-community-nt, PHP 5.2.3 for Windows"&lt;br /&gt;	!define DIR_SRC "."&lt;br /&gt;	!define THIS_DIR_INSTALLTO "Glossword-WAMP"&lt;br /&gt;&lt;br /&gt;;--------------------------------&lt;br /&gt;;General&lt;br /&gt;&lt;br /&gt;	Name "${PRODUCT_NAME}"&lt;br /&gt;	OutFile "glossword-wamp.exe"&lt;br /&gt;&lt;br /&gt;	;Folder selection page&lt;br /&gt;	InstallDir "$PROGRAMFILES\Glossword-WAMP"&lt;br /&gt;&lt;br /&gt;;--------------------------------&lt;br /&gt;;Interface Settings&lt;br /&gt;&lt;br /&gt;	!define MUI_ABORTWARNING&lt;br /&gt;	!define MUI_UI ${NSISDIR}\Contrib\UIs\modern.exe&lt;br /&gt;	!define MUI_ICON ${DIR_SRC}\install\gw_new.ico&lt;br /&gt;	!define MUI_UNICON ${DIR_SRC}\install\gw_remove.ico&lt;br /&gt;	!define MUI_FINISHPAGE_TEXT $(TXT_02)&lt;br /&gt;	&lt;br /&gt;;--------------------------------&lt;br /&gt;;Pages&lt;br /&gt;&lt;br /&gt;!insertmacro MUI_PAGE_WELCOME&lt;br /&gt;!insertmacro MUI_PAGE_DIRECTORY&lt;br /&gt;!insertmacro MUI_PAGE_INSTFILES&lt;br /&gt;!insertmacro MUI_PAGE_FINISH&lt;br /&gt;&lt;br /&gt;;Uninstaller pages&lt;br /&gt;!insertmacro MUI_UNPAGE_CONFIRM&lt;br /&gt;!insertmacro MUI_UNPAGE_INSTFILES&lt;br /&gt;&lt;br /&gt;;--------------------------------&lt;br /&gt;;Languages&lt;br /&gt;&lt;br /&gt;!insertmacro MUI_LANGUAGE "English"&lt;br /&gt;!insertmacro MUI_LANGUAGE "Russian"&lt;br /&gt;&lt;br /&gt;;--------------------------------&lt;br /&gt;;Installer Sections&lt;br /&gt;&lt;br /&gt;Section "$(SECT_01)" SecGw&lt;br /&gt;&lt;br /&gt;	SetDetailsPrint textonly&lt;br /&gt;	DetailPrint "Installing server files..."&lt;br /&gt;    SetOverwrite ifnewer&lt;br /&gt;	&lt;br /&gt;	DetailPrint "htdocs..."&lt;br /&gt;	CreateDirectory "$INSTDIR\htdocs"&lt;br /&gt;	CreateDirectory "$INSTDIR\htdocs\glossword"&lt;br /&gt;&lt;br /&gt;	SetOutPath "$INSTDIR"&lt;br /&gt;	File "usr.exe"&lt;br /&gt;	File "htdocs.exe"&lt;br /&gt;	File "unpack.bat"&lt;br /&gt;	File "install.bat"&lt;br /&gt;	File "uninstall.bat"&lt;br /&gt;	File "localhost.url"&lt;br /&gt;	File "phpinfo.url"&lt;br /&gt;    File "phpmyadmin.url"&lt;br /&gt;    File "news.url"&lt;br /&gt;    File "glossword-wamp224_5041_523.txt"&lt;br /&gt;	&lt;br /&gt;	ExecWait '"unpack.bat"'&lt;br /&gt;&lt;br /&gt;	SetOutPath "$INSTDIR"&lt;br /&gt;	; change configuraiton files&lt;br /&gt;	DetailPrint "httpd.conf..."&lt;br /&gt;	ClearErrors&lt;br /&gt;	FileOpen $0 "$INSTDIR\usr\local\apache2\conf\httpd.conf" "r"&lt;br /&gt;	GetTempFileName $R0&lt;br /&gt;	FileOpen $1 $R0 "w"&lt;br /&gt;	loop1:&lt;br /&gt;		FileRead $0 $2&lt;br /&gt;		IfErrors done1&lt;br /&gt;		StrCmp $2 "# Created by install$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "# Created by glossword-amp.exe$\r$\n"&lt;br /&gt;		StrCmp $2 "DocumentRoot $\"E:/usr/httpdocs/svn/Glossword Desktop/htdocs$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "DocumentRoot $\"$INSTDIR\htdocs$\"$\r$\n"&lt;br /&gt;		StrCmp $2 "ServerRoot $\"E:/usr/httpdocs/svn/Glossword Desktop/usr/local/apache2$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "ServerRoot $\"$INSTDIR\usr\local\apache2$\"$\r$\n"&lt;br /&gt;		FileWrite $1 $2&lt;br /&gt;	Goto loop1&lt;br /&gt;	done1:&lt;br /&gt;		FileClose $0&lt;br /&gt;		FileClose $1&lt;br /&gt;		Delete "$INSTDIR\usr\local\apache2\conf\httpd.conf"&lt;br /&gt;		CopyFiles /SILENT $R0 "$INSTDIR\usr\local\apache2\conf\httpd.conf"&lt;br /&gt;		Delete $R0&lt;br /&gt;	;		&lt;br /&gt;	DetailPrint "my-custom.cnf..."&lt;br /&gt;	ClearErrors&lt;br /&gt;	FileOpen $0 "$INSTDIR\usr\local\mysql5\bin\my-custom.cnf" "r"&lt;br /&gt;	GetTempFileName $R0&lt;br /&gt;	FileOpen $1 $R0 "w"&lt;br /&gt;	loop2:&lt;br /&gt;		FileRead $0 $2&lt;br /&gt;		IfErrors done2&lt;br /&gt;		StrCmp $2 "basedir=$\"../mysql5/$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "basedir=$\"$INSTDIR\usr\local\mysql5\$\"$\r$\n"&lt;br /&gt;		StrCmp $2 "datadir=$\"../mysql5/data/$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "datadir=$\"$INSTDIR\usr\local\mysql5\data\$\"$\r$\n"&lt;br /&gt;		FileWrite $1 $2&lt;br /&gt;	Goto loop2&lt;br /&gt;	done2:&lt;br /&gt;		FileClose $0&lt;br /&gt;		FileClose $1&lt;br /&gt;		Delete "$INSTDIR\usr\local\mysql5\bin\my-custom.cnf"&lt;br /&gt;		CopyFiles /SILENT $R0 "$INSTDIR\usr\local\mysql5\bin\my-custom.cnf"&lt;br /&gt;		Delete $R0&lt;br /&gt;	;&lt;br /&gt;	DetailPrint "php.ini..."&lt;br /&gt;	ClearErrors&lt;br /&gt;	FileOpen $0 "$INSTDIR\usr\local\php5\php.ini" "r"&lt;br /&gt;	GetTempFileName $R0&lt;br /&gt;	FileOpen $1 $R0 "w"&lt;br /&gt;	loop5:&lt;br /&gt;		FileRead $0 $2&lt;br /&gt;		IfErrors done5&lt;br /&gt;		StrCmp $2 "extension_dir = $\"../../php5/ext$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "extension_dir = $\"$INSTDIR\usr\local\php5\ext$\"$\r$\n"&lt;br /&gt;		StrCmp $2 "session.save_path = $\"c:/temp$\"$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "session.save_path = $\"$TEMP$\"$\r$\n"&lt;br /&gt;		FileWrite $1 $2&lt;br /&gt;	Goto loop5&lt;br /&gt;	done5:&lt;br /&gt;		FileClose $0&lt;br /&gt;		FileClose $1&lt;br /&gt;		Delete "$INSTDIR\usr\local\php5\php.ini"&lt;br /&gt;		CopyFiles /SILENT $R0 "$INSTDIR\usr\local\php5\php.ini"&lt;br /&gt;		Delete $R0&lt;br /&gt;	;	&lt;br /&gt;	DetailPrint "install.bat..."&lt;br /&gt;	ClearErrors&lt;br /&gt;	FileOpen $0 "$INSTDIR\install.bat" "r"&lt;br /&gt;	GetTempFileName $R0&lt;br /&gt;	FileOpen $1 $R0 "w"&lt;br /&gt;	loop3:&lt;br /&gt;		FileRead $0 $2&lt;br /&gt;		IfErrors done3&lt;br /&gt;		StrCmp $2 "set ipath=%1$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "set ipath=$INSTDIR$\r$\n"&lt;br /&gt;		FileWrite $1 $2&lt;br /&gt;	Goto loop3&lt;br /&gt;	done3:&lt;br /&gt;		FileClose $0&lt;br /&gt;		FileClose $1&lt;br /&gt;		Delete "$INSTDIR\install.bat"&lt;br /&gt;		CopyFiles /SILENT $R0 "$INSTDIR\install.bat"&lt;br /&gt;		Delete $R0&lt;br /&gt;	;&lt;br /&gt;	DetailPrint "uninstall.bat..."&lt;br /&gt;	ClearErrors&lt;br /&gt;	FileOpen $0 "$INSTDIR\uninstall.bat" "r"&lt;br /&gt;	GetTempFileName $R0&lt;br /&gt;	FileOpen $1 $R0 "w"&lt;br /&gt;	loop4:&lt;br /&gt;		FileRead $0 $2&lt;br /&gt;		IfErrors done4&lt;br /&gt;		StrCmp $2 "set ipath=%1$\r$\n" 0 +2&lt;br /&gt;		StrCpy $2 "set ipath=$INSTDIR$\r$\n"&lt;br /&gt;		FileWrite $1 $2&lt;br /&gt;	Goto loop4&lt;br /&gt;	done4:&lt;br /&gt;		FileClose $0&lt;br /&gt;		FileClose $1&lt;br /&gt;		Delete "$INSTDIR\uninstall.bat"&lt;br /&gt;		CopyFiles /SILENT $R0 "$INSTDIR\uninstall.bat"&lt;br /&gt;		Delete $R0&lt;br /&gt;	ExecWait '"install.bat"'&lt;br /&gt;	;nsExec::ExecToStack '"install.bat"'&lt;br /&gt;&lt;br /&gt;	SetOverwrite off&lt;br /&gt;&lt;br /&gt;	CreateDirectory "$SMPROGRAMS\${THIS_DIR_INSTALLTO}"&lt;br /&gt;	CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Glossword at localhost.lnk" "$INSTDIR\localhost.url"&lt;br /&gt;	CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Glossword development news.lnk" "$INSTDIR\news.url"&lt;br /&gt;	CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\phpinfo().lnk" "$INSTDIR\phpinfo.url"&lt;br /&gt;    CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\phpMyAdmin.lnk" "$INSTDIR\phpmyadmin.url"&lt;br /&gt;	CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Apache Monitor.lnk" "$INSTDIR\usr\local\apache2\bin\ApacheMonitor.exe"&lt;br /&gt;	CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Remove Glossword WAMP.lnk" "$INSTDIR\uninstall.exe"&lt;br /&gt;    CreateShortCut "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Release notes.lnk" "$INSTDIR\glossword-wamp224_5041_523.txt"&lt;br /&gt;&lt;br /&gt;  	WriteUninstaller "$INSTDIR\uninstall.exe"&lt;br /&gt;SectionEnd&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;;--------------------------------&lt;br /&gt;;Descriptions&lt;br /&gt;&lt;br /&gt;!include "${DIR_SRC}\install\English.nsh"&lt;br /&gt;!include "${DIR_SRC}\install\Russian.nsh"&lt;br /&gt;&lt;br /&gt;!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN&lt;br /&gt;	!insertmacro MUI_DESCRIPTION_TEXT ${SecGw} $(DESC_SecGw)&lt;br /&gt;!insertmacro MUI_FUNCTION_DESCRIPTION_END&lt;br /&gt; &lt;br /&gt;;--------------------------------&lt;br /&gt;; Functions&lt;br /&gt;&lt;br /&gt;Function .onInit&lt;br /&gt;	!insertmacro MUI_LANGDLL_DISPLAY&lt;br /&gt;FunctionEnd&lt;br /&gt;&lt;br /&gt;;--------------------------------&lt;br /&gt;;Uninstaller Section&lt;br /&gt;&lt;br /&gt;Section Uninstall&lt;br /&gt;	&lt;br /&gt;	SetOutPath "$INSTDIR"&lt;br /&gt;	ExecWait '"uninstall.bat"'&lt;br /&gt;&lt;br /&gt;	SetShellVarContext current&lt;br /&gt;	Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Remove Glossword WAMP.lnk"&lt;br /&gt;	Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Apache Monitor.lnk"&lt;br /&gt;	Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Glossword at localhost.lnk"&lt;br /&gt;	Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Glossword development news.lnk"&lt;br /&gt;	Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\phpinfo().lnk"&lt;br /&gt;    Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\phpMyAdmin.lnk"&lt;br /&gt;    Delete "$SMPROGRAMS\${THIS_DIR_INSTALLTO}\Release Notes.lnk"&lt;br /&gt;	RMDir /r "$SMPROGRAMS\${THIS_DIR_INSTALLTO}"&lt;br /&gt;	RMDir /r "$INSTDIR\usr\local\apache2"&lt;br /&gt;	RMDir /r "$INSTDIR\usr\local\php5"&lt;br /&gt;	RMDir /r "$INSTDIR\usr\local\mysql5\bin"&lt;br /&gt;	RMDir /r "$INSTDIR\usr\local\mysql5\share"&lt;br /&gt;	RMDir /r "$INSTDIR\htdocs\phpmyadmin"&lt;br /&gt;	Delete "$INSTDIR\install.bat"&lt;br /&gt;	Delete "$INSTDIR\uninstall.bat"&lt;br /&gt;	Delete "$INSTDIR\glossword-wamp224_5041_523.txt"&lt;br /&gt;	Delete "$INSTDIR\localhost.url"&lt;br /&gt;	Delete "$INSTDIR\phpinfo.url"&lt;br /&gt;	Delete "$INSTDIR\phpmyadmin.url"&lt;br /&gt;&lt;br /&gt; 	;RMDir /r "$INSTDIR"&lt;br /&gt;	SetAutoClose true&lt;br /&gt;  &lt;br /&gt;SectionEnd&lt;br /&gt;</description>
      <pubDate>Wed, 13 Jun 2007 09:12:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4135</guid>
      <author>Dmitry-Sh (Dmitry Shilnikov)</author>
    </item>
  </channel>
</rss>
