1919from archinstall .lib .models .network_configuration import NetworkConfiguration
2020from archinstall .lib .models .packages import Repository
2121from archinstall .lib .models .profile_model import ProfileConfiguration
22- from archinstall .lib .models .users import User
22+ from archinstall .lib .models .users import Password , User
2323from archinstall .lib .output import error , warn
2424from archinstall .lib .plugins import load_plugin
2525from archinstall .lib .storage import storage
@@ -71,16 +71,16 @@ class ArchConfig:
7171 # Special fields that should be handle with care due to security implications
7272 users : list [User ] = field (default_factory = list )
7373 disk_encryption : DiskEncryption | None = None
74- root_password : str | None = None
74+ root_enc_password : Password | None = None
7575
7676 def unsafe_json (self ) -> dict [str , Any ]:
7777 config = {
78- '! users' : [user .json () for user in self .users ],
79- '!root-password ' : self .root_password ,
78+ 'users' : [user .json () for user in self .users ],
79+ 'root_enc_password ' : self .root_enc_password . enc_password if self . root_enc_password else None ,
8080 }
8181
82- if self .disk_encryption :
83- config ['encryption_password' ] = self .disk_encryption .encryption_password
82+ if self .disk_encryption and self . disk_encryption . encryption_password :
83+ config ['encryption_password' ] = self .disk_encryption .encryption_password . plaintext
8484
8585 return config
8686
@@ -149,10 +149,12 @@ def from_config(cls, args_config: dict[str, Any]) -> 'ArchConfig':
149149 if net_config := args_config .get ('network_config' , None ):
150150 arch_config .network_config = NetworkConfiguration .parse_arg (net_config )
151151
152- users = args_config .get ('!users' , None )
153- superusers = args_config .get ('!superusers' , None )
154- if users is not None or superusers is not None :
155- arch_config .users = User .parse_arguments (users , superusers )
152+ # DEPRECATED: backwards copatibility
153+ if users := args_config .get ('!users' , None ):
154+ arch_config .users = User .parse_arguments (users )
155+
156+ if users := args_config .get ('users' , None ):
157+ arch_config .users = User .parse_arguments (users )
156158
157159 if bootloader_config := args_config .get ('bootloader' , None ):
158160 arch_config .bootloader = Bootloader .from_arg (bootloader_config )
@@ -167,7 +169,7 @@ def from_config(cls, args_config: dict[str, Any]) -> 'ArchConfig':
167169 arch_config .disk_encryption = DiskEncryption .parse_arg (
168170 arch_config .disk_config ,
169171 args_config ['disk_encryption' ],
170- args_config .get ('encryption_password' , '' )
172+ Password ( plaintext = args_config .get ('encryption_password' , '' ) )
171173 )
172174
173175 if hostname := args_config .get ('hostname' , '' ):
@@ -192,8 +194,12 @@ def from_config(cls, args_config: dict[str, Any]) -> 'ArchConfig':
192194 if services := args_config .get ('services' , []):
193195 arch_config .services = services
194196
197+ # DEPRECATED: backwards compatibility
195198 if root_password := args_config .get ('!root-password' , None ):
196- arch_config .root_password = root_password
199+ arch_config .root_enc_password = Password (plaintext = root_password )
200+
201+ if enc_password := args_config .get ('root_enc_password' , None ):
202+ arch_config .root_enc_password = Password (enc_password = enc_password )
197203
198204 if custom_commands := args_config .get ('custom_commands' , []):
199205 arch_config .custom_commands = custom_commands
0 commit comments