Merge pull request #1 from qudiqudi/delete-feature
Delete feature added by @moguls753 and @qudiqudi
This commit is contained in:
commit
5bd1edde89
|
@ -185,7 +185,7 @@ def start_jail(jail_name):
|
||||||
|
|
||||||
print(dedent(f"""
|
print(dedent(f"""
|
||||||
Starting jail with the following command:
|
Starting jail with the following command:
|
||||||
|
|
||||||
{shlex.join(cmd)}
|
{shlex.join(cmd)}
|
||||||
|
|
||||||
Starting jail with name: {jail_name}
|
Starting jail with name: {jail_name}
|
||||||
|
@ -409,7 +409,7 @@ def create_jail(jail_name):
|
||||||
|
|
||||||
print(dedent(f"""
|
print(dedent(f"""
|
||||||
{YELLOW}{BOLD}WARNING: CHECK SYNTAX{NORMAL}
|
{YELLOW}{BOLD}WARNING: CHECK SYNTAX{NORMAL}
|
||||||
|
|
||||||
You may pass additional flags to systemd-nspawn.
|
You may pass additional flags to systemd-nspawn.
|
||||||
With incorrect flags the jail may not start.
|
With incorrect flags the jail may not start.
|
||||||
It is possible to correct/add/remove flags post-install.
|
It is possible to correct/add/remove flags post-install.
|
||||||
|
@ -497,7 +497,7 @@ def create_jail(jail_name):
|
||||||
os.path.join(jail_rootfs_path, 'sbin/init'))) != "systemd":
|
os.path.join(jail_rootfs_path, 'sbin/init'))) != "systemd":
|
||||||
print(dedent(f"""
|
print(dedent(f"""
|
||||||
{YELLOW}{BOLD}WARNING: DISTRO NOT SUPPORTED{NORMAL}
|
{YELLOW}{BOLD}WARNING: DISTRO NOT SUPPORTED{NORMAL}
|
||||||
|
|
||||||
Chosen distro appears not to use systemd...
|
Chosen distro appears not to use systemd...
|
||||||
|
|
||||||
You probably will not get a shell with:
|
You probably will not get a shell with:
|
||||||
|
@ -617,14 +617,18 @@ def delete_jail(jail_name):
|
||||||
"""
|
"""
|
||||||
Delete jail with given name.
|
Delete jail with given name.
|
||||||
"""
|
"""
|
||||||
# stop the jail
|
|
||||||
os.system(f"machinectl stop {jail_name}")
|
|
||||||
|
|
||||||
jail_path = os.path.join(JAILS_DIR_PATH, jail_name)
|
jail_path = os.path.join(JAILS_DIR_PATH, jail_name)
|
||||||
|
|
||||||
if os.path.isdir(jail_path):
|
check = input(f"CAUTION: Type \"{jail_name}\" to confirm! \n") or ""
|
||||||
eprint(f"Cleaning up: {jail_path}")
|
if check == jail_name:
|
||||||
shutil.rmtree(jail_path)
|
if os.path.isdir(jail_path):
|
||||||
|
os.system(f"machinectl stop {jail_name}")
|
||||||
|
eprint(f"Cleaning up: {jail_path}")
|
||||||
|
shutil.rmtree(jail_path)
|
||||||
|
else:
|
||||||
|
eprint(f"A jail with name {jail_name} does not exist.")
|
||||||
|
else:
|
||||||
|
eprint("Wrong name, nothing happens.")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue