From 888f1b3616e6fce41a9ae9aeb1398e9c6f344280 Mon Sep 17 00:00:00 2001 From: Kavish Devar Date: Tue, 14 Jan 2025 01:49:03 +0530 Subject: [PATCH] add better logging to the root module installer --- README.md | 5 +---- root-module/customize.sh | 35 +++++++++++++++-------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index ebc9f46..a59937b 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,10 @@ This tray app communicates with a daemon with the help of a UNIX socket. The dae Currently, there's a [bug in the Android Bluetooth stack](https://issuetracker.google.com/issues/371713238) that prevents the app from working (upvote the issue - click the '+1' icon on the top right corner of IssueTracker). This project provides a root module which patches the bug. > [!CAUTION] -> **This workaround requires root access.** Try at your own risk. +> **This workaround requires root access.** Try at your own risk. It may break your bluetooth, and I am not responsible for any damage caused by this module. To install it, just download the `btl2capfix.zip` from [a release](https://github.com/kavishdevar/aln/releases) and install it from your root manager app. -Tested with -- KernelSU - ### Features #### Renaming the Airpods diff --git a/root-module/customize.sh b/root-module/customize.sh index 2f8de34..b82f421 100644 --- a/root-module/customize.sh +++ b/root-module/customize.sh @@ -12,15 +12,13 @@ mkdir -p "$TEMP_DIR" mkdir -p "$UNZIP_DIR" # Manually extract the $ZIPFILE to a temporary directory -ui_print "Extracting $ZIPFILE to $UNZIP_DIR" +ui_print "Extracting module files..." unzip -o "$ZIPFILE" -d "$UNZIP_DIR" > /dev/null 2>&1 if [ $? -ne 0 ]; then - ui_print "Failed to unzip $ZIPFILE" + ui_print "Error: Failed to extract module files." abort "Failed to unzip $ZIPFILE" fi -ui_print "Extracted module files to $UNZIP_DIR" - # Determine architecture IS64BIT=false if [ "$(uname -m)" = "aarch64" ]; then @@ -42,9 +40,9 @@ fi set_perm "$CURL_CMD" 0 0 755 if [ -f "$CURL_CMD" ]; then - ui_print "curl binary found." + ui_print "curl binary is ready." else - ui_print "curl binary not found. Exiting." + ui_print "Error: curl binary not found." abort "curl binary not found." fi @@ -52,38 +50,35 @@ if [ -f "/apex/com.android.btservices/lib64/libbluetooth_jni.so" ]; then SOURCE_FILE="/apex/com.android.btservices/lib64/libbluetooth_jni.so" LIBRARY_NAME="libbluetooth_jni.so" PATCHED_FILE_NAME="libbluetooth_jni_patched.so" - ui_print "Detected library: libbluetooth_jni.so in /apex/com.android.btservices/lib64/" + ui_print "Detected library: libbluetooth_jni.so" elif [ -f "/system/lib64/libbluetooth_jni.so" ]; then SOURCE_FILE="/system/lib64/libbluetooth_jni.so" LIBRARY_NAME="libbluetooth_jni.so" PATCHED_FILE_NAME="libbluetooth_jni_patched.so" - ui_print "Detected library: libbluetooth_jni.so in /system/lib64/" + ui_print "Detected library: libbluetooth_jni.so" elif [ -f "/system/lib64/libbluetooth_qti.so" ]; then SOURCE_FILE="/system/lib64/libbluetooth_qti.so" LIBRARY_NAME="libbluetooth_qti.so" PATCHED_FILE_NAME="libbluetooth_qti_patched.so" - ui_print "Detected QTI library: libbluetooth_qti.so in /system/lib64/" + ui_print "Detected QTI library: libbluetooth_qti.so" elif [ -f "/system_ext/lib64/libbluetooth_qti.so" ]; then SOURCE_FILE="/system_ext/lib64/libbluetooth_qti.so" LIBRARY_NAME="libbluetooth_qti.so" PATCHED_FILE_NAME="libbluetooth_qti_patched.so" - ui_print "Detected QTI library: libbluetooth_qti.so in /system_ext/lib64/" + ui_print "Detected QTI library: libbluetooth_qti.so" else - ui_print "No target library found. Exiting." + ui_print "Error: No target library found." abort "No target library found." fi -ui_print "Uploading $LIBRARY_NAME to the API for patching..." -ui_print "If you're concerned about privacy, review the source code of the API at https://github.com/kavishdevar/aln/blob/main/root-module-manual/server.py" +ui_print "Uploading $LIBRARY_NAME for patching..." PATCHED_FILE_NAME="patched_$LIBRARY_NAME" -ui_print "calling command $CURL_CMD --verbose -k -X POST $API_URL -F file=@$SOURCE_FILE -F library_name=$LIBRARY_NAME -o $TEMP_DIR/$PATCHED_FILE_NAME" - -$CURL_CMD --verbose -k -X POST $API_URL -F file=@"$SOURCE_FILE" -F library_name="$LIBRARY_NAME" -o "$TEMP_DIR/$PATCHED_FILE_NAME" > "$TEMP_DIR/headers.txt" 2>&1 +$CURL_CMD -k -X POST $API_URL -F file=@"$SOURCE_FILE" -F library_name="$LIBRARY_NAME" -o "$TEMP_DIR/$PATCHED_FILE_NAME" > "$TEMP_DIR/headers.txt" 2>&1 if [ -f "$TEMP_DIR/$PATCHED_FILE_NAME" ]; then - ui_print "Received patched file from the API." - ui_print "Installing patched file to the module's directory..." + ui_print "Patched file received." + ui_print "Installing patched file..." if [[ "$SOURCE_FILE" == *"/system/lib64"* ]]; then TARGET_DIR="$MODPATH/system/lib64" @@ -118,10 +113,10 @@ mount -t overlay overlay -o lowerdir=$APEX_LIB_DIR,upperdir=$MOD_APEX_LIB_DIR,wo EOF set_perm "$POST_DATA_FS_SCRIPT" 0 0 755 - ui_print "Created post-data-fs.sh script for apex library handling." + ui_print "Created script for apex library handling." fi else - ui_print "Failed to receive patched file from the API." + ui_print "Error: Failed to receive patched file." rm -rf "$TEMP_DIR" abort "Failed to patch the library." fi