fix: cpio modification not working
This commit is contained in:
@@ -97,6 +97,7 @@ def extract_iso(path_to_output_dir, path_to_input_file):
|
|||||||
"-extract", "/",
|
"-extract", "/",
|
||||||
path_to_output_dir.resolve()
|
path_to_output_dir.resolve()
|
||||||
],
|
],
|
||||||
|
capture_output=True,
|
||||||
check=True)
|
check=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
@@ -164,12 +165,17 @@ def append_file_contents_to_initrd_archive(path_to_initrd_archive,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# append contents of input_file to extracted archive using cpio
|
# append contents of input_file to extracted archive using cpio
|
||||||
subprocess.run(
|
# NOTE cpio must be called from within the input file's parent
|
||||||
["echo", str(path_to_input_file.resolve()),
|
# directory, and the input file's name is piped into it
|
||||||
"|", "cpio", "-H", "newc", "-o", "-A",
|
completed_process = subprocess.Popen(
|
||||||
"-F", str(path_to_initrd_extracted.resolve())],
|
["cpio", "-H", "newc", "-o", "-A",
|
||||||
shell=True,
|
"-F", str(path_to_initrd_extracted.resolve())],
|
||||||
check=True)
|
cwd=path_to_input_file.resolve().parent,
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
completed_process.communicate(
|
||||||
|
input=str(path_to_input_file.name).encode())
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
raise RuntimeError(f"Failed while appending contents of "
|
raise RuntimeError(f"Failed while appending contents of "
|
||||||
@@ -397,6 +403,7 @@ def repack_iso(path_to_output_iso,
|
|||||||
"-e", "boot/grub/efi.img", "-no-emul-boot",
|
"-e", "boot/grub/efi.img", "-no-emul-boot",
|
||||||
"-isohybrid-gpt-basdat", "-isohybrid-apm-hfsplus",
|
"-isohybrid-gpt-basdat", "-isohybrid-apm-hfsplus",
|
||||||
path_to_input_files_root_dir.resolve()],
|
path_to_input_files_root_dir.resolve()],
|
||||||
|
capture_output=True,
|
||||||
check=True)
|
check=True)
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
|||||||
12
udib/udib.py
12
udib/udib.py
@@ -155,7 +155,7 @@ def _chmod_recursively(input_path, mode):
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
# FIXME capture ISO filesystem name
|
# FIXME capture ISO filesystem name
|
||||||
iso_filesystem_name = "Debian 11.3.0 UDIB"
|
iso_filesystem_name = "Debian UDIB"
|
||||||
|
|
||||||
parser = _get_argument_parser()
|
parser = _get_argument_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -277,9 +277,13 @@ def main():
|
|||||||
|
|
||||||
# append preseed file to extracted initrd
|
# append preseed file to extracted initrd
|
||||||
p.info("Appending preseed file...")
|
p.info("Appending preseed file...")
|
||||||
modiso.append_file_contents_to_initrd_archive(
|
# make a temporary copy called 'preseed.cfg'
|
||||||
path_to_extracted_iso_dir/"install.amd"/"initrd.gz",
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
path_to_preseed_file)
|
path_to_renamed_preseed_file = Path(tmpdir).resolve()/"preseed.cfg"
|
||||||
|
shutil.copy(path_to_preseed_file, path_to_renamed_preseed_file)
|
||||||
|
modiso.append_file_contents_to_initrd_archive(
|
||||||
|
path_to_extracted_iso_dir/"install.amd"/"initrd.gz",
|
||||||
|
path_to_renamed_preseed_file)
|
||||||
|
|
||||||
# regenerate md5sum.txt
|
# regenerate md5sum.txt
|
||||||
p.info("Regenerating MD5 checksum...")
|
p.info("Regenerating MD5 checksum...")
|
||||||
|
|||||||
Reference in New Issue
Block a user