2021-07-02 08:26:21 +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/>.
|
|
|
|
|
|
2021-09-27 12:36:25 +00:00
|
|
|
|
from system_setup.common.wsl_utils import is_reconfigure
|
2021-08-31 10:03:01 +00:00
|
|
|
|
from subiquity.server.server import SubiquityServer
|
2021-09-01 08:50:56 +00:00
|
|
|
|
from system_setup.models.system_setup import SystemSetupModel
|
|
|
|
|
from subiquity.models.subiquity import ModelNames
|
|
|
|
|
|
2021-08-31 10:03:01 +00:00
|
|
|
|
import os
|
2021-08-19 15:42:06 +00:00
|
|
|
|
|
|
|
|
|
|
2021-09-01 08:50:56 +00:00
|
|
|
|
INSTALL_MODEL_NAMES = ModelNames({
|
|
|
|
|
"locale",
|
|
|
|
|
"wslconfbase",
|
|
|
|
|
},
|
|
|
|
|
wsl_setup={
|
|
|
|
|
"identity",
|
|
|
|
|
},
|
|
|
|
|
wsl_configuration={
|
|
|
|
|
"wslconfadvanced",
|
|
|
|
|
})
|
|
|
|
|
|
2021-09-03 07:39:32 +00:00
|
|
|
|
POSTINSTALL_MODEL_NAMES = ModelNames(set())
|
2021-09-01 08:50:56 +00:00
|
|
|
|
|
|
|
|
|
|
2021-08-31 10:03:01 +00:00
|
|
|
|
class SystemSetupServer(SubiquityServer):
|
2021-08-19 15:42:06 +00:00
|
|
|
|
|
2021-07-02 08:26:21 +00:00
|
|
|
|
from system_setup.server import controllers as controllers_mod
|
|
|
|
|
controllers = [
|
2021-09-08 15:54:34 +00:00
|
|
|
|
"Early",
|
2021-07-02 08:26:21 +00:00
|
|
|
|
"Reporting",
|
|
|
|
|
"Error",
|
2021-09-27 12:36:25 +00:00
|
|
|
|
"WSLLocale",
|
2021-09-08 15:44:50 +00:00
|
|
|
|
"WSLIdentity",
|
2021-08-31 10:54:15 +00:00
|
|
|
|
"WSLConfigurationBase",
|
|
|
|
|
"WSLConfigurationAdvanced",
|
2021-08-31 10:07:20 +00:00
|
|
|
|
"Configure",
|
|
|
|
|
"Late",
|
2021-08-31 13:43:35 +00:00
|
|
|
|
"SetupShutdown",
|
2021-07-22 16:49:12 +00:00
|
|
|
|
]
|
|
|
|
|
|
2021-09-01 08:44:37 +00:00
|
|
|
|
supported_variants = ["wsl_setup", "wsl_configuration"]
|
|
|
|
|
|
2021-09-20 06:37:55 +00:00
|
|
|
|
def __init__(self, opts, block_log_dir):
|
|
|
|
|
super().__init__(opts, block_log_dir)
|
2021-10-04 20:09:24 +00:00
|
|
|
|
self.echo_syslog_id = ""
|
|
|
|
|
self.event_syslog_id = ""
|
|
|
|
|
self.log_syslog_id = ""
|
2021-09-20 06:37:55 +00:00
|
|
|
|
if is_reconfigure(opts.dry_run):
|
|
|
|
|
self.set_source_variant("wsl_configuration")
|
|
|
|
|
|
2021-07-02 08:26:21 +00:00
|
|
|
|
def make_model(self):
|
|
|
|
|
root = '/'
|
|
|
|
|
if self.opts.dry_run:
|
|
|
|
|
root = os.path.abspath('.subiquity')
|
2021-09-03 01:57:58 +00:00
|
|
|
|
return SystemSetupModel(root, self.hub, INSTALL_MODEL_NAMES,
|
2021-09-01 09:02:25 +00:00
|
|
|
|
POSTINSTALL_MODEL_NAMES)
|
2021-09-20 17:30:36 +00:00
|
|
|
|
|
|
|
|
|
# We don’t have cloudinit in system_setup.
|
|
|
|
|
async def wait_for_cloudinit(self):
|
|
|
|
|
self.cloud_init_ok = True
|
|
|
|
|
return
|