remove references to firstboot (an old name for console-conf?)
This commit is contained in:
parent
7bbafb438a
commit
2408dda6c7
|
@ -46,10 +46,6 @@ def parse_options(argv):
|
|||
parser.add_argument('--dry-run', action='store_true',
|
||||
dest='dry_run',
|
||||
help='menu-only, do not call installer function')
|
||||
# XXX Defaults to firstboot mode unless one runs subiquity --install.
|
||||
parser.add_argument('--install', action='store_false',
|
||||
dest='firstboot', default=True,
|
||||
help='run installer in firstboot mode')
|
||||
parser.add_argument('--serial', action='store_true',
|
||||
dest='run_on_serial',
|
||||
help='Run the installer over serial console.')
|
||||
|
|
|
@ -53,10 +53,6 @@ def parse_options(argv):
|
|||
parser.add_argument('--dry-run', action='store_true',
|
||||
dest='dry_run',
|
||||
help='menu-only, do not call installer function')
|
||||
# XXX Defaults to firstboot mode unless one runs subiquity --install.
|
||||
parser.add_argument('--install', action='store_false',
|
||||
dest='firstboot', default=True,
|
||||
help='run installer in firstboot mode')
|
||||
parser.add_argument('--serial', action='store_true',
|
||||
dest='run_on_serial',
|
||||
help='Run the installer over serial console.')
|
||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
|||
|
||||
from subiquitycore.controller import BaseController
|
||||
from subiquitycore.models import IdentityModel
|
||||
from subiquitycore.utils import disable_first_boot_service, run_command
|
||||
from subiquitycore.utils import disable_console_conf, run_command
|
||||
|
||||
from console_conf.ui.views import IdentityView, LoginView
|
||||
|
||||
|
@ -182,6 +182,6 @@ class IdentityController(BaseController):
|
|||
def login_done(self):
|
||||
if not self.opts.dry_run:
|
||||
# stop the console-conf services (this will kill the current process).
|
||||
disable_first_boot_service()
|
||||
disable_console_conf()
|
||||
|
||||
self.signal.emit_signal('quit')
|
||||
|
|
63
firstboot.md
63
firstboot.md
|
@ -1,63 +0,0 @@
|
|||
Firstboot
|
||||
---------
|
||||
|
||||
Firstboot is a tui that runs on the device's getty interfaces when a
|
||||
system has not yet been configured. It displays the current network
|
||||
configuration and allows user to modify that. It also collects
|
||||
user information used to create a local user and import ssh public keys
|
||||
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
Install pre-reqs:
|
||||
|
||||
% sudo apt-get update && sudo apt-get install qemu-system-x86 cloud-image-utils
|
||||
|
||||
Download the firstboot image and startup script
|
||||
|
||||
% wget http://people.canonical.com/~rharper/firstboot/firstboot.sh
|
||||
% chmod +x ./firstboot.sh
|
||||
% wget http://people.canonical.com/~rharper/firstboot/firstboot.raw.xz
|
||||
% unxz firstboot.raw.xz
|
||||
% ./firstboot.sh
|
||||
|
||||
This will launch the firstboot image under KVM using userspace networking
|
||||
The main console will open in a new window, the serial console is available via
|
||||
telnet session (telnet localhost 2447).
|
||||
|
||||
|
||||
When firstboot displays the ssh URL, in the demo, since we're using qemu user
|
||||
networking, we can't ssh directly to the VM, instead we redirect the guest's ssh
|
||||
port 22 to host port 2222; this is a limitation of the demo. When ssh'ing to
|
||||
the guest, use:
|
||||
|
||||
ssh -p 2222 <user>@localhost
|
||||
|
||||
|
||||
How it works
|
||||
------------
|
||||
|
||||
The firstboot program is launched after the getty service is available, and
|
||||
disables getty on any tty and instead spawns the firstboot program. It will
|
||||
remain available until one of the firstboot instances successfully completes.
|
||||
After completion, firstboot will disable itself and re-enable getty services.
|
||||
|
||||
firstboot is based on subiquity, just pulling out a few of the panels and
|
||||
reusing certain parts. The networking information is probed from the host
|
||||
and allows user configuration. After completion of configuration, firstboot
|
||||
uses the ``ip`` command to apply the new network config to the network devices
|
||||
present. Long term, we'll supply network-config yaml to snappy or whatever
|
||||
network configuration tool will be present and be responsible for bringing
|
||||
networking up to the desired state.
|
||||
|
||||
For identity, we collect realname, username, password (and crypt it), and a
|
||||
"ssh_import_id" URL. The ``ssh-import-id`` binary already supports both
|
||||
launchpad (lp:) and github (gh:). In the demo, I added mock SSO support (sso:)
|
||||
and this would trigger a call out to snappy login or what ever the right tool
|
||||
to initiate a connection to the SSO for authentication and retrieval of the
|
||||
user's ssh keys.
|
||||
|
||||
After collecting the input, we run ``ip``, ``useradd`` and ``ssh-import-id``
|
||||
and display the current config, including ssh url. After selecting "Finish"
|
||||
We restore the normal getty prompt from which the newly created user can login.
|
23
firstboot.sh
23
firstboot.sh
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
BOOT=firstboot.raw
|
||||
SEED=seed.img
|
||||
|
||||
[ ! -e ${SEED} ] && {
|
||||
cat > user-data <<EOF
|
||||
#cloud-config
|
||||
password: passw0rd
|
||||
chpasswd: { expire: False }
|
||||
ssh_pwauth: True
|
||||
EOF
|
||||
echo "instance-id: $(uuidgen || echo i-abcdefg)" > meta-data
|
||||
cloud-localds ${SEED} user-data meta-data
|
||||
}
|
||||
|
||||
qemu-system-x86_64 -m 1024 --enable-kvm \
|
||||
-snapshot \
|
||||
-drive file=${BOOT},format=raw,if=virtio \
|
||||
-net user -net nic,model=virtio \
|
||||
-redir tcp:2222::22 \
|
||||
-cdrom $SEED \
|
||||
-monitor stdio \
|
||||
-serial telnet:localhost:2447,nowait,server
|
|
@ -102,7 +102,6 @@ def curtin_hostinfo_to_config(hostinfo):
|
|||
|
||||
|
||||
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': curtin_hostinfo_to_config(userinfo),
|
||||
|
|
|
@ -60,8 +60,8 @@ def create_user(userinfo, dryrun=False, extra_args=[]):
|
|||
run_command(chown, shell=False)
|
||||
|
||||
# add sudo rule
|
||||
with open('/etc/sudoers.d/firstboot-user', 'w') as fh:
|
||||
fh.write('# firstboot config added user\n\n')
|
||||
with open('/etc/sudoers.d/installer-user', 'w') as fh:
|
||||
fh.write('# installer added user\n\n')
|
||||
fh.write('{} ALL=(ALL) NOPASSWD:ALL\n'.format(username))
|
||||
else:
|
||||
log.info('dry-run, skiping user configuration')
|
||||
log.info('dry-run, skipping user configuration')
|
||||
|
|
|
@ -159,9 +159,9 @@ def crypt_password(passwd, algo='SHA-512'):
|
|||
return crypt.crypt(passwd, algos[algo] + salt)
|
||||
|
||||
|
||||
def disable_first_boot_service():
|
||||
""" Stop firstboot service; which also restores getty service """
|
||||
log.info('disabling first boot service')
|
||||
def disable_console_conf():
|
||||
""" Stop console-conf service; which also restores getty service """
|
||||
log.info('disabling console-conf service')
|
||||
run_command(["systemctl", "stop", "--no-block", "console-conf@*.service", "serial-console-conf@*.service"])
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue