Skip to content

Instantly share code, notes, and snippets.

@blluv
Last active December 7, 2023 02:10
Show Gist options
  • Save blluv/bc4da5fcffe45353be39b70197679ed1 to your computer and use it in GitHub Desktop.
Save blluv/bc4da5fcffe45353be39b70197679ed1 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Usage: $0 {pack|unpack} cpio.gz-file dest"
exit -1
fi
if [ $1 = "pack" ]; then
(cd $3 && find . -print0 | cpio -o -H newc --null) | gzip -9 > $2
fi
if [ $1 = "unpack" ]; then
mkdir -p $3
gzip -cd $2 | (cd $3 && cpio -idmv)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment