...

Text file src/github.com/Microsoft/hcsshim/hack/catcpio.sh

Documentation: github.com/Microsoft/hcsshim/hack

     1#!/bin/sh
     2
     3set -e
     4
     5dir="`mktemp -d`"
     6trap 'rm -rf "$dir"' EXIT
     7
     8for file; do
     9    if ! [ -f "$file" ]; then
    10        echo file not found: "$file"
    11        exit 1
    12    fi
    13    case `file -bz "$file"` in
    14        "ASCII cpio archive"*"(gzip compressed data"*)
    15            gunzip -c "$file" | (cd "$dir" && cpio -iumd) ;;
    16        "ASCII cpio archive"*)
    17            cat "$file" | (cd "$dir" && cpio -iumd) ;;
    18        *)
    19            tar -xf "$file" -C "$dir" ;;
    20    esac
    21done
    22cd "$dir" && find . | cpio --create --format=newc -R 0:0

View as plain text