diff options
author | Niklas Baumstark <niklas.baumstark@gmail.com> | 2016-12-28 19:26:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-28 19:26:41 +0100 |
commit | 50a57dc983d6feced456752e21c61ada1ffba221 (patch) | |
tree | 0ddbbf9ccd7f95b500704d6f457ab6fea3895a26 /common | |
parent | 12803ac6d2a0ce44523f2c005399dbcd169e855a (diff) | |
parent | cb0125e15646bc663628023ff5862b26a1241dcd (diff) | |
download | libc-database-50a57dc983d6feced456752e21c61ada1ffba221.tar.gz libc-database-50a57dc983d6feced456752e21c61ada1ffba221.zip |
Merge pull request #3 from msm595/master
Use mktemp for tmp dir
Diffstat (limited to 'common')
-rw-r--r-- | common/libc.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/common/libc.sh b/common/libc.sh index b054595..7e2a760 100644 --- a/common/libc.sh +++ b/common/libc.sh @@ -1,6 +1,6 @@ #!/bin/bash -mkdir -p tmp db +mkdir -p db die() { echo >&2 $1 @@ -62,21 +62,22 @@ check_id() { get_ubuntu() { local url="$1" local info="$2" + local tmp=`mktemp -d || mktemp -d -t "libc-database" || die "Cannot get temp dir"` echo "Getting $info" echo " -> Location: $url" local id=`echo $url | perl -n -e '/(libc6[^\/]*)\./ && print $1'` echo " -> ID: $id" check_id $id || return echo " -> Downloading package" - rm -rf tmp/* - wget $url 2>/dev/null -O tmp/pkg.deb || die "Failed to download package from $url" + wget $url 2>/dev/null -O $tmp/pkg.deb || die "Failed to download package from $url" echo " -> Extracting package" - cd tmp + pushd $tmp 1>/dev/null ar x pkg.deb || die "ar failed" tar xf data.tar.* || die "tar failed" - cd .. - local libc=`find tmp -name libc.so.6 || die "Cannot locate libc.so.6"` + popd 1>/dev/null + local libc=`find $tmp -name libc.so.6 || die "Cannot locate libc.so.6"` process_libc $libc $id $info + rm -rf $tmp } get_current_ubuntu() { |