Fix build of Windows MSI when running as root (#28)
Use permissive file permissions to allow mounting files into Wix Docker container. Fixes https://github.com/fleetdm/fleet/issues/1424
This commit is contained in:
@@ -8,7 +8,7 @@ Orbit is the recommended agent for Fleet. But Orbit can be used with or without
|
||||
|
||||
## Try Orbit
|
||||
|
||||
#### With [`fleetctl preview` already running](https://github.com/fleetdm/fleet#try-fleet) and [Go](https://golang.org/doc/install) installed:
|
||||
#### With [`fleetctl preview` already running](https://github.com/fleetdm/fleet#try-fleet) and [Go](https://golang.org/doc/install) 1.16 installed:
|
||||
|
||||
```bash
|
||||
# From within the top-level directory of this repo…
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
IGNORE BUT DO NOT REMOVE. THIS IS HERE SO THAT THE DIRECTORY REMAINS
|
||||
@@ -0,0 +1 @@
|
||||
* Fix permissions for building MSI when packaging as root user. Fixes fleetdm/fleet#1424
|
||||
@@ -52,7 +52,7 @@ func main() {
|
||||
&cli.StringFlag{
|
||||
Name: "version",
|
||||
Usage: "Version for package product",
|
||||
Value: "0.0.2",
|
||||
Value: "0.0.3",
|
||||
Destination: &opt.Version,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
|
||||
@@ -3,6 +3,7 @@ package packaging
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -114,3 +115,17 @@ func writeSecret(opt Options, orbitRoot string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func chmodRecursive(path string, perm os.FileMode) error {
|
||||
return filepath.Walk(path, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "walk error")
|
||||
}
|
||||
|
||||
if err := os.Chmod(path, perm); err != nil {
|
||||
return errors.Wrap(err, "chmod")
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -59,6 +59,11 @@ func BuildMSI(opt Options) error {
|
||||
return errors.Wrap(err, "write wix file")
|
||||
}
|
||||
|
||||
// Make sure permissions are permissive so that the `wine` user in the Wix Docker container can access files.
|
||||
if err := chmodRecursive(tmpDir, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := wix.Heat(tmpDir); err != nil {
|
||||
return errors.Wrap(err, "package root files")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user