fix: add unrar-free, use 7z for .zip extraction (more reliable)

- Added unrar-free package to backend installer
- Added .rar to archive extension detection
- Changed .zip extraction from unzip → 7z (x -y)
  7z handles .zip, .7z, and other formats with one tool
- Added unrar handler for .rar files
This commit is contained in:
Claus Lohmar 2026-07-21 19:37:27 +00:00
parent 5e786533b1
commit 6ba7944bb2
2 changed files with 4 additions and 2 deletions

View file

@ -19,7 +19,7 @@ STAGING_OUT = Path("/mnt/converter/out")
DISK_EXTENSIONS = {".vmdk", ".qcow2", ".qcow", ".img", ".raw", ".vhd", ".vhdx"} DISK_EXTENSIONS = {".vmdk", ".qcow2", ".qcow", ".img", ".raw", ".vhd", ".vhdx"}
ARCHIVE_EXTENSIONS = {".7z", ".zip", ".tar.gz", ".tgz", ".tar", ".gz", ".bz2", ".xz"} ARCHIVE_EXTENSIONS = {".7z", ".zip", ".rar", ".tar.gz", ".tgz", ".tar", ".gz", ".bz2", ".xz"}
MIN_DISK_BYTES = 1024 MIN_DISK_BYTES = 1024
@ -56,7 +56,8 @@ def extract_if_needed(filename: str) -> Path:
# Determine extraction tool # Determine extraction tool
tool_map = { tool_map = {
".7z": ("7z", ["7z", "x", "-y", str(filepath)]), ".7z": ("7z", ["7z", "x", "-y", str(filepath)]),
".zip": ("unzip", ["unzip", "-o", str(filepath)]), ".zip": ("7z", ["7z", "x", "-y", str(filepath)]),
".rar": ("unrar", ["unrar", "x", "-y", str(filepath)]),
".tar.gz": ("tar", ["tar", "-xzf", str(filepath)]), ".tar.gz": ("tar", ["tar", "-xzf", str(filepath)]),
".tgz": ("tar", ["tar", "-xzf", str(filepath)]), ".tgz": ("tar", ["tar", "-xzf", str(filepath)]),
".tar": ("tar", ["tar", "-xf", str(filepath)]), ".tar": ("tar", ["tar", "-xf", str(filepath)]),

View file

@ -110,6 +110,7 @@ REQUIRED=(
libguestfs-tools "guestfish" libguestfs-tools "guestfish"
p7zip-full "7z" p7zip-full "7z"
unzip "unzip" unzip "unzip"
unrar-free "unrar"
tar "tar" tar "tar"
gzip "gunzip" gzip "gunzip"
bzip2 "bunzip2" bzip2 "bunzip2"