feat(Mainsail): remove Mainsail

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2023-12-21 22:53:41 +01:00
parent cd38970bbd
commit 4915896099
6 changed files with 303 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# ======================================================================= #
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
# ======================================================================= #
import subprocess
from pathlib import Path
from kiauh.utils.logger import Logger
def remove_file(file_path: Path, sudo=False) -> None:
try:
command = f"{'sudo ' if sudo else ''}rm -f {file_path}"
subprocess.run(command, stderr=subprocess.PIPE, check=True, shell=True)
except subprocess.CalledProcessError as e:
log = f"Cannot remove file {file_path}: {e.stderr.decode()}"
Logger.print_error(log)
raise