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
|
||||||
- Docker Compose
|
- Docker Compose
|
||||||
- qemu-user-static
|
- 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 の設定
|
### WiFi の設定
|
||||||
|
|
||||||
|
|
19
bin/version
19
bin/version
|
@ -1,10 +1,13 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env ruby
|
||||||
# 最新のバージョンを取得
|
# 最新のバージョンを取得
|
||||||
# Usage: bin/version
|
# Usage: bin/version
|
||||||
# Required: curl grep jq ruby
|
require "open-uri"
|
||||||
set -eu
|
require "yaml"
|
||||||
base="http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf"
|
|
||||||
curl -s "${base}/latest-releases.yaml" \
|
base = "http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf"
|
||||||
| ruby -ryaml -rjson -e 'puts(YAML.load($<).to_json)' \
|
url = "#{base}/latest-releases.yaml"
|
||||||
| jq -r '.[] | select(.title == "Raspberry Pi").file' \
|
io = URI.open(url)
|
||||||
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
|
yaml = YAML.load(io)
|
||||||
|
version = yaml.dig(0, "version")
|
||||||
|
|
||||||
|
puts version
|
||||||
|
|
Loading…
Add table
Reference in a new issue