Skip to content

Commit

Permalink
check for windows version (32 or 64 Bits)
Browse files Browse the repository at this point in the history
Starting the wrong installer will create a warning and
abort the installation.

Fixes #87: Winbareos installer 64 bit does not check, if windows is 64 bit

This patch should also set the right installation dir
for the different windows Versions.
( Program Files / Program Files (x86)

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
pstorz authored and Marco van Wieringen committed May 5, 2013
1 parent fcf725c commit 3f14776
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions platforms/win32/winbareos-nsi.spec
Expand Up @@ -89,8 +89,8 @@ cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 %_sourcedir/LICENSE $RPM_BUILD_ROOT/rele
cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 %_sourcedir/LICENSE $RPM_BUILD_ROOT/release64


makensis -DPRODUCT_VERSION=%version-%release $RPM_BUILD_ROOT/release32/winbareos.nsi
makensis -DPRODUCT_VERSION=%version-%release $RPM_BUILD_ROOT/release64/winbareos.nsi
makensis -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=32 $RPM_BUILD_ROOT/release32/winbareos.nsi
makensis -DPRODUCT_VERSION=%version-%release -DBIT_WIDTH=64 $RPM_BUILD_ROOT/release64/winbareos.nsi

%install
mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
Expand Down
21 changes: 19 additions & 2 deletions platforms/win32/winbareos.nsi
Expand Up @@ -75,6 +75,7 @@ Var hwnd
!include "StrFunc.nsh"
!include "WinMessages.nsh"
!include "nsDialogs.nsh"
!include "x64.nsh"

# call functions once to have them included
${StrCase}
Expand Down Expand Up @@ -448,7 +449,25 @@ FunctionEnd


Function .onInit
# check if we are installing on 64Bit, then do some settings
${If} ${RunningX64} # 64Bit OS
${If} ${BIT_WIDTH} == '32'
MessageBox MB_OK|MB_ICONQUESTION "You are running a 32 Bit Installer on a 64Bit OS.$\r$\n Please use the 64Bit installer."
Abort
${EndIf}
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_NAME}"
SetRegView 64
${EnableX64FSRedirection}
${Else} # 32Bit OS
${If} ${BIT_WIDTH} == '64'
MessageBox MB_OK|MB_ICONQUESTION "You are running a 64 Bit Installer on a 32Bit OS.$\r$\n Please use the 32Bit installer."
Abort
${EndIf}
${EndIf}



# check if software is already installed
ClearErrors
ReadRegStr $2 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName"
ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion"
Expand All @@ -457,8 +476,6 @@ Function .onInit
Abort




# Parameters:
# Needed for Client and Tray-Mon:
#
Expand Down

0 comments on commit 3f14776

Please sign in to comment.