mirror of
https://github.com/kou029w/megabit-os.git
synced 2025-01-18 16:07:58 +00:00
bin/version curl, jq → ruby
This commit is contained in:
parent
8f4dc4b208
commit
267de7185d
2 changed files with 12 additions and 9 deletions
|
@ -49,7 +49,7 @@ bin/img-gen
|
|||
- Docker
|
||||
- Docker Compose
|
||||
- qemu-user-static
|
||||
- awk, bash, curl, fallocate, grep, gzip, gzip, jq, losetup, mkfs.fat, parted, ruby, ssh-keygen, tar, xargs
|
||||
- awk, bash, curl, fallocate, grep, gzip, gzip, losetup, mkfs.fat, parted, ruby, ssh-keygen, tar, xargs
|
||||
|
||||
### WiFi の設定
|
||||
|
||||
|
|
19
bin/version
19
bin/version
|
@ -1,10 +1,13 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env ruby
|
||||
# 最新のバージョンを取得
|
||||
# Usage: bin/version
|
||||
# Required: curl grep jq ruby
|
||||
set -eu
|
||||
base="http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf"
|
||||
curl -s "${base}/latest-releases.yaml" \
|
||||
| ruby -ryaml -rjson -e 'puts(YAML.load($<).to_json)' \
|
||||
| jq -r '.[] | select(.title == "Raspberry Pi").file' \
|
||||
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
require "open-uri"
|
||||
require "yaml"
|
||||
|
||||
base = "http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf"
|
||||
url = "#{base}/latest-releases.yaml"
|
||||
io = URI.open(url)
|
||||
yaml = YAML.load(io)
|
||||
version = yaml.dig(0, "version")
|
||||
|
||||
puts version
|
||||
|
|
Loading…
Add table
Reference in a new issue