summaryrefslogtreecommitdiff
path: root/sysroot.sh
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-12 15:07:51 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-14 05:09:08 -0700
commite052c855915574d3bea528d5f7a2eaef101ff3c4 (patch)
treec9deefe9cd24f108bde6894c638a2632f0341001 /sysroot.sh
parenteaa9f1224cce97bf2568e914b7f3e7efe3dc5505 (diff)
Separate out extract() in syroot.sh.
Diffstat (limited to 'sysroot.sh')
-rwxr-xr-xsysroot.sh44
1 files changed, 25 insertions, 19 deletions
diff --git a/sysroot.sh b/sysroot.sh
index 4815b24..26ecbad 100755
--- a/sysroot.sh
+++ b/sysroot.sh
@@ -36,6 +36,30 @@ declare -A dpkgz
dpkgz[gz]=gunzip
dpkgz[lzma]=unlzma
+function extract() {
+ package=$1
+ url=$2
+
+ wget -O "${package}.deb" "${url}"
+ for z in lzma gz; do
+ compressed=data.tar.${z}
+
+ if ar -x "${package}.deb" "${compressed}" 2>/dev/null; then
+ ${dpkgz[${z}]} "${compressed}"
+ break
+ fi
+ done
+
+ if ! [[ -e data.tar ]]; then
+ echo "unable to extract package" 1>&2
+ exit 1
+ fi
+
+ ls -la data.tar
+ tar -xf ./data.tar
+ rm -f data.tar
+}
+
wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | {
regex='^([^ \t]*): *(.*)'
declare -A fields
@@ -45,25 +69,7 @@ wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture
package=${fields[package]}
if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|coreutils|mobilesubstrate|pcre) ]]; then
filename=${fields[filename]}
-
- wget -O "${package}.deb" "${repository}${filename}"
- for z in lzma gz; do
- compressed=data.tar.${z}
-
- if ar -x "${package}.deb" "${compressed}" 2>/dev/null; then
- ${dpkgz[${z}]} "${compressed}"
- break
- fi
- done
-
- if ! [[ -e data.tar ]]; then
- echo "unable to extract package" 1>&2
- exit 1
- fi
-
- ls -la data.tar
- tar -xf ./data.tar
- rm -f data.tar
+ extract "${package}" "${repository}${filename}"
fi
unset fields