11use anyhow:: { Result , bail} ;
22use goldboot_image:: ImageArch ;
33use serde:: { Deserialize , Serialize } ;
4+ use smart_default:: SmartDefault ;
45use std:: io:: { BufRead , BufReader } ;
56use strum:: { Display , EnumIter , IntoEnumIterator } ;
67use validator:: Validate ;
@@ -9,7 +10,9 @@ use crate::{
910 builder:: {
1011 Builder ,
1112 http:: HttpServer ,
12- options:: { hostname:: Hostname , iso:: Iso , unix_account:: RootPassword } ,
13+ options:: {
14+ arch:: Arch , hostname:: Hostname , iso:: Iso , size:: Size , unix_account:: RootPassword ,
15+ } ,
1316 qemu:: { OsCategory , QemuBuilder } ,
1417 } ,
1518 cli:: prompt:: Prompt ,
@@ -24,31 +27,22 @@ use super::BuildImage;
2427///
2528/// Upstream: https://www.debian.org
2629/// Maintainer: cilki
27- #[ derive( Clone , Serialize , Deserialize , Validate , Debug , goldboot_macros:: Prompt ) ]
30+ #[ derive( Clone , Serialize , Deserialize , Validate , Debug , SmartDefault , goldboot_macros:: Prompt ) ]
2831pub struct Debian {
32+ #[ default( Arch ( ImageArch :: Amd64 ) ) ]
33+ pub arch : Arch ,
34+ pub size : Size ,
2935 pub edition : DebianEdition ,
30-
3136 #[ serde( flatten) ]
3237 pub hostname : Option < Hostname > ,
3338 pub root_password : RootPassword ,
34-
39+ #[ default( Iso {
40+ url: "http://example.com" . parse( ) . unwrap( ) ,
41+ checksum: None ,
42+ } ) ]
3543 pub iso : Iso ,
3644}
3745
38- impl Default for Debian {
39- fn default ( ) -> Self {
40- Self {
41- root_password : RootPassword :: default ( ) ,
42- edition : DebianEdition :: default ( ) ,
43- hostname : Some ( Hostname :: default ( ) ) ,
44- iso : Iso {
45- url : "https://example.com" . parse ( ) . unwrap ( ) ,
46- checksum : None ,
47- } ,
48- }
49- }
50- }
51-
5246impl BuildImage for Debian {
5347 fn build ( & self , worker : & Builder ) -> Result < ( ) > {
5448 let mut qemu = QemuBuilder :: new ( & worker, OsCategory :: Linux )
0 commit comments