cabextract: keep old symlink behaviour

Implemented additional checks to keep the old symlink behaviour when using cabextract >= 1.10.
This commit is contained in:
Dimitri Lesy 2023-02-12 15:03:07 +01:00 committed by GitHub
parent 590a19f6de
commit 4173a79279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,6 +374,10 @@ function errorHandler() {
fi fi
} }
function version() {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'
}
if [ -e ISODIR ]; then if [ -e ISODIR ]; then
rm -rf ISODIR rm -rf ISODIR
fi fi
@ -418,12 +422,18 @@ if [ $runVirtualEditions -eq 1 ] && [ "$VIRTUAL_EDITIONS_PLUGIN_LOADED" != "1" ]
fi fi
echo "" echo ""
cabextractVersion=$(cabextract --version | cut -d ' ' -f 3)
if [ $(version $cabextractVersion) -ge $(version "1.10") ] ; then
keepSymlinks="-k"
else
keepSymlinks=""
fi
for file in `find "$uupDir" -type f -iname "*.cab" -not -iname "*windows1*-kb*.cab" -not -iname "ssu-*.cab" -not -iname "*desktopdeployment*.cab" -not -iname "*aggregatedmetadata*.cab"`; do for file in `find "$uupDir" -type f -iname "*.cab" -not -iname "*windows1*-kb*.cab" -not -iname "ssu-*.cab" -not -iname "*desktopdeployment*.cab" -not -iname "*aggregatedmetadata*.cab"`; do
fileName=`basename $file .cab` fileName=`basename $file .cab`
echo -e "$infoColor""CAB -> ESD:""$resetColor"" $fileName" echo -e "$infoColor""CAB -> ESD:""$resetColor"" $fileName"
mkdir "$extractDir" mkdir "$extractDir"
cabextract -d "$extractDir" "$file" >/dev/null 2>/dev/null cabextract "$keepSymlinks" -d "$extractDir" "$file" >/dev/null 2>/dev/null
errorHandler $? "Failed to extract $fileName.cab" errorHandler $? "Failed to extract $fileName.cab"
wimlib-imagex capture "$extractDir" "$tempDir/$fileName.esd" \ wimlib-imagex capture "$extractDir" "$tempDir/$fileName.esd" \