Alpine rootfs creation backend.

master
Luka Vandervelden 2020-12-12 05:25:39 +01:00
parent ce41e4fac0
commit f75852659a
1 changed files with 14 additions and 2 deletions

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