Created
October 26, 2015 19:38
-
-
Save Ram-Z/9679139f4400025f1512 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 | |
dest=$1 | |
for pkg in *.pkg.tar.xz; do | |
if tar -xaO --force-local -f "$pkg" .PKGINFO | grep -q "gitrepo = $dest"; then | |
echo "$pkg skipped" | |
continue | |
fi | |
pkgbase="${pkg%.tar.xz}" | |
echo -n "$pkg ... " | |
mkdir "$pkgbase" | |
pushd "$pkgbase" > /dev/null | |
sudo tar -xa --force-local -f "../$pkg" | |
sudo sed "s/^\(gitrepo = \).*/\1$dest/" -i .PKGINFO | |
sudo bsdtar cf - $(find . -printf "%P ") | xz -c -z - > "$pkg" | |
popd > /dev/null | |
echo "done" | |
sudo rm -r "$pkgbase" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment