Alpine rootfs creation backend.

This commit is contained in:
Luka Vandervelden 2020-12-12 05:25:39 +01:00
parent ce41e4fac0
commit f75852659a

View File

@ -147,8 +147,6 @@ class RootFS::RootFS
template_version = template_as_array[1]?
template_architecture = template_as_array[2]?
# FIXME: Alternate backends.
# FIXME: template string parsing.
is_btrfs = true # FIXME: do the actual detection
unless is_btrfs
@ -161,6 +159,20 @@ class RootFS::RootFS
version = template_version || "buster"
execute "debootstrap --arch amd64 '#{version}' '#{@directory}'"
elsif template_name == "alpine"
version = template_version || "latest-stable"
if version == "latest"
version = "latest-stable"
elsif version == "latest-stable" || version == "edge"
else
version = "v" + version
end
# FIXME: We should homogeneize triplets.
arch = template_architecture || "x86_64"
execute "apk --arch '#{arch}' -X http://dl-cdn.alpinelinux.org/alpine/#{version}/main/ -U --allow-untrusted --root '#{@directory}' --initdb add alpine-base"
end
end