set ri mtime when zipping
This commit is contained in:
@@ -15,7 +15,12 @@ func NewSu3VerifyCommand() cli.Command {
|
||||
Usage: "Verify a Su3 file",
|
||||
Description: "Verify a Su3 file",
|
||||
Action: su3VerifyAction,
|
||||
Flags: []cli.Flag{},
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "extract",
|
||||
Usage: "Also extract the contents of the su3",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,4 +49,9 @@ func su3VerifyAction(c *cli.Context) {
|
||||
}
|
||||
|
||||
fmt.Printf("Signature is valid for signer '%s'\n", su3File.SignerId)
|
||||
|
||||
if c.Bool("extract") {
|
||||
// @todo: don't assume zip
|
||||
ioutil.WriteFile("extracted.zip", su3File.BodyBytes(), 0755)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
)
|
||||
|
||||
func zipSeeds(seeds Seeds) ([]byte, error) {
|
||||
@@ -15,10 +16,13 @@ func zipSeeds(seeds Seeds) ([]byte, error) {
|
||||
|
||||
// Add some files to the archive.
|
||||
for _, file := range seeds {
|
||||
zipFile, err := zipWriter.Create(file.Name)
|
||||
fileHeader := &zip.FileHeader{Name: file.Name}
|
||||
fileHeader.SetModTime(time.Now().UTC())
|
||||
zipFile, err := zipWriter.CreateHeader(fileHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = zipFile.Write(file.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user