Merge pull request #1 from qudiqudi/delete-feature

Delete feature added by @moguls753 and @qudiqudi
This commit is contained in:
Basti Qdoba 2023-02-27 22:07:29 +01:00 committed by GitHub
commit 5bd1edde89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

16
jlmkr.py Normal file → Executable file
View File

@ -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():