Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 79 lines (70 sloc) 1.61 KB
#!/bin/sh
. config/options
if [ -z "$3" ]; then
echo "usage: $0 package_name file_pattern target_dir"
exit 1
fi
get_meta $1
[ ! -f "$PACKAGE_URL" ] && [ -z "$PKG_URL" ] && exit 1
[ ! -d "$SOURCES/$1" ] || [ ! -d "$3" ] && exit 1
if [ -n "$PKG_URL_PROTO" ]; then
REPO_BASENAME=$PKG_NAME-$PKG_VERSION
FILES=$REPO_BASENAME.tar.bz2
elif [ -n "$PKG_ARCHIVE_NAME" ]; then
REPO_BASENAME=$PKG_NAME-$PKG_VERSION
FILES=$PKG_ARCHIVE_NAME
else
[ -f "$PACKAGE_URL" ] && \
FILES=`sed 's%.*/\(.*\)\$%\1%' $PACKAGE_URL`
[ -n "$PKG_URL" ] && \
for url in $PKG_URL; do
FILES="$FILES `echo $url | sed 's%.*/\(.*\)\$%\1%'`"
done
fi
for s in $FILES; do
case $s in
$2)
f="$SOURCES/$1/$s"
if [ ! -f $f ]; then
echo "error: File $s doesn't exist in package $1 sources directory"
echo "have you called scripts/extract before scripts/get ?"
exit 1
fi
case $s in
*.tar)
tar xf $f -C $3
;;
*.tar.xz | *.txz)
tar xJf $f -C $3
;;
*.tar.bz* | *.tbz)
tar xjf $f -C $3
;;
*.tar.gz | *.tgz)
tar xzf $f -C $3
;;
*.diff | *.patch)
cat $f | patch -d $3 -p1
;;
*.diff.bz2 | *.patch.bz2 | patch-*.bz2)
bzcat $f | patch -d $3 -p1
;;
*.diff.gz | *.patch.gz | patch-*.gz)
zcat $f | patch -d $3 -p1
;;
*.zip)
unzip $f -d $3
;;
*.deb)
DEB_DATA=data.tar.gz
ar x $f $DEB_DATA
tar xzf $DEB_DATA -C $3
rm $DEB_DATA
;;
*)
cp -pPR $f $3
;;
esac
;;
esac
done