2013-07-19 00:35:52 +00:00
|
|
|
#!/bin/bash
|
2011-01-09 22:32:01 +00:00
|
|
|
|
2011-01-09 20:26:03 +00:00
|
|
|
################################################################################
|
|
|
|
# This file is part of OpenELEC - http://www.openelec.tv
|
2016-01-02 16:26:58 +00:00
|
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
2011-01-09 20:26:03 +00:00
|
|
|
#
|
2013-12-21 20:51:48 +00:00
|
|
|
# OpenELEC is free software: you can redistribute it and/or modify
|
2011-01-09 20:26:03 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2013-12-21 20:51:48 +00:00
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
2011-01-09 20:26:03 +00:00
|
|
|
#
|
2013-12-21 20:51:48 +00:00
|
|
|
# OpenELEC is distributed in the hope that it will be useful,
|
2011-01-09 20:26:03 +00:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2013-12-21 20:51:48 +00:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2011-01-09 20:26:03 +00:00
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-21 20:51:48 +00:00
|
|
|
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
2011-01-09 20:26:03 +00:00
|
|
|
################################################################################
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2010-07-21 16:54:45 +00:00
|
|
|
. config/options $1
|
2009-03-18 12:02:53 +00:00
|
|
|
|
|
|
|
if [ -z "$3" ]; then
|
|
|
|
echo "usage: $0 package_name file_pattern target_dir"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-01-07 07:45:31 +00:00
|
|
|
[ -z "$PKG_URL" -o -z "$PKG_SOURCE_NAME" ] && exit 1
|
2010-07-22 03:07:09 +00:00
|
|
|
[ ! -d "$SOURCES/$1" -o ! -d "$3" ] && exit 1
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2016-01-07 07:45:31 +00:00
|
|
|
case $PKG_SOURCE_NAME in
|
2009-03-18 12:02:53 +00:00
|
|
|
$2)
|
2016-01-07 07:45:31 +00:00
|
|
|
f="$SOURCES/$1/$PKG_SOURCE_NAME"
|
2009-03-18 12:02:53 +00:00
|
|
|
if [ ! -f $f ]; then
|
2016-01-07 07:45:31 +00:00
|
|
|
echo "error: File $PKG_SOURCE_NAME doesn't exists in package $1 sources directory"
|
2009-03-18 12:02:53 +00:00
|
|
|
echo "have you called scripts/extract before scripts/get ?"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-01-07 07:45:31 +00:00
|
|
|
case $PKG_SOURCE_NAME in
|
2009-03-18 12:02:53 +00:00
|
|
|
*.tar)
|
|
|
|
tar xf $f -C $3
|
|
|
|
;;
|
|
|
|
*.tar.bz2 | *.tbz)
|
|
|
|
tar xjf $f -C $3
|
|
|
|
;;
|
|
|
|
*.tar.gz | *.tgz)
|
|
|
|
tar xzf $f -C $3
|
|
|
|
;;
|
2011-06-20 19:56:18 +00:00
|
|
|
*.tar.xz | *.txz)
|
|
|
|
tar xJf $f -C $3
|
|
|
|
;;
|
2010-07-17 22:47:00 +00:00
|
|
|
*.7z)
|
|
|
|
mkdir -p $3/$1
|
|
|
|
7z x -o$3/$1 $f
|
|
|
|
;;
|
2013-12-25 22:26:25 +00:00
|
|
|
*.zip)
|
2015-12-30 02:50:20 +00:00
|
|
|
unzip -q $f -d $3
|
2013-12-25 22:26:25 +00:00
|
|
|
;;
|
2009-03-18 12:02:53 +00:00
|
|
|
*.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
|
|
|
|
;;
|
2016-01-07 07:45:31 +00:00
|
|
|
esac
|