Ask startup question earlier
This commit is contained in:
parent
7be1c7c7d2
commit
930e9568d4
17
jlmkr.py
17
jlmkr.py
|
@ -266,6 +266,7 @@ def shell_jail(args):
|
||||||
"""
|
"""
|
||||||
return subprocess.run(["machinectl", "shell"] + args).returncode
|
return subprocess.run(["machinectl", "shell"] + args).returncode
|
||||||
|
|
||||||
|
|
||||||
def parse_config_string(config_string):
|
def parse_config_string(config_string):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
# Workaround to read config file without section headers
|
# Workaround to read config file without section headers
|
||||||
|
@ -960,6 +961,11 @@ def create_jail(jail_name="", config_path=None, distro="debian", release="bookwo
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print()
|
||||||
|
start_now = agree(
|
||||||
|
"Do you want to start this jail now (when create is done)?", "y"
|
||||||
|
)
|
||||||
|
|
||||||
# Use mostly default settings for systemd-nspawn but with systemd-run instead of a service file:
|
# Use mostly default settings for systemd-nspawn but with systemd-run instead of a service file:
|
||||||
# https://github.com/systemd/systemd/blob/main/units/systemd-nspawn%40.service.in
|
# https://github.com/systemd/systemd/blob/main/units/systemd-nspawn%40.service.in
|
||||||
# Use TasksMax=infinity since this is what docker does:
|
# Use TasksMax=infinity since this is what docker does:
|
||||||
|
@ -1206,16 +1212,7 @@ def create_jail(jail_name="", config_path=None, distro="debian", release="bookwo
|
||||||
cleanup(jail_path)
|
cleanup(jail_path)
|
||||||
raise error
|
raise error
|
||||||
|
|
||||||
# In case you want to create a jail without any user interaction,
|
if start_now:
|
||||||
# you need to skip this final question
|
|
||||||
# echo 'y' | jlmkr create test testconfig
|
|
||||||
# TODO: make jlmkr create work cleanly without user interaction.
|
|
||||||
# Current echo 'y' workaround may cause problems when the jail name already exists
|
|
||||||
# You'd end up with a new jail called 'y'
|
|
||||||
# and the script will crash at the agree statement below
|
|
||||||
# TODO: move this question higher, above the actual creating bit
|
|
||||||
print()
|
|
||||||
if agree(f"Do you want to start jail {jail_name} right now?", "y"):
|
|
||||||
return start_jail(jail_name)
|
return start_jail(jail_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue