From 4173a7927957ae463b55f7704d13dec82f81901d Mon Sep 17 00:00:00 2001 From: Dimitri Lesy Date: Sun, 12 Feb 2023 15:03:07 +0100 Subject: [PATCH] cabextract: keep old symlink behaviour Implemented additional checks to keep the old symlink behaviour when using cabextract >= 1.10. --- convert.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/convert.sh b/convert.sh index 0af0072..c81cf57 100755 --- a/convert.sh +++ b/convert.sh @@ -374,6 +374,10 @@ function errorHandler() { fi } +function version() { + echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }' +} + if [ -e ISODIR ]; then rm -rf ISODIR fi @@ -418,12 +422,18 @@ if [ $runVirtualEditions -eq 1 ] && [ "$VIRTUAL_EDITIONS_PLUGIN_LOADED" != "1" ] fi 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 fileName=`basename $file .cab` echo -e "$infoColor""CAB -> ESD:""$resetColor"" $fileName" 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" wimlib-imagex capture "$extractDir" "$tempDir/$fileName.esd" \