]> Cypherpunks.ru repositories - prepro.git/commitdiff
.ziphash.sig
authorSergey Matveev <stargrave@stargrave.org>
Wed, 16 Aug 2023 07:19:27 +0000 (10:19 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 16 Aug 2023 07:19:27 +0000 (10:19 +0300)
USAGE
mk-mod
mk-mods

diff --git a/USAGE b/USAGE
index e3cd6ab32e0414e39d2ee3899dda40bbbd9f08df35f2a5ab25dd3bd987764c6c..e51d88618e3d71a7a961944912345634591047616bede490849912e790022a0e 100644 (file)
--- a/USAGE
+++ b/USAGE
@@ -1,9 +1,11 @@
 mk-mod utility creates GOPROXY-compatible version of the module in the
 current directory:
-    mk-mod VCS-URL VCS-PATH MODULE-NAME VERSION
+    mk-mod VCS-URL VCS-PATH MODULE-NAME VERSION [SIGNKEY]
 Only Git VCS is supported. Git tag's name must be equal to VERSION.
 mk-mods iterates through all tags:
-    mk-mods VCS-URL VCS-PATH MODULE-BASE-NAME
+    mk-mods VCS-URL VCS-PATH MODULE-BASE-NAME [SIGNKEY]
+SIGNKEY is optional path to OpenSSH signing key, that will sign the
+.ziphash file.
 
 mk-list utility collects all known versions in current GOPROXY directory
 and creates corresponding "list" files.
diff --git a/mk-mod b/mk-mod
index dc83c8bf8be142889436f2375614a4166b0e57c7f491b14a42451060dc882db1..1d9332ab197aeecf24e3a1829ef7daa0f8ed5929988da00d4a5a2c0d26fe4290 100755 (executable)
--- a/mk-mod
+++ b/mk-mod
@@ -6,6 +6,7 @@ vcsurl=$1
 vcspath=$2
 modname=$3
 version=$4
+signkey=$5
 
 dst=$modname/@v
 mkdir -p $dst
@@ -32,4 +33,9 @@ $ziphash $version.zip > $version.ziphash
 unzip -p $version.zip ${modname}@${version}/go.mod > $version.mod
 printf '{"Version":"%s","Time":"%s","Origin":{"VCS":"git","URL":"%s","Ref":"refs/tags/%s","Hash":"%s"}}' \
     $version $when $vcsurl $version $hsh > $version.info
-touch -d $when $version.info $version.mod $version.zip $version.ziphash
+totouch=($version.info $version.mod $version.zip $version.ziphash)
+[[ -z $signkey ]] || {
+    ssh-keygen -Y sign -f $signkey -n file $version.ziphash
+    totouch=($totouch $version.ziphash.sig)
+}
+touch -d $when $totouch
diff --git a/mk-mods b/mk-mods
index dbc2bbabafb83b29c7efacc08e8bf91fc9bd0ae08d294b1fafd734058a57aba8..dc721760d7b6dd65b2b0e25ca7f589c3a45e61a3968247f9816c0b57fbf1009c 100755 (executable)
--- a/mk-mods
+++ b/mk-mods
@@ -5,7 +5,8 @@ root=$0:h:a
 vcsurl=$1
 vcspath=$2
 modbase=$3
+signkey=$4
 
 $root/list-vers $vcspath $modbase | while IFS=" " read modname version ; do
-    $root/mk-mod $vcsurl $vcspath $modname $version
+    $root/mk-mod $vcsurl $vcspath $modname $version $signkey
 done