Skip to content

Instantly share code, notes, and snippets.

@Excedrin
Created March 24, 2013 21:10
Show Gist options
  • Save Excedrin/5233534 to your computer and use it in GitHub Desktop.
Save Excedrin/5233534 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
VERSION=$1
INSTALLER="OCTGN-Setup-${VERSION}.exe"
echo $VERSION $INSTALLER
if [ -z "$VERSION" ]; then
echo "$0 [version]"
echo "ex. $0 3.0.11.56"
exit 1
fi
# possibly cleanup old files
if [ -f $INSTALLER ]; then
rm $INSTALLER
fi
if [ -d extracted ]; then
rm -rf extracted
fi
# fetch fresh files
if [ ! -f ${INSTALLER}.orig ]; then
wget -O ${INSTALLER}.orig https://s3.amazonaws.com/octgn/releases/live/$INSTALLER
fi
if [ ! -f Install.nsi.orig ]; then
wget -O Install.nsi.orig https://raw.github.com/kellyelton/OCTGN/master/installer/Install.nsi
fi
if [ ! -f "DotNetVer.nsh" ]; then
wget https://raw.github.com/kellyelton/OCTGN/master/installer/DotNetVer.nsh
fi
if [ ! -f "GetDotNet.nsh" ]; then
wget https://raw.github.com/kellyelton/OCTGN/master/installer/GetDotNet.nsh
fi
if [ ! -f "GetVC.nsh" ]; then
wget https://raw.github.com/kellyelton/OCTGN/master/installer/GetVC.nsh
fi
# extract and move files inside the archive to be the way NSIS expects
7z x -oextracted ${INSTALLER}.orig
mv extracted/\$_OUTDIR/* extracted
mv extracted/\$PLUGINSDIR/* .
rm -rf extracted/\$_OUTDIR extracted/\$PLUGINSDIR
# patch the installer script
cp Install.nsi.orig Install.nsi
# install to $PROGRAMFILES (by default, selectable), as Administrator
# changing source path to the extracted files from the installer
patch -p0 <<'EOF'
--- Install-orig.nsi 2013-03-24 13:32:40.336375788 -0700
+++ Install.nsi 2013-03-23 18:23:27.049079558 -0700
@@ -22,18 +22,18 @@
!addplugindir .
; Installation directory
-InstallDir $DOCUMENTS\OCTGN\OCTGN
+InstallDir $PROGRAMFILES\OCTGN
; Create registry key for installation directory
; CHANGE THIS BACK AFTER THIS RELEASE
;InstallDirRegKey HKCU "Software\OCTGN" "Install_Dir"
; Request application privileges for Windows Vista
-;RequestExecutionLevel admin
+RequestExecutionLevel admin
;Pages
Page components
-;Page directory
+Page directory
Page instfiles
UninstPage uninstConfirm
@@ -63,7 +63,7 @@
WriteUninstaller "$INSTDIR\uninstall.exe"
; set folder and files to be included in setup
- File /r ..\octgnFX\OCTGN\bin\Release\*.*
+ File /r extracted\*.*
SectionEnd
Section "Start Menu Shortcuts"
EOF
# rebuild installer.exe
makensis Install.nsi
# cleanup
rm Install.nsi
rm -rf extracted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment