extract_files: Adjust deodex path and tmpdir

* Make a tempdir using the mktemp command rather than just making a
  dir in /tmp to accomodate for systems that don't set proper perms
  or dont have /tmp
* Fix the deodex procedure to pull files from the right path

Change-Id: I181863599b6670e3a149069dbb7b13ebf73bae8e
This commit is contained in:
Rashed Abdel-Tawab 2017-08-05 23:11:35 -04:00 committed by Rashed Abdel-Tawab
parent d4d509ccf3
commit 11186d6c83

View file

@ -26,8 +26,7 @@ COMMON=-1
ARCHES=
FULLY_DEODEXED=-1
TMPDIR="/tmp/extractfiles.$$"
mkdir "$TMPDIR"
TMPDIR=$(mktemp -d)
#
# cleanup
@ -700,7 +699,12 @@ function oat2dex() {
echo "Checking if system is odexed and locating boot.oats..."
for ARCH in "arm64" "arm" "x86_64" "x86"; do
mkdir -p "$TMPDIR/system/framework/$ARCH"
if get_file "system/framework/$ARCH/" "$TMPDIR/system/framework/" "$SRC"; then
if [ -d "$SRC/framework" ] && [ "$SRC" != "adb" ]; then
ARCHDIR="framework/$ARCH/"
else
ARCHDIR="system/framework/$ARCH/"
fi
if get_file "$ARCHDIR" "$TMPDIR/system/framework/" "$SRC"; then
ARCHES+="$ARCH "
else
rmdir "$TMPDIR/system/framework/$ARCH"