@@ -72,6 +72,7 @@ type options struct {
7272 Verbose bool
7373 Quiet bool
7474 Encrypt bool
75+ EncryptKeepSrc bool
7576 CipherPassphrase string
7677 Decrypt bool
7778}
@@ -191,6 +192,8 @@ func parseCli(args []string) (options, []string, error) {
191192
192193 pflag .BoolVar (& opts .Encrypt , "encrypt" , false , "encrypt the dumps" )
193194 NoEncrypt := pflag .Bool ("no-encrypt" , false , "do not encrypt the dumps" )
195+ pflag .BoolVar (& opts .EncryptKeepSrc , "encrypt-keep-src" , false , "keep original files when encrypting" )
196+ NoEncryptKeepSrc := pflag .Bool ("no-encrypt-keep-src" , false , "do not keep original files when encrypting" )
194197 pflag .BoolVar (& opts .Decrypt , "decrypt" , false , "decrypt files in the backup directory" )
195198 pflag .StringVar (& opts .CipherPassphrase , "cipher-pass" , "" , "cipher passphrase for encryption and decryption\n " )
196199
@@ -233,6 +236,12 @@ func parseCli(args []string) (options, []string, error) {
233236 changed = append (changed , "encrypt" )
234237 }
235238
239+ // Same for encrypt_keep_source = true in the config file
240+ if * NoEncryptKeepSrc {
241+ opts .EncryptKeepSrc = false
242+ changed = append (changed , "encrypt-keep-src" )
243+ }
244+
236245 // When --help or --version is given print and tell the caller
237246 // through the error to exit
238247 if pce .ShowHelp {
@@ -350,6 +359,7 @@ func loadConfigurationFile(path string) (options, error) {
350359 opts .PostHook = s .Key ("post_backup_hook" ).MustString ("" )
351360 opts .Encrypt = s .Key ("encrypt" ).MustBool (false )
352361 opts .CipherPassphrase = s .Key ("cipher_passphrase" ).MustString ("" )
362+ opts .EncryptKeepSrc = s .Key ("encrypt_keep_source" ).MustBool (false )
353363
354364 // Validate purge keep and time limit
355365 keep , err := validatePurgeKeepValue (purgeKeep )
@@ -539,6 +549,8 @@ func mergeCliAndConfigOptions(cliOpts options, configOpts options, onCli []strin
539549 opts .PostHook = cliOpts .PostHook
540550 case "encrypt" :
541551 opts .Encrypt = cliOpts .Encrypt
552+ case "encrypt-keep-src" :
553+ opts .EncryptKeepSrc = cliOpts .EncryptKeepSrc
542554 case "cipher-pass" :
543555 opts .CipherPassphrase = cliOpts .CipherPassphrase
544556 case "decrypt" :
0 commit comments