distronaut
1.0.0
Distronaut 는 배포 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 "
}
}
]
}
]추가 메타 데이터는 Outlowatch.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 다음을 포함하는 맵입니다.:* 정의 된 경로 매개 변수 와 일치하는 REGEX 패턴입니다.k<:name> 구문을 사용하여 역 참조 할 수 있습니다.hash.* 모든 해시 관련 설정이 포함되어 있습니다.hash.file 해시가 포함 된 파일과 일치하는 Regex 패턴입니다..hash.pattern 주어진 ISO에서 해시를 캡처하는 Regex 패턴입니다 ( k<iso> 로 다시 참조 할 수 있습니다)..hash.algo 는 해시 알고리즘의 이름입니다.meta.* 모든 메타 데이터 관련 설정이 포함되어 있습니다.meta.source distrowatch 로 설정해야합니다 (현재 지원되는 메타 데이터 소스 만).meta.id 는 Outlowatch의 배포판입니다.meta.version 은 Fistrowatch에서 참조되는대로 버전과 일치하는 Regex 패턴입니다.예제 :
- 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.