aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt/fscrypt.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 14:04:47 -0700
committerEric Biggers <ebiggers@google.com>2020-05-09 14:04:47 -0700
commit5716215ceae3ab8b49a7b2ba410cb51a82c3176b (patch)
tree8e5e6bd181dee4c8e99db7604a954b9030d52a0c /cmd/fscrypt/fscrypt.go
parent8ff53630f1cc90ae23835e9571f9096e211dce67 (diff)
cmd/fscrypt: add FSCRYPT_CONSISTENT_OUTPUT environmental variable
Allow setting FSCRYPT_CONSISTENT_OUTPUT=1 in the environment to cause policies and protectors to sorted by last modification time. The CLI tests need this to make the output of 'fscrypt' ordered in a consistent way with regard to the operations performed.
Diffstat (limited to 'cmd/fscrypt/fscrypt.go')
-rw-r--r--cmd/fscrypt/fscrypt.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/fscrypt/fscrypt.go b/cmd/fscrypt/fscrypt.go
index bbe16bb..aa5b6f4 100644
--- a/cmd/fscrypt/fscrypt.go
+++ b/cmd/fscrypt/fscrypt.go
@@ -33,6 +33,7 @@ import (
"github.com/urfave/cli"
"github.com/google/fscrypt/actions"
+ "github.com/google/fscrypt/filesystem"
)
// Current version of the program (set by Makefile)
@@ -49,6 +50,9 @@ func main() {
if rootmnt := os.Getenv("FSCRYPT_ROOT_MNT"); rootmnt != "" {
actions.LoginProtectorMountpoint = rootmnt
}
+ if consistent := os.Getenv("FSCRYPT_CONSISTENT_OUTPUT"); consistent == "1" {
+ filesystem.SortDescriptorsByLastMtime = true
+ }
// Create our command line application
app := cli.NewApp()