mirror of
https://github.com/kairos-io/kcrypt.git
synced 2025-06-24 22:43:02 +00:00
go fmt
This commit is contained in:
parent
dc90d59ad2
commit
d977bdf888
30
main.go
30
main.go
@ -161,8 +161,8 @@ func sh(c string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
GZType = "gz"
|
GZType = "gz"
|
||||||
XZType = "xz"
|
XZType = "xz"
|
||||||
LZMAType = "lzma"
|
LZMAType = "lzma"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ func detect(archive string) (string, error) {
|
|||||||
if strings.Contains(out, "xz") {
|
if strings.Contains(out, "xz") {
|
||||||
return XZType, nil
|
return XZType, nil
|
||||||
|
|
||||||
} else if strings.Contains(out, "lzma") {
|
} else if strings.Contains(out, "lzma") {
|
||||||
return LZMAType, nil
|
return LZMAType, nil
|
||||||
|
|
||||||
} else if strings.Contains(out, "gz") {
|
} else if strings.Contains(out, "gz") {
|
||||||
return GZType, nil
|
return GZType, nil
|
||||||
@ -207,7 +207,7 @@ func extractInitrd(initrd string, dst string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createInitrd(initrd string, src string, format string) error {
|
func createInitrd(initrd string, src string, format string) error {
|
||||||
fmt.Printf("Creating '%s' from '%s' as '%s'\n",initrd, src,format)
|
fmt.Printf("Creating '%s' from '%s' as '%s'\n", initrd, src, format)
|
||||||
|
|
||||||
if _, err := os.Stat(src); err != nil {
|
if _, err := os.Stat(src); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -230,7 +230,7 @@ func createInitrd(initrd string, src string, format string) error {
|
|||||||
|
|
||||||
func injectInitrd(initrd string, file, dst string) error {
|
func injectInitrd(initrd string, file, dst string) error {
|
||||||
|
|
||||||
fmt.Printf("Injecting '%s' as '%s' into '%s'\n",file, dst,initrd)
|
fmt.Printf("Injecting '%s' as '%s' into '%s'\n", file, dst, initrd)
|
||||||
format, err := detect(initrd)
|
format, err := detect(initrd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -241,13 +241,13 @@ func injectInitrd(initrd string, file, dst string) error {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmp)
|
defer os.RemoveAll(tmp)
|
||||||
|
|
||||||
fmt.Printf("Extracting '%s' in '%s' ...\n",initrd, tmp)
|
fmt.Printf("Extracting '%s' in '%s' ...\n", initrd, tmp)
|
||||||
if err := extractInitrd(initrd, tmp); err != nil {
|
if err := extractInitrd(initrd, tmp); err != nil {
|
||||||
return fmt.Errorf("cannot extract initrd, %s", err)
|
return fmt.Errorf("cannot extract initrd, %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d:=filepath.Join(tmp, dst)
|
d := filepath.Join(tmp, dst)
|
||||||
fmt.Printf("Copying '%s' in '%s' ...\n",file, d)
|
fmt.Printf("Copying '%s' in '%s' ...\n", file, d)
|
||||||
if err := cp.Copy(file, d); err != nil {
|
if err := cp.Copy(file, d); err != nil {
|
||||||
return fmt.Errorf("cannot copy file, %s", err)
|
return fmt.Errorf("cannot copy file, %s", err)
|
||||||
}
|
}
|
||||||
@ -279,13 +279,13 @@ func unlockAll() error {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "keiros-kcrypt",
|
Name: "keiros-kcrypt",
|
||||||
Version: "0.1",
|
Version: "0.1",
|
||||||
Author: "Ettore Di Giacinto",
|
Author: "Ettore Di Giacinto",
|
||||||
Usage: "keiros escrow key agent component",
|
Usage: "keiros escrow key agent component",
|
||||||
Description: ``,
|
Description: ``,
|
||||||
UsageText: ``,
|
UsageText: ``,
|
||||||
Copyright: "Ettore Di Giacinto",
|
Copyright: "Ettore Di Giacinto",
|
||||||
Commands: []cli.Command{
|
Commands: []cli.Command{
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user