-
Notifications
You must be signed in to change notification settings - Fork 2
/
fetch.rb
29 lines (22 loc) · 805 Bytes
/
fetch.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true
REL = "22.04"
CODENAME = "jammy"
ARCH = "amd64"
def fetch_ubuntu_base(cache_dir)
url = "https://cdimage.ubuntu.com/ubuntu-base/releases/#{REL}/release"
file = "ubuntu-base-#{REL}-base-#{ARCH}.tar.gz"
sha256 = "#{url}/SHA256SUMS"
unless File.exist?("#{cache_dir}/#{file}")
`wget #{url}/#{file} -P #{cache_dir}`
end
`curl -L #{sha256} >> #{cache_dir}/SHA256SUMS`
end
def fetch_ubuntu_minimal(cache_dir)
url = "https://cloud-images.ubuntu.com/minimal/releases/#{CODENAME}/release/"
file = "ubuntu-#{REL}-minimal-cloudimg-#{ARCH}-root.tar.xz"
sha256 = "#{url}/SHA256SUMS"
unless File.exist?("#{cache_dir}/#{file}")
`wget #{url}/#{file} -P #{cache_dir}`
end
`curl -L #{sha256} >> #{cache_dir}/SHA256SUMS`
end