1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!/bin/sh
set -e
if [ ! -d .git ]; then
echo "not running in a git checkout, skipping"
exit 0
fi
ID="$1"
VERSION_ID="$2"
DST="debian-$ID-$VERSION_ID"
rm -rf $DST
mkdir -p "$DST"
if ! git remote | grep upstream; then
git remote add upstream https://github.com/snapcore/snapd
fi
git fetch upstream
git ls-tree upstream/"$ID"/"$VERSION_ID" debian/ | while read line ; do
file=$(basename $(echo $line | cut -d " " -f4))
hash=$(echo $line | cut -d " " -f3)
type=$(echo $line | cut -d " " -f2)
# FIXME: deal with subdirs
if [ "$type" = "blob" ]; then
git cat-file -p $hash > "$DST/$file"
fi
done
|