mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-01-28 22:01:50 +00:00
add better logging to the root module installer
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user