Silent database import installer: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
m (Updated author links.)
Line 1: Line 1:
{|align=right
|<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 25: Line 29:
   Delete '$EXEDIR\dbfile.sql.out'
   Delete '$EXEDIR\dbfile.sql.out'
SectionEnd</highlight-nsis>
SectionEnd</highlight-nsis>
Page author: [[User:sunjammer|sunjammer]]

Revision as of 03:03, 30 April 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