From f046dd3d3202aa8f377ce0e447e4718959f0db3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schabh=C3=BCttl?= <63157170+mschabhuettl@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:41:55 +0200 Subject: [PATCH] Fix for hostname of LXC not set correctly (#116) * Remove unnecessary script trim in jlmkr * Update download script digest hash * Bump version to 1.1.3 * Remove unused method --------- Co-authored-by: Jip-Hop <2871973+Jip-Hop@users.noreply.github.com> --- jlmkr.py | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/jlmkr.py b/jlmkr.py index 1fcd589..a2d4ec1 100755 --- a/jlmkr.py +++ b/jlmkr.py @@ -4,7 +4,7 @@ with full access to all files via bind mounts, \ thanks to systemd-nspawn!""" -__version__ = "1.1.2" +__version__ = "1.1.3" __disclaimer__ = """USE THIS SCRIPT AT YOUR OWN RISK! IT COMES WITHOUT WARRANTY AND IS NOT SUPPORTED BY IXSYSTEMS.""" @@ -113,7 +113,7 @@ JAILS_DIR_PATH = "jails" JAIL_CONFIG_NAME = "config" JAIL_ROOTFS_NAME = "rootfs" DOWNLOAD_SCRIPT_DIGEST = ( - "d11fc7e5950d0e01bbca89ad8f663a698880ef7f4b0473453ba46a693cec4d12" + "cfcb5d08b24187d108f2ab0d21a6cc4b73dcd7f5d7dfc80803bfd7f1642d638d" ) SCRIPT_PATH = os.path.realpath(__file__) SCRIPT_NAME = os.path.basename(SCRIPT_PATH) @@ -787,22 +787,6 @@ def validate_sha256(file_path, digest): return False -def remove_lines_after_line_number(file_path, line_number): - with open(file_path, "r+") as file: - current_line_number = 1 - - # Read the last line to keep - while current_line_number <= line_number: - file.readline() - current_line_number += 1 - - # Seek to the last line to keep - # https://stackoverflow.com/a/78176770 - file.seek(file.tell()) - # Remove everything after line_number - file.truncate() - - def run_lxc_download_script( jail_name=None, jail_path=None, jail_rootfs_path=None, distro=None, release=None ): @@ -830,9 +814,6 @@ def run_lxc_download_script( lxc_download_script, ) - # Throw away the last part of the download script, jailmaker doesn't need it - remove_lines_after_line_number(lxc_download_script, 404) - if not validate_sha256(lxc_download_script, DOWNLOAD_SCRIPT_DIGEST): eprint("Abort! Downloaded script has unexpected contents.") return 1