From 2c57ab18375a8d0b4df9c4b6d9f3692d14edfee7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 28 Jan 2020 01:57:46 -0800 Subject: [PATCH] cmd/fscrypt/setup: don't prompt to create /etc/fscrypt.conf (#190) When 'fscrypt setup' sees that /etc/fscrypt.conf doesn't exist, don't ask for confirmation before creating it. Just do it. This is the normal use, and there's not a good reason to ask the user to confirm it. --- README.md | 1 - cmd/fscrypt/setup.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 64d8028..7a0b9da 100644 --- a/README.md +++ b/README.md @@ -339,7 +339,6 @@ MOUNTPOINT DEVICE FILESYSTEM ENCRYPTION FSCRYPT # Create the global configuration file. Nothing else necessarily needs root. >>>>> sudo fscrypt setup -Create "/etc/fscrypt.conf"? [Y/n] y Customizing passphrase hashing difficulty for this system... Created global config file at "/etc/fscrypt.conf". Metadata directories created at "/.fscrypt". diff --git a/cmd/fscrypt/setup.go b/cmd/fscrypt/setup.go index 2bb15ef..69787bb 100644 --- a/cmd/fscrypt/setup.go +++ b/cmd/fscrypt/setup.go @@ -35,7 +35,7 @@ func createGlobalConfig(w io.Writer, path string) error { return ErrMustBeRoot } - // Ask to create or replace the config file + // If the config file already exists, ask to replace it _, err := os.Stat(path) switch { case err == nil: @@ -44,7 +44,7 @@ func createGlobalConfig(w io.Writer, path string) error { err = os.Remove(path) } case os.IsNotExist(err): - err = askConfirmation(fmt.Sprintf("Create %q?", path), true, "") + err = nil } if err != nil { return err -- 2.39.5