set ri mtime when zipping

This commit is contained in:
Matt Drollette
2014-12-13 12:11:47 -06:00
parent e37fd5cfb4
commit f016b6bbfe
2 changed files with 16 additions and 2 deletions

View File

@@ -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)
}
}

View File

@@ -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