Files
Arch-R/scripts/extract
Stephan Raue 8c6620af2d scripts/extract: remove unneeded code
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 13:34:51 +01:00

55 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
. config/options $1
if [ -z "$3" ]; then
echo "usage: $0 package_name file_pattern target_dir"
exit 1
fi
[ -z "$PKG_URL" ] && exit 1
[ ! -d "$SOURCES/$1" -o ! -d "$3" ] && exit 1
[ -n "$PKG_URL" ] && \
FILES="$FILES `echo $PKG_URL | sed 's%.*/\(.*\)\$%\1%'`"
for s in $FILES; do
case $s in
$2)
f="$SOURCES/$1/$s"
if [ ! -f $f ]; then
echo "error: File $s doesn't exists 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.bz2 | *.tbz)
tar xjf $f -C $3
;;
*.tar.gz | *.tgz)
tar xzf $f -C $3
;;
*.7z)
mkdir -p $3/$1
7z x -o$3/$1 $f
;;
*.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
;;
*)
cp -pPR $f $3
;;
esac
;;
esac
done