Streamline archive extraction

This commit is contained in:
Manuel Thalmann 2024-07-23 12:52:30 +02:00
parent ab28605732
commit 15742f29e1

View file

@ -49,17 +49,35 @@ begin
set -l url "$entry[2]" set -l url "$entry[2]"
set -l type "$entry[3]" set -l type "$entry[3]"
set -l dir "$entry[4]" set -l dir "$entry[4]"
set -l downloadPath "$cacheDir/$name.$type" set -l file "$cacheDir/$name.$type"
set -l target "$winpeOverlay/$name"
set -a files \ set -a files \
"$downloadPath" \ "$file" \
"$dir" \ "$dir" \
"$name" "$name"
mkdir -p (dirname "$downloadPath") mkdir -p (dirname "$file")
if [ ! -f "$downloadPath" ] if [ ! -f "$file" ]
curl -L "$url" -o "$downloadPath" curl -L "$url" -o "$file"
end
begin
set -l tempDir (mktemp -d)
switch $type
case zip
unzip "$file" -d "$tempDir"
case exe
pushd "$tempDir" > /dev/null
7z x "$file"
popd > /dev/null
end
mkdir -p (dirname "$target")
cp -r "$tempDir/$dir" "$target"
rm -rf "$tempDir"
end end
end end
@ -69,41 +87,6 @@ begin
set -l pwsh $files[10..12] set -l pwsh $files[10..12]
cp -r "$dir/winfs"/* "$winpeOverlay" cp -r "$dir/winfs"/* "$winpeOverlay"
mkdir -p "$winpeOverlay/drivers"
begin
set -l tempDir (mktemp -d)
unzip "$intel[1]" -d "$tempDir"
mkdir -p (dirname "$winpeOverlay/$intel[3]")
cp -r "$tempDir/$intel[2]" "$winpeOverlay/$intel[3]"
rm -rf "$tempDir"
end
begin
set -l tempDir (mktemp -d)
unzip "$marvell[1]" -d "$tempDir"
mkdir -p (dirname "$winpeOverlay/$marvell[3]")
cp -r "$tempDir/$marvell[2]" "$winpeOverlay/$marvell[3]"
rm -rf "$tempDir"
end
begin
set -l tempDir (mktemp -d)
pushd "$tempDir" > /dev/null
7z x "$git[1]"
popd > /dev/null
mkdir -p (dirname "$winpeOverlay/$git[3]")
cp -r "$tempDir/$git[2]" "$winpeOverlay/$git[3]"
rm -rf "$tempDir"
end
begin
set -l tempDir (mktemp -d)
unzip "$pwsh[1]" -d "$tempDir"
mkdir -p (dirname "$winpeOverlay/$pwsh[3]")
cp -r "$tempDir/$pwsh[2]" "$winpeOverlay/$pwsh[3]"
rm -rf "$tempDir"
end
mkdir -p "$(dirname "$isoFile")" mkdir -p "$(dirname "$isoFile")"
sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath" sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath"