Merge firstboot logic into subiquity proper; make it generic enough to work for both the installer and firstboot cases.

This commit is contained in:
Mathieu Trudel-Lapierre 2016-06-23 23:27:09 +03:00
parent 346d4fa37d
commit d4f1ed1951
8 changed files with 42 additions and 11 deletions

View File

@ -1,5 +1,5 @@
[Unit]
Description=Ubuntu Snappy Firstboot Configuration Getty %I
Description=Ubuntu Core Firstboot Configuration %I
After=systemd-user-sessions.service plymouth-quit-wait.service
ExecPreStart=systemctl stop getty@%I
After=rc-local.service

View File

@ -1,5 +1,5 @@
[Unit]
Description=Ubuntu Snappy Firstboot Configuration Getty %I
Description=Ubuntu Core Firstboot Configuration %I
BindsTo=dev-%i.device
#After=getty@tty.service
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service

View File

@ -36,7 +36,7 @@ class IdentityController(ControllerPolicy):
def login(self):
log.debug("Identity login view")
title = ("Snappy Ubuntu Core Pre-ownership Configuration Complete")
title = ("Configuration Complete")
footer = ("View configured user and device access methods")
self.ui.set_header(title)
self.ui.set_footer(footer)

View File

@ -25,7 +25,7 @@ class LoginController(ControllerPolicy):
self.model = LoginModel()
def login(self):
title = "Snappy Ubuntu Core Pre-ownership Configuration Complete"
title = "Configuration Complete"
excerpt = "Your device is now configured. Login details below."
self.ui.set_header(title, excerpt)
view = LoginView(self.model, self.signal, self.model.user)

View File

@ -25,10 +25,10 @@ class WelcomeController(ControllerPolicy):
self.model = WelcomeModel()
def welcome(self):
title = "Ubuntu Core - Firstboot Configuration"
excerpt = "Welcome to snappy Ubuntu Core, a transactionally updated Ubuntu. It's a brave new world here in snappy Ubuntu Core! This machine has not been configured. Please continue to configure this device for use."
title = "Wilkommen! Bienvenue! Welcome! Zdrastvutie! Welkom!"
excerpt = "Please choose your preferred language"
footer = ("Use UP, DOWN arrow keys, and ENTER, to "
"configure your device.")
"select your language.")
self.ui.set_header(title, excerpt)
self.ui.set_footer(footer)
view = WelcomeView(self.model, self.signal)

View File

@ -98,7 +98,7 @@ def curtin_configure_user(userinfo, dryrun=False):
userinfo.update({'target': target})
ssh_id = userinfo.get('ssh_import_id')
if ssh_id.startswith('sso'):
log.info('call out to snappyd login')
log.info('call out to SSO login')
else:
ssh_import_id = "ssh-import-id -o "
ssh_import_id += "{target} {ssh_import_id}".format(**userinfo)
@ -153,7 +153,7 @@ def curtin_write_postinst_config(userinfo):
# firstboot doesn't get hostinfo; but it's still present in the template
config = {
'users': curtin_userinfo_to_config(userinfo),
'hostinfo': '',
'hostinfo': curtin_hostinfo_to_config(userinfo),
}
with open(POST_INSTALL_CONFIG_FILE, 'w') as conf:

View File

@ -84,6 +84,25 @@ class IdentityView(ViewPolicy):
],
dividechars=4
),
Columns(
[
("weight", 0.2, Text("Your server's name:",
align="right")),
("weight", 0.3,
Color.string_input(self.hostname,
focus_map="string_input focus"))
],
dividechars=4
),
Columns(
[
("weight", 0.2, Text("", align="right")),
("weight", 0.3, Color.info_minor(
Text("The name it uses when it talks to "
"other computers", align="left"))),
],
dividechars=4
),
Columns(
[
("weight", 0.2, Text("Pick a username:", align="right")),
@ -152,6 +171,17 @@ class IdentityView(ViewPolicy):
self.realname.value = ""
return
if len(self.hostname.value) < 1:
self.error.set_text("Server name missing.")
self.hostname.value = ""
return
if len(self.hostname.value) > HOSTNAME_MAXLEN:
self.error.set_text("Server name too long, must be < " +
str(HOSTNAME_MAXLEN))
self.hostname.value = ""
return
if len(self.username.value) < 1:
self.error.set_text("Username missing.")
self.username.value = ""
@ -186,6 +216,7 @@ class IdentityView(ViewPolicy):
log.debug("*crypted* User input: {} {} {}".format(
self.username.value, cpassword, cpassword))
result = {
"hostname": self.hostname.value,
"realname": self.realname.value,
"username": self.username.value,
"password": cpassword,

View File

@ -59,8 +59,8 @@ class WelcomeView(ViewPolicy):
def confirm(self, result):
self.model.selected_language = result.label
log.debug('calling network')
self.signal.emit_signal('menu:network:main')
log.debug('calling installpath')
self.signal.emit_signal('menu:installpath:main')
def cancel(self, button):
raise SystemExit("No language selected, exiting as there are no "