Parses template names in new.

This commit is contained in:
Luka Vandervelden 2020-11-29 20:48:47 +01:00
parent 9e91e4f05b
commit ce41e4fac0

View File

@ -141,6 +141,12 @@ class RootFS::RootFS
end
protected def create!(template : String)
template_as_array = template.split /-/
template_name = template_as_array[0].downcase
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
@ -151,7 +157,11 @@ class RootFS::RootFS
execute "btrfs subvolume create '#{@directory}'"
execute "debootstrap --arch amd64 '#{template}' '#{@directory}'"
if template_name == "debian"
version = template_version || "buster"
execute "debootstrap --arch amd64 '#{version}' '#{@directory}'"
end
end
def self.load(directory)