mirror of
https://github.com/rwinkhart/sshyp-labs.git
synced 2026-08-30 22:06:39 -04:00
gpgToRCW: Bump all direct dependencies
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/go-boilerplate/other"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/synccommon"
|
||||
"github.com/rwinkhart/rcw/wrappers"
|
||||
@@ -28,11 +29,14 @@ func main() {
|
||||
// convert the entries
|
||||
fmt.Print("\nRe-encrypting entries. Please wait; do not force close this process.\n\nGPG may prompt you for a passphrase for decryption.\n\n")
|
||||
var outputDir = global.EntryRoot + "-new"
|
||||
entries, folders := synccommon.WalkEntryDir()
|
||||
entries, folders, err := synccommon.WalkEntryDir()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to walk entry directory: "+err.Error(), back.ErrorRead)
|
||||
}
|
||||
for _, folder := range folders {
|
||||
err := os.MkdirAll(outputDir+strings.ReplaceAll(folder, "/", global.PathSeparator), 0700)
|
||||
if err != nil {
|
||||
back.PrintError("Failed to create directory: "+err.Error(), back.ErrorWrite, true)
|
||||
other.PrintError("Failed to create directory: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
}
|
||||
var decLines []string
|
||||
@@ -42,17 +46,17 @@ func main() {
|
||||
encBytes := wrappers.Encrypt([]byte(strings.Join(decLines, "\n")), rcwPassphrase)
|
||||
err := os.WriteFile(outputDir+strings.ReplaceAll(entry, "/", global.PathSeparator), encBytes, 0600)
|
||||
if err != nil {
|
||||
back.PrintError("Failed to write to file: "+err.Error(), back.ErrorWrite, true)
|
||||
other.PrintError("Failed to write to file: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
}
|
||||
|
||||
// swap the new directory with the old one
|
||||
err := os.Rename(global.EntryRoot, global.EntryRoot+"-old")
|
||||
err = os.Rename(global.EntryRoot, global.EntryRoot+"-old")
|
||||
if err != nil {
|
||||
back.PrintError("Failed to rename old directory: "+err.Error(), back.ErrorWrite, true)
|
||||
other.PrintError("Failed to rename old directory: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
err = os.Rename(outputDir, global.EntryRoot)
|
||||
if err != nil {
|
||||
back.PrintError("Failed to rename new directory: "+err.Error(), back.ErrorWrite, true)
|
||||
other.PrintError("Failed to rename new directory: "+err.Error(), back.ErrorWrite)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user