return
password, hashed = context.config.root_password or (None, False)
- pwopt = "--root-password-hashed" if hashed else "--root-password"
- pwcred = "passwd.hashed-password.root" if hashed else "passwd.plaintext-password.root"
+ if password and not hashed:
+ password = run(["openssl", "passwd", "-stdin", "-6"],
+ sandbox=context.sandbox(), input=password, stdout=subprocess.PIPE).stdout.strip()
settings = (
- ("--locale", "firstboot.locale", context.config.locale),
- ("--locale-messages", "firstboot.locale-messages", context.config.locale_messages),
- ("--keymap", "firstboot.keymap", context.config.keymap),
- ("--timezone", "firstboot.timezone", context.config.timezone),
- ("--hostname", None, context.config.hostname),
- (pwopt, pwcred, password),
- ("--root-shell", "passwd.shell.root", context.config.root_shell),
+ ("--locale", "firstboot.locale", context.config.locale),
+ ("--locale-messages", "firstboot.locale-messages", context.config.locale_messages),
+ ("--keymap", "firstboot.keymap", context.config.keymap),
+ ("--timezone", "firstboot.timezone", context.config.timezone),
+ ("--hostname", None, context.config.hostname),
+ ("--root-password-hashed", "passwd.hashed-password.root", password),
+ ("--root-shell", "passwd.shell.root", context.config.root_shell),
)
options = []