forked from Seltcana/rootfs-wip
Parses template names in `new`.
parent
9e91e4f05b
commit
ce41e4fac0
12
src/main.cr
12
src/main.cr
|
@ -141,6 +141,12 @@ class RootFS::RootFS
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def create!(template : String)
|
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: Alternate backends.
|
||||||
# FIXME: template string parsing.
|
# FIXME: template string parsing.
|
||||||
is_btrfs = true # FIXME: do the actual detection
|
is_btrfs = true # FIXME: do the actual detection
|
||||||
|
@ -151,7 +157,11 @@ class RootFS::RootFS
|
||||||
|
|
||||||
execute "btrfs subvolume create '#{@directory}'"
|
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
|
end
|
||||||
|
|
||||||
def self.load(directory)
|
def self.load(directory)
|
||||||
|
|
Loading…
Reference in New Issue