distronaut
1.0.0
Distronaut是一种通过Internet传播以找到发行ISO链接和元数据的工具,使您更容易监视新版本,刻录安装媒体或构建自己的ISO银行档案。
使用预构建的二进制:
go install github.com/ovh/distronaut@latest从来源建造
make使用fetch命令从配置的来源检索JSON:
distronaut fetch -c config/sources.yml -f ' debian '输出类似于下面:
[
{
"source" : " Debian " ,
"family" : " Linux " ,
"distribution" : " Debian (formerly Debian GNU/Linux) " ,
"website" : " http://www.debian.org/ " ,
"documentation" : " http://www.debian.org/doc/ " ,
"status" : " Active " ,
"logo" : " https://distrowatch.com/images/yvzhuwbpy/debian.png " ,
"logo64" : " data:image/png;base64,... " ,
"versions" : [
{
"url" : " https://cdimage.debian.org/cdimage/archive/12.6.0/amd64/iso-cd/debian-12.6.0-amd64-netinst.iso " ,
"hash" : " sha256:ade3a4acc465f59ca2496344aab72455945f3277a52afc5a2cae88cdc370fa12 " ,
"hashfile" : " https://cdimage.debian.org/cdimage/archive/12.6.0/amd64/iso-cd/SHA256SUMS " ,
"version" : " 12.6.0 " ,
"arch" : " amd64 " ,
"meta" : {
"release" : " 2023-06-10 "
}
}
]
}
]从distrowatch.com取消了其他元数据。
该软件包也可以在另一个Golang代码库中导入:
package main
import (
"encoding/json"
"fmt"
"github.com/ovh/distronaut/pkg/distro"
)
func main () {
src , _ := distro . FetchSources ( "config/sources.yml" , "debian" )
j , _ := json . MarshalIndent ( src , "" , " " )
fmt . Println ( string ( j ))
}打开您的配置文件并添加一个新条目,其中包含:
name是您新来源的友好名称(也可以用于过滤)url是源URL模式:指示patterns是包含::*是由定义的路由参数匹配的正则图案k<:name>语法进行回顾.hash.*包含所有与哈希相关的设置.hash.file是一个符合包含哈希文件的文件.hash.pattern k<iso>.hash.algo是哈希算法的名称.meta.*包含所有相关的元数据.meta.source必须设置为distrowatch (目前仅支持元数据源).meta.id是Distrowatch上的发行版手柄.meta.version是匹配该版本的正则表达式图案示例来源:
- name : Debian
url : https://cdimage.debian.org/debian-cd/:version/:arch/iso-cd/:iso
patterns :
:version : ^(d+.d+(?:.d+)?)/$
:arch : ^(amd64|arm64)/$
:iso : ^debian-k<version>-k<arch>-netinst.iso$
.hash.file : SHA256SUMS
.hash.algo : sha256
.hash.pattern : (?m)^([0-9a-f]{64})s+k<iso>
.meta.source : distrowatch
.meta.id : debian
.meta.version : (d+)请首先阅读我们的贡献指南(贡献.md)。
使用:
make test模拟的服务器将暂时在端口3000上产生,以避免执行真实的网络请求。
Copyright 2021 OVH SAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.