2021-07-13 12:39:44 +00:00
|
|
|
# Copyright 2021 Canonical, Ltd.
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
import logging
|
2022-05-24 16:58:13 +00:00
|
|
|
import os
|
2021-07-13 12:39:44 +00:00
|
|
|
import sys
|
|
|
|
|
2022-05-24 16:58:13 +00:00
|
|
|
from subiquitycore.lsb_release import lsb_release
|
2021-07-13 12:39:44 +00:00
|
|
|
from subiquity.client.client import SubiquityClient
|
|
|
|
|
|
|
|
log = logging.getLogger('system_setup.client.client')
|
|
|
|
|
2022-05-24 16:58:13 +00:00
|
|
|
ABOUT_UBUNTU_WSL = _("""
|
2022-05-24 17:21:18 +00:00
|
|
|
Welcome to the {id} Installer!
|
2022-05-24 16:58:13 +00:00
|
|
|
|
|
|
|
A full Ubuntu environment, deeply integrated with Windows,
|
|
|
|
for Linux application development and execution.
|
|
|
|
Optimised for cloud, web, data science, IOT and fun!
|
|
|
|
|
2022-05-24 17:21:18 +00:00
|
|
|
The installer will guide you through installing {description}.
|
2022-05-24 16:58:13 +00:00
|
|
|
|
|
|
|
The installer only requires the up and down arrow keys, space (or
|
|
|
|
return) and the occasional bit of typing.
|
|
|
|
|
|
|
|
This is version {snap_version} of the installer.
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
|
|
def _about_msg(msg, dry_run):
|
|
|
|
info = lsb_release(dry_run=dry_run)
|
2022-05-24 17:21:18 +00:00
|
|
|
newId = info["id"] + " WSL"
|
2022-05-24 16:58:13 +00:00
|
|
|
info.update({
|
2022-05-24 17:21:18 +00:00
|
|
|
'id': newId,
|
|
|
|
'description': info["description"].replace(info["id"], newId),
|
|
|
|
'snap_version': os.environ.get("SNAP_VERSION", "SNAP_VERSION")
|
2022-05-24 16:58:13 +00:00
|
|
|
})
|
|
|
|
return msg.format(**info)
|
|
|
|
|
2021-07-13 12:39:44 +00:00
|
|
|
|
|
|
|
class SystemSetupClient(SubiquityClient):
|
|
|
|
|
2021-07-22 16:49:12 +00:00
|
|
|
from system_setup.client import controllers as controllers_mod
|
|
|
|
|
2021-07-13 12:39:44 +00:00
|
|
|
snapd_socket_path = None
|
|
|
|
|
2021-09-01 08:44:37 +00:00
|
|
|
variant = "wsl_setup"
|
2021-09-03 07:38:50 +00:00
|
|
|
cmdline = sys.argv
|
|
|
|
dryrun_cmdline_module = 'system_setup.cmd.tui'
|
2021-09-01 08:44:37 +00:00
|
|
|
|
2021-07-13 12:39:44 +00:00
|
|
|
controllers = [
|
|
|
|
"Welcome",
|
|
|
|
"WSLIdentity",
|
2021-08-31 10:54:15 +00:00
|
|
|
"WSLConfigurationBase",
|
2021-09-01 17:06:50 +00:00
|
|
|
"Summary",
|
2021-09-20 06:37:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
variant_to_controllers = {
|
|
|
|
"wsl_setup": controllers,
|
|
|
|
"wsl_configuration": [
|
|
|
|
"WSLConfigurationBase",
|
|
|
|
"WSLConfigurationAdvanced",
|
|
|
|
"Summary",
|
2021-07-13 12:39:44 +00:00
|
|
|
]
|
2021-09-20 06:37:55 +00:00
|
|
|
}
|
2022-05-24 16:58:13 +00:00
|
|
|
|
|
|
|
def __init__(self, opts):
|
2022-05-26 10:37:35 +00:00
|
|
|
super().__init__(opts, _about_msg(ABOUT_UBUNTU_WSL, opts.dry_run))
|