Silent database import installer: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Adding new author and category links.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|sunjammer}}
|<small>Author: [[{{ns:2}}:sunjammer|sunjammer]] ([[{{ns:3}}:sunjammer|talk]], [[{{ns:-1}}:Contributions/sunjammer|contrib]])</small>
 
|}
<br style="clear:both;">
== 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 29: Line 27:
   Delete '$EXEDIR\dbfile.sql.out'
   Delete '$EXEDIR\dbfile.sql.out'
SectionEnd</highlight-nsis>
SectionEnd</highlight-nsis>
[[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