Last active
December 7, 2023 02:10
-
-
Save blluv/bc4da5fcffe45353be39b70197679ed1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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