diff --git a/get.sh b/get.sh index 913990c627..9cb502cd8b 100755 --- a/get.sh +++ b/get.sh @@ -319,12 +319,16 @@ getBinaryOpenjdk() if [ -d "$SDKDIR/openjdkbinary/j2sdk-image/jre" ]; then extract_dir="./j2sdk-image/jre" fi - echo "unzip $jar_name in $extract_dir..." + echo "Uncompressing $jar_name over $extract_dir..." if [[ $jar_name == *zip || $jar_name == *jar ]]; then unzip -q $jar_name -d $extract_dir else - # some debug-image tar has parent folder. --strip 1 is used to remove it - gzip -cd $jar_name | tar xof - -C $extract_dir --strip 1 + # some debug-image tar has parent folder ... strip it + if tar --version 2>&1 | grep GNU 2>&1; then + gzip -cd $jar_name | tar xof - -C $extract_dir --strip 1 + else + mkdir dir.$$ && cd dir.$$ && gzip -cd ../$jar_name | tar xof - && cd * && tar cf - . | (cd ../../$extract_dir && tar xpf -) && cd ../.. && rm -rf dir.$$ + fi fi else if [ -d "$SDKDIR/openjdkbinary/tmp" ]; then @@ -332,7 +336,7 @@ getBinaryOpenjdk() else mkdir $SDKDIR/openjdkbinary/tmp fi - echo "unzip file: $jar_name ..." + echo "Uncompressing file: $jar_name ..." if [[ $jar_name == *zip || $jar_name == *jar ]]; then unzip -q $jar_name -d ./tmp elif [[ $jar_name == *.pax* ]]; then