A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/299eb3160d87548e7302db8759bd8fb37c966059 below:

warn when there are no files to decrypt · orgrim/pg_back@299eb31 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+10

-2

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+10

-2

lines changed Original file line number Diff line number Diff line change

@@ -253,7 +253,7 @@ func parseCli(args []string) (options, []string, error) {

253 253

NoEncrypt := pflag.Bool("no-encrypt", false, "do not encrypt the dumps")

254 254

pflag.BoolVar(&opts.EncryptKeepSrc, "encrypt-keep-src", false, "keep original files when encrypting")

255 255

NoEncryptKeepSrc := pflag.Bool("no-encrypt-keep-src", false, "do not keep original files when encrypting")

256 -

pflag.BoolVar(&opts.Decrypt, "decrypt", false, "decrypt files in the backup directory")

256 +

pflag.BoolVar(&opts.Decrypt, "decrypt", false, "decrypt files in the backup directory instead of dumping. DBNAMEs become\nglobs to select files")

257 257

pflag.StringVar(&opts.CipherPassphrase, "cipher-pass", "", "cipher passphrase for encryption and decryption\n")

258 258 259 259

pflag.StringVar(&opts.Upload, "upload", "none", "upload produced files to target (s3, gcs,..) use \"none\" to override\nconfiguration file and disable upload")

Original file line number Diff line number Diff line change

@@ -901,7 +901,7 @@ func decryptDirectory(dir string, password string, workers int, globs []string)

901 901

// return an error

902 902

ret := make(chan bool, workers)

903 903 904 -

// Start workers than listen for filenames to decrypt until the queue

904 +

// Start workers that listen for filenames to decrypt until the queue

905 905

// is closed

906 906

for i := 0; i < workers; i++ {

907 907

wg.Add(1)

@@ -938,6 +938,7 @@ func decryptDirectory(dir string, password string, workers int, globs []string)

938 938

return fmt.Errorf("unable to read directory %s: %w", dir, err)

939 939

}

940 940 941 +

var c int

941 942

for _, path := range entries {

942 943

keep := true

943 944

if len(globs) > 0 {

@@ -976,6 +977,7 @@ func decryptDirectory(dir string, password string, workers int, globs []string)

976 977 977 978

file := filepath.Join(subdir, subpath.Name())

978 979

if strings.HasSuffix(file, ".age") {

980 +

c++

979 981

fq <- file

980 982

}

981 983

}

@@ -984,10 +986,16 @@ func decryptDirectory(dir string, password string, workers int, globs []string)

984 986 985 987

file := filepath.Join(dir, path.Name())

986 988

if strings.HasSuffix(file, ".age") {

989 +

c++

987 990

fq <- file

988 991

}

989 992

}

990 993 994 +

// Print a warning when no candidate files are found with a hint that the dbname is a glob

995 +

if c == 0 {

996 +

l.Warnln("no candidate file found for decryption. Maybe add a wildcard (*) to the patterns?")

997 +

}

998 + 991 999

// Closing the channel will make the workers stop as soon as it is

992 1000

// empty

993 1001

close(fq)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4