From ce41e4fac0594a6acd7ba33a4bf2e739473b4015 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Sun, 29 Nov 2020 20:48:47 +0100 Subject: [PATCH] Parses template names in `new`. --- src/main.cr | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.cr b/src/main.cr index c25282b..10261b3 100644 --- a/src/main.cr +++ b/src/main.cr @@ -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)