log.Fatalln(err)
}
for _, f := range meta.Files {
- if f.Signature != nil && *extractSig {
+ for _, sig := range f.Signature {
+ if !*extractSig {
+ continue
+ }
+ var fn string
+ switch sig.MediaType {
+ case meta4ra.SigMediaTypePGP:
+ fn = f.Name + ".asc"
+ case meta4ra.SigMediaTypeSSH:
+ fn = f.Name + ".sig"
+ }
+ if fn == "" {
+ continue
+ }
if err = os.WriteFile(
- f.Name+".asc",
- []byte(f.Signature.Signature),
+ fn,
+ []byte(strings.TrimPrefix(sig.Signature, "\n")),
fs.FileMode(0666),
); err != nil {
fmt.Println("Error:", f.Name, "can not save signature:", err)
fn := flag.String("fn", "", "Filename")
mtime := flag.String("mtime", "", "Take that file's mtime as a Published date")
desc := flag.String("desc", "", "Description")
- sig := flag.String("sig", "", "Path to signature file")
+ sigPGP := flag.String("sig-pgp", "", "Path to OpenPGP .asc signature file")
+ sigSSH := flag.String("sig-ssh", "", "Path to OpenSSH .sig signature file")
hashes := flag.String("hashes", strings.Join(meta4ra.HashesDefault, ","), "hash-name:command-s")
torrent := flag.String("torrent", "", "Torrent URL")
log.SetFlags(log.Lshortfile)
URLs: urls,
Hashes: h.Sums(),
}
- if *sig != "" {
- sigData, err := os.ReadFile(*sig)
+ if *sigPGP != "" {
+ sigData, err := os.ReadFile(*sigPGP)
if err != nil {
log.Fatalln(err)
}
- f.Signature = &meta4ra.Signature{
- MediaType: meta4ra.GPGSigMediaType,
+ f.Signature = append(f.Signature, meta4ra.Signature{
+ MediaType: meta4ra.SigMediaTypePGP,
Signature: "\n" + string(sigData),
+ })
+ }
+ if *sigSSH != "" {
+ sigData, err := os.ReadFile(*sigSSH)
+ if err != nil {
+ log.Fatalln(err)
}
+ f.Signature = append(f.Signature, meta4ra.Signature{
+ MediaType: meta4ra.SigMediaTypeSSH,
+ Signature: "\n" + string(sigData),
+ })
}
if *torrent != "" {
f.MetaURLs = []meta4ra.MetaURL{{MediaType: "torrent", URL: *torrent}}
Description string `xml:"description,,omitempty"`
Hashes []Hash `xml:"hash,,omitempty"`
MetaURLs []MetaURL `xml:"metaurl,,omitempty"`
- Signature *Signature `xml:"signature"`
+ Signature []Signature `xml:"signature"`
Size uint64 `xml:"size,,omitempty"`
URLs []URL `xml:"url,,omitempty"`
}