[msitools] Set ALLUSERS=1 in perMachine install scope



commit 856648845ea761ad2df9d3cd923ab483d6e142cb
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Tue Oct 7 17:20:10 2014 +0200

    Set ALLUSERS=1 in perMachine install scope
    
    Follow WiX behaviour and set ALLUSERS=1 automatically in perMachine
    install scope.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1146586

 tests/data/wixl/SampleMachine.wxs |   59 +++++++++++++++++++++++++++++++++++++
 tests/wixl.at                     |   10 ++++++
 tools/wixl/builder.vala           |    9 +++--
 3 files changed, 74 insertions(+), 4 deletions(-)
---
diff --git a/tests/data/wixl/SampleMachine.wxs b/tests/data/wixl/SampleMachine.wxs
new file mode 100644
index 0000000..491d0c2
--- /dev/null
+++ b/tests/data/wixl/SampleMachine.wxs
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='windows-1252'?>
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
+
+  <?define VERSION="0.0.0.0"?>
+
+  <Product
+    Id="*"
+    Name="Sample App"
+    Language="1033"
+    Version="$(var.VERSION)"
+    Manufacturer="Example"
+    UpgradeCode="44a869b4-5dd4-44b0-938b-399f41611658"
+  >
+    <Package
+      Description="Sample App"
+      Manufacturer="Example"
+      InstallerVersion="200"
+      Compressed="yes"
+      InstallScope="perMachine"
+    />
+
+    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
+    <MediaTemplate EmbedCab="yes" />
+
+    <Icon Id="Icon.exe" SourceFile="FoobarAppl10.exe" />
+    <Property Id="ARPPRODUCTICON" Value="Icon.exe" />
+    <Property Id="ARPHELPLINK" Value="http://www.example.com/"; />
+
+    <Feature Id="ProductFeature" Title="SampleApp" Level="1">
+      <ComponentGroupRef Id="ProductComponents" />
+    </Feature>
+  </Product>
+
+  <Fragment>
+    <Directory Id="TARGETDIR" Name="SourceDir">
+      <Directory Id="LocalAppDataFolder">
+        <Directory Id="INSTALLFOLDER" Name="SampleApp" />
+      </Directory>
+    </Directory>
+  </Fragment>
+
+  <Fragment>
+    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
+      <Component Id="ProductComponent" Guid="262eca3a-9ab0-4706-ab39-55c89819506a">
+
+        <RegistryKey Root="HKCU" Key="Software\Example\SampleApp">
+          <RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes" />
+        </RegistryKey>
+
+        <CreateFolder />
+        <RemoveFolder Id="RemoveAppRootDirectory" On="uninstall" />
+
+        <File Id="SampleApp.exe" Source="FoobarAppl10.exe"/>
+
+      </Component>
+    </ComponentGroup>
+  </Fragment>
+
+</Wix>
diff --git a/tests/wixl.at b/tests/wixl.at
index 378ddbf..f3c160d 100644
--- a/tests/wixl.at
+++ b/tests/wixl.at
@@ -4,6 +4,9 @@ AT_BANNER([wixl])
 m4_define([AT_CHECK_WIXL], [
 AT_CHECK([_wixl ]$@)])
 
+m4_define([AT_CHECK_MSIINFO], [
+AT_CHECK([_msiinfo ]$@)])
+
 # AT_WIXLDATA - copy data file from source tree
 m4_define([AT_WIXLDATA], [AT_MSIDATA([wixl/$1], [m4_default([$2], [$1])])])
 
@@ -36,6 +39,13 @@ AT_CHECK_WIXL([-o out.msi SampleUser.wxs], [0], [ignore], [ignore])
 AT_CHECK([test -f out.msi], [0])
 AT_CLEANUP
 
+AT_SETUP([SampleMachine])
+AT_WIXLDATA([SampleMachine.wxs])
+AT_WIXLDATA([FoobarAppl10.exe])
+AT_CHECK_WIXL([-o out.msi SampleMachine.wxs], [0], [ignore], [ignore])
+AT_CHECK_MSIINFO([export out.msi Property | grep -q 'ALLUSERS  1'], [0])
+AT_CLEANUP
+
 AT_SETUP([Stable component GUIDs])
 AT_WIXLDATA([ComponentGUID.wxs])
 AT_WIXLDATA([FoobarAppl10.exe])
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 9a6e738..695a758 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -327,12 +327,13 @@ namespace Wixl {
 
             int source = SourceFlags.COMPRESSED;
             if (package.InstallScope != null) {
-                if (package.InstallScope == "perUser")
+                if (package.InstallScope == "perUser") {
                     source |= SourceFlags.NO_PRIVILEGES;
-                else if (package.InstallScope == "perMachine")
-                    source |= 0;
-                else
+                } else if (package.InstallScope == "perMachine") {
+                    db.table_property.add ("ALLUSERS", "1");
+                } else {
                     error ("invalid InstallScope value: %s", package.InstallScope);
+                }
             }
             db.info.set_property (Libmsi.Property.SOURCE, source);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]