Parses template names in `new`.

remotes/1712931126608716286/tmp_refs/heads/master
Luka Vandervelden 2020-11-29 20:48:47 +01:00
parent 9e91e4f05b
commit ce41e4fac0
1 changed files with 11 additions and 1 deletions

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)