Include our own unzip and tar to try to fix decompression issues

that some users are experiencing
This commit is contained in:
mfonville
2016-09-13 21:10:43 +02:00
parent 08600743a5
commit 55cbbd4587
7 changed files with 44 additions and 22 deletions
+12 -12
View File
@@ -175,22 +175,22 @@ kitkatdata_folder_extract() {
fi
# On KitKat we know that these applications are arm and x86 and are using no fallbacks
if [ -e "$TMP/GApps/$1.tar.xz" ]; then
$TMP/xzdec-$BINARCH "$TMP/GApps/$1.tar.xz" | tar -x -C "$TMP" -f - "$2"
"$TMP/xzdec-$BINARCH" "$TMP/GApps/$1.tar.xz" | tar -x -C "$TMP" -f - "$2"
elif [ -e "$TMP/GApps/$1.tar.lz" ]; then
tar -xyf "$TMP/GApps/$1.tar.lz" -C "$TMP" "$2"
"$TMP/tar-$BINARCH" -xf "$TMP/GApps/$1.tar.lz" -C "$TMP" "$2"
elif [ -e "$TMP/GApps/$1.tar" ]; then
tar -xf "$TMP/GApps/$1.tar" -C "$TMP" "$2"
"$TMP/tar-$BINARCH" -xf "$TMP/GApps/$1.tar" -C "$TMP" "$2"
fi
cp -rf "$TMP/$2/app/$4" "/data/app/$3-$number.apk"
rm -rf "$TMP/$2"
if [ -e "$TMP/GApps/$1.tar.xz" ]; then
$TMP/xzdec-$BINARCH "$TMP/GApps/$1.tar.xz" | tar -x -C "$TMP" -f - "$1/common"
"$TMP/xzdec-$BINARCH" "$TMP/GApps/$1.tar.xz" | tar -x -C "$TMP" -f - "$1/common"
rm -f "$TMP/GApps/$1.tar.xz"
elif [ -e "$TMP/GApps/$1.tar.lz" ]; then
tar -xyf "$TMP/GApps/$1.tar.lz" -C "$TMP" "$1/common"
"$TMP/tar-$BINARCH" -xyf "$TMP/GApps/$1.tar.lz" -C "$TMP" "$1/common"
rm -f "$TMP/GApps/$1.tar.lz"
elif [ -e "$TMP/GApps/$1.tar" ]; then
tar -xf "$TMP/GApps/$1.tar" -C "$TMP" "$1/common"
"$TMP/tar-$BINARCH" -xf "$TMP/GApps/$1.tar" -C "$TMP" "$1/common"
rm -f "$TMP/GApps/$1.tar"
fi
cp -rf "$TMP/$1/common/lib"* "/data/app-lib/$3-$number/"
@@ -203,42 +203,42 @@ install -d /data/app/
install -d /data/app-lib/
# Handle broken lib configuration on KitKat by putting Hangouts on /data/
if ( contains "$gapps_list" "hangouts" ); then
unzip -o "$OPENGAZIP" "GApps/hangouts-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/hangouts-$arch.tar*" -d "$TMP"
which_dpi "hangouts-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "hangouts-$arch" "$dpiapkpath" "com.google.android.talk" "Hangouts.apk"
gapps_list=${gapps_list/hangouts}
fi
# Handle broken lib configuration on KitKat by putting Google+ on /data/
if ( contains "$gapps_list" "googleplus" ); then
unzip -o "$OPENGAZIP" "GApps/googleplus-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/googleplus-$arch.tar*" -d "$TMP"
which_dpi "googleplus-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "googleplus-$arch" "$dpiapkpath" "com.google.android.apps.plus" "PlusOne.apk"
gapps_list=${gapps_list/googleplus}
fi
# Handle broken lib configuration on KitKat by putting Messenger on /data/
if ( contains "$gapps_list" "messenger" ); then
unzip -o "$OPENGAZIP" "GApps/messenger-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/messenger-$arch.tar*" -d "$TMP"
which_dpi "messenger-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "messenger-$arch" "$dpiapkpath" "com.google.android.apps.messaging" "PrebuiltBugle.apk"
gapps_list=${gapps_list/messenger}
fi
# Handle broken lib configuration on KitKat by putting Photos on /data/
if ( contains "$gapps_list" "photos" ); then
unzip -o "$OPENGAZIP" "GApps/photos-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/photos-$arch.tar*" -d "$TMP"
which_dpi "photos-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "photos-$arch" "$dpiapkpath" "com.google.android.apps.photos" "Photos.apk"
gapps_list=${gapps_list/photos}
fi
# Handle broken lib configuration on KitKat by putting StreetView on /data/
if ( contains "$gapps_list" "street" ); then
unzip -o "$OPENGAZIP" "GApps/street-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/street-$arch.tar*" -d "$TMP"
which_dpi "street-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "street-$arch" "$dpiapkpath" "com.google.android.street" "Street.apk"
gapps_list=${gapps_list/street}
fi
# Handle broken lib configuration on KitKat by putting YouTube on /data/
if ( contains "$gapps_list" "youtube" ); then
unzip -o "$OPENGAZIP" "GApps/youtube-$arch.tar*" -d "$TMP"
"$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "GApps/youtube-$arch.tar*" -d "$TMP"
which_dpi "youtube-$arch" # Keep it simple, only 32 bit arch on kitkat and no weird libs for these apps
kitkatdata_folder_extract "youtube-$arch" "$dpiapkpath" "com.google.android.youtube" "YouTube.apk"
gapps_list=${gapps_list/youtube}
+10 -10
View File
@@ -647,8 +647,8 @@ ch_con_recursive() {
}
checkmanifest() {
if [ -f "$1" ] && (unzip -ql "$1" | grep -q "META-INF/MANIFEST.MF"); then # strict, only files
unzip -p "$1" "META-INF/MANIFEST.MF" | grep -q "$2"
if [ -f "$1" ] && ("$TMP/unzip-$BINARCH" -ql "$1" | grep -q "META-INF/MANIFEST.MF"); then # strict, only files
"$TMP/unzip-$BINARCH" -p "$1" "META-INF/MANIFEST.MF" | grep -q "$2"
return "$?"
else
return 0
@@ -676,16 +676,16 @@ clean_inst() {
}
exists_in_zip(){
unzip -l "$OPENGAZIP" "$1" | grep -q "$1"
"$TMP/unzip-$BINARCH" -l "$OPENGAZIP" "$1" | grep -q "$1"
return $?
}
extract_app() {
tarpath="$TMP/$1.tar" # NB no suffix specified here
if unzip -o "$OPENGAZIP" "$1.tar*" -d "$TMP"; then # wildcard for suffix
if "$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "$1.tar*" -d "$TMP"; then # wildcard for suffix
app_name="$(basename "$1")"
which_dpi "$app_name"
echo "Found $1 DPI path: $dpkiapkpath"
echo "Found $1 DPI path: $dpiapkpath"
folder_extract "$tarpath" "$dpiapkpath" "$app_name/common"
else
echo "Failed to extract $1.tar* from $OPENGAZIP"
@@ -714,7 +714,7 @@ exxit() {
cp -f "$rec_tmp_log" "$TMP/logs/Recovery_tmp.log"
logcat -d -f "$TMP/logs/logcat"
cd "$TMP"
tar -cz -f "$log_folder/open_gapps_debug_logs.tar.gz" logs/*
"$TMP/tar-$BINARCH" -cz -f "$log_folder/open_gapps_debug_logs.tar.gz" logs/*
cd /
fi
find $TMP/* -maxdepth 0 ! -path "$rec_tmp_log" -exec rm -rf {} +
@@ -733,21 +733,21 @@ folder_extract() {
if [ -e "$archive.xz" ]; then
for f in "$@"; do
if [ "$f" != "unknown" ]; then
$TMP/xzdec-$BINARCH "$archive.xz" | tar -x -C "$TMP" -f - "$f" && install_extracted "$f"
"$TMP/xzdec-$BINARCH" "$archive.xz" | "$TMP/tar-$BINARCH" -x -C "$TMP" -f - "$f" && install_extracted "$f"
fi
done
rm -f "$archive.xz"
elif [ -e "$archive.lz" ]; then
for f in "$@"; do
if [ "$f" != "unknown" ]; then
tar -xyf "$archive.lz" -C "$TMP" "$f" && install_extracted "$f"
"$TMP/tar-$BINARCH" -xf "$archive.lz" -C "$TMP" "$f" && install_extracted "$f"
fi
done
rm -f "$archive.lz"
elif [ -e "$archive" ]; then
for f in "$@"; do
if [ "$f" != "unknown" ]; then
tar -xf "$archive" -C "$TMP" "$f" && install_extracted "$f"
"$TMP/tar-$BINARCH" -xf "$archive" -C "$TMP" "$f" && install_extracted "$f"
fi
done
rm -f "$archive"
@@ -874,7 +874,7 @@ odexapk() {
apkdir="$(dirname "$1")"
apkname="$(basename "$1" ".apk")" # Take note not to use -s, it is not supported in busybox
install -d "$TMP/classesdex"
unzip -q -o "$1" "classes*.dex" -d "$TMP/classesdex/" # extract to temporary location first, to avoid potential disk space shortage
"$TMP/unzip-$BINARCH" -q -o "$1" "classes*.dex" -d "$TMP/classesdex/" # extract to temporary location first, to avoid potential disk space shortage
eval '$TMP/zip-$BINARCH -d "$1" "classes*.dex"'
cp "$TMP/classesdex/"* "$apkdir"
rm -rf "$TMP/classesdex/"
+22
View File
@@ -37,6 +37,8 @@ commonscripts() {
COMPRESSION="xz" # Aroma does not play nice with the busybox built-in decompressors
bundlexzdec
fi
bundletar
bundleunzip
bundlezip
makeupdatebinary "META-INF/com/google/android/update-binary" "busybox" "installer.sh" "$EXTRACTFILES" "$CHMODXFILES" # execute as last so that $EXTRACTFILES and $CHMODXFILES are complete
bundlelicense #optionally add a LICENSE file to the package
@@ -84,6 +86,26 @@ bundlexzdec() {
CHMODXFILES="$CHMODXFILES $xzdecbin"
}
bundletar() {
case "$ARCH" in #Include tar binary
arm*) tarbin="tar-arm";;
x86*) tarbin="tar-x86";;
esac
copy "$SCRIPTS/tar-resources/$tarbin" "$build/$tarbin"
EXTRACTFILES="$EXTRACTFILES $tarbin"
CHMODXFILES="$CHMODXFILES $tarbin"
}
bundleunzip() {
case "$ARCH" in #Include unzip binary
arm*) unzipbin="unzip-arm";;
x86*) unzipbin="unzip-x86";;
esac
copy "$SCRIPTS/infozip-resources/$unzipbin" "$build/$unzipbin"
EXTRACTFILES="$EXTRACTFILES $unzipbin"
CHMODXFILES="$CHMODXFILES $unzipbin"
}
bundlezip() {
case "$ARCH" in #Include zip binary
arm*) zipbin="zip-arm";;
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.