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.