Silent database import installer: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library)
 
m (Adding new author and category links.)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{PageAuthor|sunjammer}}
== Description ==
== Description ==
This was an installer I created to import the NSIS Archive database contents into my own local database. Anyone wanting to use the nsExec plugin should find this interesting:
This was an installer I created to import the NSIS Archive database contents into my own local database. Anyone wanting to use the nsExec plugin should find this interesting:
Line 26: Line 28:
SectionEnd</highlight-nsis>
SectionEnd</highlight-nsis>


Page author: sunjammer
[[Category:Code Examples]]

Latest revision as of 13:50, 24 June 2005

Author: sunjammer (talk, contrib)


Description

This was an installer I created to import the NSIS Archive database contents into my own local database. Anyone wanting to use the nsExec plugin should find this interesting:

The Script

OutFile importdb.exe
SilentInstall silent
Section
  nsExec::Exec 'plink -ssh -batch sunjammerx@nsis.sourceforge.net "~/dump_mysql > ~/dblocation"'
  nsExec::Exec 'pscp sunjammerx@nsis.sourceforge.net:~/dblocation .'
  FileOpen $0 '$EXEDIR\dblocation' 'r'
  FileRead $0 $1
  FileClose $0
  Delete '$EXEDIR\dblocation'
  StrCpy $1 $1 -1
  nsExec::Exec 'pscp sunjammerx@nsis.sourceforge.net:$1 "$EXEDIR\dbfile.sql"'
  nsExec::Exec 'plink -ssh -batch sunjammerx@nsis.sourceforge.net "rm -f dblocation $1"'
  Delete '$EXEDIR\dbfile.sql.out'
  nsExec::Exec 'bzip2 -d dbfile.sql'
  nsExec::Exec 'c:\mysql\bin\mysql -e "drop database nsisweb"'
  nsExec::Exec 'c:\mysql\bin\mysql -e "create database nsisweb"'
  nsExec::Exec 'cmd /C c:\mysql\bin\mysql -D nsisweb < dbfile.sql.out'
  nsExec::Exec 'c:\mysql\bin\mysql -D nsisweb -e "delete from nsisweb_sessions"'
  Delete 'e:\src\sunjammer.net\archive\engine\sessions\*.*';
  Delete '$EXEDIR\dbfile.sql'
  Delete '$EXEDIR\dbfile.sql.out'
SectionEnd