From ba49ea43bc49c066dc289ec1e937cc46af6eba97 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Mon, 17 Aug 2026 15:36:15 -0400 Subject: [PATCH 01/11] fix: strip rish 'Entering shell...' banner from output captures Recent versions of the thedjchi/Shizuku fork (Android 17 dev) print 'Entering shell...' to stdout before executing rish commands. This pollutes all $(rish -c "...") output captures, causing string comparisons like "Entering shell..." == "Success" to fail silently. Add rish_c() wrapper in each affected file that pipes rish output through grep -v to strip the banner. Backward-compatible: grep -v is a no-op on systems where the banner is absent (Android 14/15/16). The Rish detection check in constants.sh (rish -c 'exit' &> /dev/null) is intentionally left unchanged as it discards output and relies on the exit code only. --- modules/system/rish.sh | 28 +++++++++++++++------------- modules/system/root.sh | 6 ++++-- system/rish-install.sh | 26 ++++++++++++++------------ system/rish-uninstall.sh | 8 +++++--- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/modules/system/rish.sh b/modules/system/rish.sh index 4a18bde..d313134 100644 --- a/modules/system/rish.sh +++ b/modules/system/rish.sh @@ -1,5 +1,7 @@ #!/usr/bin/bash +rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } + applyBackgroundWhitelist() { local PKG="$1" @@ -21,18 +23,18 @@ applyBackgroundWhitelist() { log "Applying background whitelist for $PKG..." local WL_OUTPUT - WL_OUTPUT=$(rish -c "cmd deviceidle whitelist +$PKG" 2>&1) + WL_OUTPUT=$(rish_c "cmd deviceidle whitelist +$PKG" 2>&1) log "deviceidle whitelist output: $WL_OUTPUT" local RIB_OUTPUT - RIB_OUTPUT=$(rish -c "cmd appops set $PKG RUN_IN_BACKGROUND allow" 2>&1) + RIB_OUTPUT=$(rish_c "cmd appops set $PKG RUN_IN_BACKGROUND allow" 2>&1) log "appops RUN_IN_BACKGROUND output: $RIB_OUTPUT" local RAIB_OUTPUT - RAIB_OUTPUT=$(rish -c "cmd appops set $PKG RUN_ANY_IN_BACKGROUND allow" 2>&1) + RAIB_OUTPUT=$(rish_c "cmd appops set $PKG RUN_ANY_IN_BACKGROUND allow" 2>&1) log "appops RUN_ANY_IN_BACKGROUND output: $RAIB_OUTPUT" - if rish -c "cmd deviceidle whitelist" 2>/dev/null | grep -q "$PKG"; then + if rish_c "cmd deviceidle whitelist" 2>/dev/null | grep -q "$PKG"; then log "Background whitelist: $PKG confirmed in device-idle whitelist." return 0 else @@ -70,7 +72,7 @@ runDexOptimization() { log "Executing: cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" local OPT_OUTPUT - OPT_OUTPUT=$(rish -c "cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" 2>&1) + OPT_OUTPUT=$(rish_c "cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" 2>&1) local OPT_EXIT_CODE=$? log "Optimization output: $OPT_OUTPUT" @@ -82,7 +84,7 @@ runDexOptimization() { if [ "$INSTALL_TYPE" == "update" ]; then log "Executing force-stop for updated app: $PKG" local FORCE_STOP_OUTPUT - FORCE_STOP_OUTPUT=$(rish -c "am force-stop $PKG" 2>&1) + FORCE_STOP_OUTPUT=$(rish_c "am force-stop $PKG" 2>&1) log "Force-stop output: $FORCE_STOP_OUTPUT" log "Force-stop completed for $PKG after speed optimization" fi @@ -105,7 +107,7 @@ runDexOptimization() { if [ "$INSTALL_TYPE" == "update" ]; then log "Executing force-stop for updated app: $PKG" local FORCE_STOP_OUTPUT - FORCE_STOP_OUTPUT=$(rish -c "am force-stop $PKG" 2>&1) + FORCE_STOP_OUTPUT=$(rish_c "am force-stop $PKG" 2>&1) log "Force-stop output: $FORCE_STOP_OUTPUT" log "Force-stop completed for $PKG after speed optimization" fi @@ -157,7 +159,7 @@ installAppRish() { cp -f "apps/$APP_NAME/$APP_VER-$SOURCE.apk" "$STORAGE/Patched/$EXPORTED_APK_NAME.apk" &> /dev/null log "Checking if $PATCHED_APP_PKG_NAME is installed" - local INSTALLED_PATCHED_VERSION=$(rish -c "dumpsys package $PATCHED_APP_PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + local INSTALLED_PATCHED_VERSION=$(rish_c "dumpsys package $PATCHED_APP_PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') if [ "$INSTALLED_PATCHED_VERSION" != "" ]; then INSTALL_TYPE="update" @@ -165,10 +167,10 @@ installAppRish() { log "Install type determined: UPDATE" log "Verifying signatures..." local STOCK_APP_PATH - if [ "$(rish -c "pm list packages --user current | grep -q $PATCHED_APP_PKG_NAME && echo Installed")" == "Installed" ]; then - STOCK_APP_PATH=$(rish -c "pm path --user current $PATCHED_APP_PKG_NAME | sed -n '/base/s/package://p'") + if [ "$(rish_c "pm list packages --user current | grep -q $PATCHED_APP_PKG_NAME && echo Installed")" == "Installed" ]; then + STOCK_APP_PATH=$(rish_c "pm path --user current $PATCHED_APP_PKG_NAME | sed -n '/base/s/package://p'") else - STOCK_APP_PATH=$(rish -c "dumpsys package $PATCHED_APP_PKG_NAME | sed -n 's/^[[:space:]]*path: \(.*base\.apk\)/\1/p'") + STOCK_APP_PATH=$(rish_c "dumpsys package $PATCHED_APP_PKG_NAME | sed -n 's/^[[:space:]]*path: \(.*base\.apk\)/\1/p'") log "Dumpsys used to get stock app path, that means the app is installed but in a different user." HIDDEN_APP_INSTALL=true fi @@ -231,7 +233,7 @@ installAppRish() { notify info "Please Wait !!\nUninstalling $PATCHED_APP_APP_NAME using Rish..." if uninstallAppRish false true "$STORAGE"; then log "Uninstallation successful, proceeding with installation." - if ! rish -c "dumpsys package $PATCHED_APP_PKG_NAME" 2>&1 | grep -q "Unable to find package"; then + if ! rish_c "dumpsys package $PATCHED_APP_PKG_NAME" 2>&1 | grep -q "Unable to find package"; then log "Found hidden installation post uninstallation. This might be a different user." HIDDEN_APP_INSTALL=true fi @@ -339,7 +341,7 @@ installAppRish() { log "Installation of $PATCHED_APP_APP_NAME $PATCHED_APP_VERSION completed successfully, finalized code." if [ "$LAUNCH_APP_AFTER_MOUNT" == "on" ]; then - rish -c "settings list secure | sed -n -e 's/\/.*//' -e 's/default_input_method=//p' | xargs am force-stop && pm resolve-activity --brief $PKG_NAME | tail -n 1 | xargs am start -n && am force-stop com.termux" &> /dev/null + rish_c "settings list secure | sed -n -e 's/\/.*//' -e 's/default_input_method=//p' | xargs am force-stop && pm resolve-activity --brief $PKG_NAME | tail -n 1 | xargs am start -n && am force-stop com.termux" &> /dev/null fi return 0 } diff --git a/modules/system/root.sh b/modules/system/root.sh index 4ad02dd..e02a69e 100644 --- a/modules/system/root.sh +++ b/modules/system/root.sh @@ -1,11 +1,13 @@ #!/usr/bin/bash +rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } + getInstalledVersion() { if [ "$ROOT_ACCESS" == true ] && su -c "pm list packages | grep -q $PKG_NAME"; then INSTALLED_VERSION=$(su -c dumpsys package "$PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') # We use pm list and dumpsys as fallback. - elif [ "$RISH_ACCESS" = true ] && ( rish -c "pm list packages --user current | grep -q $PKG_NAME" || ! rish -c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package:" ); then - INSTALLED_VERSION=$(rish -c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + elif [ "$RISH_ACCESS" = true ] && ( rish_c "pm list packages --user current | grep -q $PKG_NAME" || ! rish_c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package:" ); then + INSTALLED_VERSION=$(rish_c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') fi } diff --git a/system/rish-install.sh b/system/rish-install.sh index ce9bc4b..bea2d9f 100644 --- a/system/rish-install.sh +++ b/system/rish-install.sh @@ -12,6 +12,8 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi +rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } + log "" log " Initiating rish installation" log "package: $PKG_NAME" @@ -19,7 +21,7 @@ log "app name: $APP_NAME" log "exported APK name: $EXPORTED_APK_NAME" log "" -CURRENT_USER=$(rish -c "am get-current-user" 2>/dev/null | tr -d '\r\n' | xargs) +CURRENT_USER=$(rish_c "am get-current-user" 2>/dev/null | tr -d '\r\n' | xargs) CURRENT_USER=${CURRENT_USER:-0} log "Current user: $CURRENT_USER" @@ -52,9 +54,9 @@ if [ -n "$INSTALL_TYPE_OVERRIDE" ]; then log "Install type override provided: $INSTALL_TYPE" else INSTALL_TYPE="new" - if [ "$(rish -c "pm list packages --user current | grep -q $PKG_NAME && echo Installed")" == "Installed" ]; then + if [ "$(rish_c "pm list packages --user current | grep -q $PKG_NAME && echo Installed")" == "Installed" ]; then INSTALL_TYPE="update" - CURRENT_VERSION=$(rish -c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + CURRENT_VERSION=$(rish_c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') log "Existing installation detected (v$CURRENT_VERSION) - this will be an UPDATE" else log "No existing installation detected - this will be a NEW INSTALL" @@ -66,20 +68,20 @@ if [ -n "$STORAGE" ]; then log "Install type written to $STORAGE/install_type.txt: $INSTALL_TYPE" fi -if [ "$(rish -c "[ -d '/data/local/tmp/enhancify' ] && echo Exists || echo Missing")" == "Missing" ]; then - rish -c "mkdir '/data/local/tmp/enhancify'" +if [ "$(rish_c "[ -d '/data/local/tmp/enhancify' ] && echo Exists || echo Missing")" == "Missing" ]; then + rish_c "mkdir '/data/local/tmp/enhancify'" log "/data/local/tmp/enhancify created." fi -if [ "$(rish -c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Exists" ]; then - rish -c "rm $PATCHED_APP_PATH" +if [ "$(rish_c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Exists" ]; then + rish_c "rm $PATCHED_APP_PATH" log "Residual $PATCHED_APP_PATH deleted" fi log "Moving exported APK to /data/local/tmp/enhancify..." -rish -c "mv -f $EXPORTED_APP_PATH $PATCHED_APP_PATH" +rish_c "mv -f $EXPORTED_APP_PATH $PATCHED_APP_PATH" -if [ "$(rish -c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Missing" ]; then +if [ "$(rish_c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Missing" ]; then log "Failed to move patched APK to $PATCHED_APP_PATH" [ -n "$STORAGE" ] && echo "Failed to stage APK for installation (move to /data/local/tmp failed)" > "$STORAGE/install_error.txt" exit 1 @@ -98,7 +100,7 @@ if [ "$BYPASS_LOW_TARGET_SDK_BLOCK" == "on" ]; then fi CMD_RISH="pm install -r -i com.android.vending$INSTALL_FLAGS --user current $PATCHED_APP_PATH" -OUTPUT=$(rish -c "$CMD_RISH" 2>&1) +OUTPUT=$(rish_c "$CMD_RISH" 2>&1) log "Install command: $CMD_RISH" log "Install output: $OUTPUT" @@ -124,7 +126,7 @@ parse_install_failure() { if echo "$OUTPUT" | grep -q "^Success"; then log "Install succeeded." - rish -c "rm -f $PATCHED_APP_PATH" + rish_c "rm -f $PATCHED_APP_PATH" [ -n "$STORAGE" ] && rm -f "$STORAGE/install_error.txt" exit 0 else @@ -135,6 +137,6 @@ else [ -n "$STORAGE" ] && echo "$FAILURE_REASON" > "$STORAGE/install_error.txt" log "Moving APK back to original location." - rish -c "mv -f $PATCHED_APP_PATH $EXPORTED_APP_PATH" + rish_c "mv -f $PATCHED_APP_PATH $EXPORTED_APP_PATH" exit 1 fi diff --git a/system/rish-uninstall.sh b/system/rish-uninstall.sh index d64837b..9f71b67 100644 --- a/system/rish-uninstall.sh +++ b/system/rish-uninstall.sh @@ -10,6 +10,8 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi +rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } + # Uninstall command if [ "$UNINSTALL_FROM_ALL_USERS" = true ]; then CMD_RISH="pm uninstall --user all $PKG_NAME" @@ -18,7 +20,7 @@ else fi # Execute the uninstall command using rish -OUTPUT=$(rish -c "$CMD_RISH" 2>&1) +OUTPUT=$(rish_c "$CMD_RISH" 2>&1) log "Uninstall command: $CMD_RISH" log "Uninstall output: $OUTPUT" @@ -29,7 +31,7 @@ if echo "$OUTPUT" | grep -q "^Success"; then else log "Uninstall failed or with empty output, checking if package is still present." if [ "$UNINSTALL_FROM_ALL_USERS" == true ]; then - if rish -c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package"; then + if rish_c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package"; then log "Package $PKG_NAME no longer present in any user." exit 0 else @@ -37,7 +39,7 @@ else exit 1 fi else - if rish -c "pm list packages --user current" 2>&1 | grep -q "package:$PKG_NAME"; then + if rish_c "pm list packages --user current" 2>&1 | grep -q "package:$PKG_NAME"; then log "Package $PKG_NAME still present for current user." exit 1 else From f651baf36ba91aea21d31ad7049a075ab3f5ed11 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Mon, 17 Aug 2026 17:55:08 -0400 Subject: [PATCH 02/11] redirect install and update checks to fork (jairjacom/Enhancify) - install.sh: downloads launcher from jairjacom fork instead of OG repo - enhancify: update check and download URLs point to jairjacom/Enhancify - fetchSrc(): add null guard so no crash when fork has no releases yet - aapt2 binary URL left pointing to Graywizard888/Custom-Enhancify-aapt2-binary (separate repo, unchanged) --- enhancify | 11 ++++++++--- install.sh | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/enhancify b/enhancify index f4c80b2..766def1 100644 --- a/enhancify +++ b/enhancify @@ -669,7 +669,12 @@ fetchSrc() { print_info "Checking latest release..." - TAG=$(curl -s 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') + TAG=$(curl -s 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') + + if [ -z "$TAG" ] || [ "$TAG" == "null" ]; then + print_info "No releases found in fork, skipping update check" + return + fi if [ "$TAG" == "$VERSION" ]; then print_success "You're running the latest version ${GREEN}($VERSION)${RESET}" @@ -684,7 +689,7 @@ fetchSrc() { print_info "Installing update..." - downloadFile "https://github.com/Graywizard888/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" + downloadFile "https://github.com/jairjacom/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" if [ -e "$TAG.zip" ]; then unzip -qo "$TAG.zip" @@ -717,7 +722,7 @@ echo "" [ -e "$SRC/.info" ] && source "$SRC/.info" if [ "$INTERNET_ACCESS" != false ] && ping -c 1 -W 2 github.com &> /dev/null; then - TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) + TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) if [ -n "$TAG" ] && [ "$TAG" != "null" ] && [ "$TAG" != "$VERSION" ]; then UPDATE_AVAILABLE=true fi diff --git a/install.sh b/install.sh index 944b8f6..4469b1a 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/data/data/com.termux/files/usr/bin/bash [ -z "$TERMUX_VERSION" ] && echo -e "Termux not detected !!" && exit 1 BIN="$PREFIX/bin/enhancify" -curl -sL "https://github.com/Graywizard888/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" +curl -sL "https://github.com/jairjacom/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" [ -e "$BIN" ] && chmod +x "$BIN" && "$BIN" From 26d36f532cfccbb570c5a119fdae143ba9b1624e Mon Sep 17 00:00:00 2001 From: jairjacom Date: Mon, 17 Aug 2026 18:34:54 -0400 Subject: [PATCH 03/11] revert fork-specific URL redirects from install.sh and enhancify launcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These changes are not needed for the upstream PR — only the rish_c() fix belongs upstream. Keeping install.sh and enhancify pointing to the OG repo. --- enhancify | 11 +++-------- install.sh | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/enhancify b/enhancify index 766def1..f4c80b2 100644 --- a/enhancify +++ b/enhancify @@ -669,12 +669,7 @@ fetchSrc() { print_info "Checking latest release..." - TAG=$(curl -s 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') - - if [ -z "$TAG" ] || [ "$TAG" == "null" ]; then - print_info "No releases found in fork, skipping update check" - return - fi + TAG=$(curl -s 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') if [ "$TAG" == "$VERSION" ]; then print_success "You're running the latest version ${GREEN}($VERSION)${RESET}" @@ -689,7 +684,7 @@ fetchSrc() { print_info "Installing update..." - downloadFile "https://github.com/jairjacom/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" + downloadFile "https://github.com/Graywizard888/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" if [ -e "$TAG.zip" ]; then unzip -qo "$TAG.zip" @@ -722,7 +717,7 @@ echo "" [ -e "$SRC/.info" ] && source "$SRC/.info" if [ "$INTERNET_ACCESS" != false ] && ping -c 1 -W 2 github.com &> /dev/null; then - TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) + TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) if [ -n "$TAG" ] && [ "$TAG" != "null" ] && [ "$TAG" != "$VERSION" ]; then UPDATE_AVAILABLE=true fi diff --git a/install.sh b/install.sh index 4469b1a..944b8f6 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/data/data/com.termux/files/usr/bin/bash [ -z "$TERMUX_VERSION" ] && echo -e "Termux not detected !!" && exit 1 BIN="$PREFIX/bin/enhancify" -curl -sL "https://github.com/jairjacom/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" +curl -sL "https://github.com/Graywizard888/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" [ -e "$BIN" ] && chmod +x "$BIN" && "$BIN" From 2a666304dc6ba97d495bdad7adab112c0cc0af27 Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 18 Aug 2026 06:58:19 +0530 Subject: [PATCH 04/11] Delete enhancify --- enhancify | 762 ------------------------------------------------------ 1 file changed, 762 deletions(-) delete mode 100644 enhancify diff --git a/enhancify b/enhancify deleted file mode 100644 index f4c80b2..0000000 --- a/enhancify +++ /dev/null @@ -1,762 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/bash - -SRC="$HOME/Enhancify" - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -BLUE='\033[0;34m' -MAGENTA='\033[0;35m' -CYAN='\033[0;36m' -WHITE='\033[1;37m' -BOLD='\033[1m' -RESET='\033[0m' - -LIGHT_GREEN='\033[1;32m' -LIGHT_CYAN='\033[1;36m' -LIGHT_YELLOW='\033[1;33m' -DIM='\033[2m' - -SUCCESS="${GREEN}✓${RESET}" -ERROR="${RED}✗${RESET}" -WARNING="${YELLOW}⚠${RESET}" -INFO="${CYAN}ℹ${RESET}" -ARROW="${MAGENTA}➜${RESET}" - -UPDATE_AVAILABLE=false - -print_success() { - echo -e "${SUCCESS} ${GREEN}$1${RESET}" -} - -print_error() { - echo -e "${ERROR} ${RED}$1${RESET}" -} - -print_warning() { - echo -e "${WARNING} ${YELLOW}$1${RESET}" -} - -print_info() { - echo -e "${INFO} ${CYAN}$1${RESET}" -} - -print_step() { - echo -e "${ARROW} ${WHITE}$1${RESET}" -} - -print_header() { - echo -e "\n${BOLD}${MAGENTA}══════════════════════════════════════${RESET}" - echo -e "${BOLD}${WHITE} $1${RESET}" - echo -e "${BOLD}${MAGENTA}══════════════════════════════════════${RESET}\n" -} - -installJavaWithProgress() { - local JAVA_PKG="$1" - local TEMP_LOG=$(mktemp) - local PID - - tput civis 2>/dev/null - - local SPINNER=('⣾' '⣽' '⣻' '⢿' '⡿' '⣟' '⣯' '⣷') - local SPINNER_IDX=0 - - local BAR_WIDTH=30 - local PROGRESS=0 - local STATUS="Initializing..." - local DOWNLOAD_INFO="" - local PHASE=0 - - local BAR_FILLED="━" - local BAR_EMPTY="─" - local BAR_HEAD="▶" - - pkg install "$JAVA_PKG" -y > "$TEMP_LOG" 2>&1 & - PID=$! - - echo "" - echo "" - echo "" - - while kill -0 $PID 2>/dev/null; do - if [ -f "$TEMP_LOG" ]; then - local LAST_LINES=$(tail -5 "$TEMP_LOG" 2>/dev/null) - - if echo "$LAST_LINES" | grep -qi "reading package"; then - STATUS="Reading package lists..." - PROGRESS=5 - PHASE=1 - elif echo "$LAST_LINES" | grep -qi "building dependency"; then - STATUS="Building dependency tree..." - PROGRESS=10 - PHASE=2 - elif echo "$LAST_LINES" | grep -qi "the following.*packages will be"; then - STATUS="Resolving dependencies..." - PROGRESS=15 - PHASE=3 - elif echo "$LAST_LINES" | grep -qi "need to get\|get:"; then - local DL_INFO=$(echo "$LAST_LINES" | grep -oi "get:[0-9]*.*" | tail -1) - if [ -n "$DL_INFO" ]; then - DOWNLOAD_INFO="${DL_INFO:0:35}" - fi - STATUS="Downloading packages..." - if [ $PHASE -lt 4 ]; then - PROGRESS=20 - PHASE=4 - elif [ $PROGRESS -lt 55 ]; then - PROGRESS=$((PROGRESS + 1)) - fi - elif echo "$LAST_LINES" | grep -qi "fetched"; then - STATUS="Download complete..." - PROGRESS=60 - PHASE=5 - DOWNLOAD_INFO="" - elif echo "$LAST_LINES" | grep -qi "selecting\|unpacking"; then - local PKG_NAME=$(echo "$LAST_LINES" | grep -oi "unpacking [^ ]*" | tail -1 | cut -d' ' -f2) - if [ -n "$PKG_NAME" ]; then - STATUS="Unpacking ${PKG_NAME:0:20}..." - else - STATUS="Unpacking packages..." - fi - if [ $PHASE -lt 6 ]; then - PROGRESS=65 - PHASE=6 - elif [ $PROGRESS -lt 80 ]; then - PROGRESS=$((PROGRESS + 1)) - fi - elif echo "$LAST_LINES" | grep -qi "setting up"; then - local PKG_NAME=$(echo "$LAST_LINES" | grep -oi "setting up [^ ]*" | tail -1 | cut -d' ' -f3) - if [ -n "$PKG_NAME" ]; then - STATUS="Setting up ${PKG_NAME:0:20}..." - else - STATUS="Setting up packages..." - fi - if [ $PHASE -lt 7 ]; then - PROGRESS=85 - PHASE=7 - elif [ $PROGRESS -lt 95 ]; then - PROGRESS=$((PROGRESS + 1)) - fi - elif echo "$LAST_LINES" | grep -qi "processing triggers"; then - STATUS="Processing triggers..." - PROGRESS=95 - PHASE=8 - fi - fi - - local FILLED=$((PROGRESS * BAR_WIDTH / 100)) - local EMPTY=$((BAR_WIDTH - FILLED)) - - local BAR="" - for ((i=0; i/dev/null; then - local FULL_BAR="" - for ((i=0; i "$TEMP_LOG" 2>&1 & - PID=$! - - while kill -0 $PID 2>/dev/null; do - printf "\r\033[K ${YELLOW}${SPINNER[$SPINNER_IDX]}${RESET} ${DIM}Removing packages...${RESET}" - SPINNER_IDX=$(( (SPINNER_IDX + 1) % ${#SPINNER[@]} )) - sleep 0.1 - done - - wait $PID - local EXIT_CODE=$? - - printf "\r\033[K" - - if [ $EXIT_CODE -eq 0 ]; then - print_success "$JAVA_PKG uninstalled successfully" - else - print_warning "Some issues during uninstallation (continuing anyway)" - fi - - pkg autoremove -y &>/dev/null - - rm -f "$TEMP_LOG" - return 0 -} - -checkJavaAvailable() { - local JAVA_PKG="$1" - pkg search "$JAVA_PKG" 2>/dev/null | grep -q "^$JAVA_PKG\|/$JAVA_PKG" - return $? -} - -detectJavaVersion() { - if ! command -v java &>/dev/null; then - echo "none" - return - fi - - local JAVA_VER_OUTPUT=$(java -version 2>&1) - - local VERSION_LINE=$(echo "$JAVA_VER_OUTPUT" | head -1) - - if echo "$VERSION_LINE" | grep -qE "\"25\.|version \"25|openjdk 25| 25\."; then - echo "25" - elif echo "$VERSION_LINE" | grep -qE "\"21\.|version \"21|openjdk 21| 21\."; then - echo "21" - elif echo "$VERSION_LINE" | grep -qE "\"17\.|version \"17|openjdk 17| 17\."; then - echo "17" - else - local MAJOR_VER=$(echo "$VERSION_LINE" | grep -oE '[0-9]+' | head -1) - if [ "$MAJOR_VER" == "25" ]; then - echo "25" - elif [ "$MAJOR_VER" == "21" ]; then - echo "21" - elif [ "$MAJOR_VER" == "17" ]; then - echo "17" - else - echo "other" - fi - fi -} - -getJavaPackageName() { - local VERSION="$1" - case "$VERSION" in - "25") echo "openjdk-25" ;; - "21") echo "openjdk-21" ;; - "17") echo "openjdk-17" ;; - *) echo "openjdk-17" ;; - esac -} - -promptJavaUpgrade() { - local CURRENT_VERSION="$1" - - echo "" - echo -e "${YELLOW}╭──────────────────────────────────────────────────╮${RESET}" - echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${WHITE}${BOLD}⚡ Java Upgrade Recommendation${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${DIM}Current:${RESET} ${RED}openjdk-${CURRENT_VERSION}${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${DIM}Available:${RESET} ${GREEN}openjdk-25${RESET} ${CYAN}(Recommended)${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${DIM}Benefits:${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${GREEN}•${RESET} Better patching performance ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${GREEN}•${RESET} Latest tweaks & improvements ${YELLOW}│${RESET}" - echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" - echo -e "${YELLOW}╰──────────────────────────────────────────────────╯${RESET}" - echo "" - echo -ne " ${CYAN}➜${RESET} ${WHITE}Upgrade to openjdk-25? [y/N]: ${RESET}" - read -r UPGRADE_CHOICE - - if [[ "$UPGRADE_CHOICE" =~ ^[Yy]$ ]]; then - return 0 - else - return 1 - fi -} - -HELP="${BOLD}${CYAN}enhancify${RESET} - -${WHITE}Usage:${RESET} ${GREEN}enhancify${RESET} ${YELLOW}[OPTION]${RESET} - -${WHITE}Options:${RESET} - ${YELLOW}-f${RESET} Force re-install Enhancify - ${YELLOW}-u${RESET} Disable Update Check - ${YELLOW}-r${RESET} Disable Root access - ${YELLOW}-R${RESET} Disable Rish access - ${YELLOW}-v${RESET} Print current version - ${YELLOW}-h${RESET} Print help statement" - -while getopts ":furRvh" OPT 2> /dev/null; do - case $OPT in - f) - rm "$SRC/.info" &> /dev/null - ;; - u) - INTERNET_ACCESS=false - ;; - r) - ROOT_ACCESS=false - ;; - R) - RISH_ACCESS=false - ;; - v) - if [ -e "$SRC" ]; then - source "$SRC/.info" - echo -e "${GREEN}Version: ${WHITE}${BOLD}$VERSION${RESET}" - else - print_error "Enhancify not installed !!" - fi - exit - ;; - h) - echo -e "$HELP" - exit - ;; - ?) - print_error "Invalid option specified: ${YELLOW}-${OPTARG}${RESET}" - echo -e "$HELP" - exit 1 - ;; - esac -done - -terminate() { - killall -9 curl &> /dev/null - killall -9 wget &> /dev/null - clear - print_error "Script terminated !!" - exit 1 -} - -cleanup() { - tput cnorm 2>/dev/null -} - -trap cleanup EXIT -trap terminate SIGTERM SIGINT SIGABRT - -fixLibraryIssues() { - print_info "Checking for library issues..." - - if ! wget --version &> /dev/null; then - local ERROR_MSG=$(wget --version 2>&1) - - if grep -q "libandroid-posix-semaphore.so" <<< "$ERROR_MSG" || \ - grep -q "library.*not found" <<< "$ERROR_MSG"; then - - print_error "Critical: Detected library issue" - print_info "Attempting to fix..." - - print_step "Step 1: Updating packages..." - if pkg update -y 2>&1 | grep -q "libandroid-posix-semaphore.so"; then - apt update -y &> /dev/null - fi - - print_step "Step 2: Fixing missing library..." - pkg install libandroid-support libuuid libandroid-posix-semaphore -y &> /dev/null - - print_step "Step 3: Fixing broken dependencies..." - apt --fix-broken install -y &> /dev/null - - print_step "Step 4: Reinstalling wget..." - pkg install wget -y &> /dev/null - - print_step "Step 5: Upgrading packages..." - pkg upgrade -y &> /dev/null - - if wget --version &> /dev/null; then - print_success "Library issue fixed successfully!" - return 0 - else - print_warning "Unable to fix library issue automatically" - print_info "Switching to (Curl) download mechanism..." - return 0 - fi - fi - fi - - print_success "No library issues detected" - return 0 -} - -downloadFile() { - local URL="$1" - local OUTPUT="$2" - local SIZE="$3" - - if wget --version &> /dev/null; then - wget -q --show-progress "$URL" -O "$OUTPUT" - return $? - fi - - print_warning "Using curl as fallback..." - pkg install curl -y - curl -sL --progress-bar "$URL" -o "$OUTPUT" - return $? -} - -installDependencies() { - local BINS BIN CTR RESPONSE - local JAVA_VERSION_INSTALLED="" - local NEED_JAVA_INSTALL=false - local PKGS=() - - print_header "Installing Dependencies" - - if ! fixLibraryIssues; then - print_warning "Library issues failed to solve, using \"Curl\" mechanism..." - fi - - [ -e "$HOME/storage" ] || termux-setup-storage - - BINS=$(ls "$PREFIX/bin") - - local CURRENT_JAVA_VERSION=$(detectJavaVersion) - - if [ "$CURRENT_JAVA_VERSION" != "none" ]; then - print_info "Detected Java version: ${WHITE}${BOLD}openjdk-${CURRENT_JAVA_VERSION}${RESET}" - - if [ "$UPDATE_AVAILABLE" == true ]; then - if [ "$CURRENT_JAVA_VERSION" == "17" ] || [ "$CURRENT_JAVA_VERSION" == "21" ]; then - if checkJavaAvailable "openjdk-25"; then - if promptJavaUpgrade "$CURRENT_JAVA_VERSION"; then - local CURRENT_PKG=$(getJavaPackageName "$CURRENT_JAVA_VERSION") - uninstallJavaWithProgress "$CURRENT_PKG" - NEED_JAVA_INSTALL=true - JAVA_VERSION_INSTALLED="" - else - print_info "Keeping current Java version" - JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" - fi - else - print_info "openjdk-25 not available in repository, keeping current version" - JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" - fi - elif [ "$CURRENT_JAVA_VERSION" == "25" ]; then - print_success "Already running the latest Java version!" - JAVA_VERSION_INSTALLED="25" - else - JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" - fi - else - JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" - fi - else - NEED_JAVA_INSTALL=true - fi - - if [ "$NEED_JAVA_INSTALL" == true ] || [ -z "$JAVA_VERSION_INSTALLED" ]; then - print_info "Installing Java..." - echo "" - - echo -e "${CYAN}╭────────────────────────────────────────╮${RESET}" - echo -e "${CYAN}│${RESET} ${WHITE}${BOLD}☕ Java Installation${RESET} ${CYAN}│${RESET}" - echo -e "${CYAN}╰────────────────────────────────────────╯${RESET}" - echo "" - - print_step "Searching for openjdk-25..." - if checkJavaAvailable "openjdk-25"; then - print_success "openjdk-25 support detected in repository!" - echo "" - - if installJavaWithProgress "openjdk-25"; then - JAVA_VERSION_INSTALLED="25" - else - print_warning "openjdk-25 installation failed" - fi - else - print_warning "openjdk-25 not available in repository" - fi - - if [ -z "$JAVA_VERSION_INSTALLED" ]; then - echo "" - print_step "Trying openjdk-21..." - - if checkJavaAvailable "openjdk-21"; then - print_success "openjdk-21 detected in repository!" - echo "" - - if installJavaWithProgress "openjdk-21"; then - JAVA_VERSION_INSTALLED="21" - else - print_warning "Checking for library issues..." - fixLibraryIssues - - if installJavaWithProgress "openjdk-21"; then - JAVA_VERSION_INSTALLED="21" - else - print_warning "openjdk-21 installation failed" - fi - fi - else - print_warning "openjdk-21 not available in repository" - fi - fi - - if [ -z "$JAVA_VERSION_INSTALLED" ]; then - echo "" - print_warning "Falling back to openjdk-17..." - print_step "Trying openjdk-17..." - - if checkJavaAvailable "openjdk-17"; then - print_success "openjdk-17 detected in repository!" - echo "" - - if installJavaWithProgress "openjdk-17"; then - JAVA_VERSION_INSTALLED="17" - else - print_error "Failed to install openjdk-17!" - return 1 - fi - else - print_error "No compatible Java version found in repository!" - return 1 - fi - fi - - if [ -n "$JAVA_VERSION_INSTALLED" ]; then - echo -e "${GREEN}╭────────────────────────────────────────╮${RESET}" - echo -e "${GREEN}│${RESET} ${GREEN}✓${RESET} ${WHITE}Java ${BOLD}$JAVA_VERSION_INSTALLED${RESET}${WHITE} installed successfully!${RESET} ${GREEN}│${RESET}" - echo -e "${GREEN}╰────────────────────────────────────────╯${RESET}" - echo "" - fi - fi - - BINS=$(ls "$PREFIX/bin") - - grep -q wget <<< "$BINS" || PKGS+=("wget") - grep -q tput <<< "$BINS" || PKGS+=("ncurses-utils") - grep -q dialog <<< "$BINS" || PKGS+=("dialog") - grep -q pup <<< "$BINS" || PKGS+=("pup") - grep -q jq <<< "$BINS" || PKGS+=("jq") - grep -q aria2c <<< "$BINS" || PKGS+=("aria2") - grep -q '^unzip$' <<< "$BINS" || PKGS+=("unzip") - grep -q '^zip$' <<< "$BINS" || PKGS+=("zip") - - if [ "${#PKGS[@]}" -ne 0 ]; then - print_info "Installing packages: ${YELLOW}${PKGS[*]}${RESET}" - - if ! pkg update 2>&1; then - fixLibraryIssues - pkg update || return 1 - fi - - if ! yes | pkg install "${PKGS[@]}" 2>&1; then - fixLibraryIssues - yes | pkg install "${PKGS[@]}" || return 1 - fi - fi - - sed -i '/allow-external-apps/s/# //' "$HOME/.termux/termux.properties" 2>/dev/null - - [ -e "$SRC/bin" ] || mkdir -p "$SRC/bin" - - AAPT2="$SRC/bin/aapt2" - APK_EDITOR="$SRC/bin/APKEditor.jar" - - CTR=0 && while [ ! -e "$AAPT2" ]; do - [ $CTR -gt 2 ] && return 1 - echo "" - print_info "Downloading aapt2..." - echo "" - readarray -t RESPONSE < <(curl -s "https://api.github.com/repos/Graywizard888/Custom-Enhancify-aapt2-binary/releases/latest" | jq -r --arg ARCH "$(getprop ro.product.cpu.abi)" '.assets[] | if (.name | test($ARCH)) then (.browser_download_url, .size) else empty end' 2> /dev/null) - [ "${#RESPONSE[@]}" -eq 0 ] && return 1 - - downloadFile "${RESPONSE[0]}" "$AAPT2" - chmod +x "$AAPT2" - - if [ "${RESPONSE[1]}" == "$(stat -c %s "$AAPT2" 2> /dev/null)" ]; then - print_success "aapt2 downloaded successfully" - break - else - rm "$AAPT2" - print_warning "Download verification failed, retrying..." - fi - ((CTR++)) - done - - CTR=0 && while [ ! -e "$APK_EDITOR" ]; do - [ $CTR -gt 2 ] && return 1 - echo "" - print_info "Downloading APKEditor..." - echo "" - readarray -t RESPONSE < <(curl -s "https://api.github.com/repos/REAndroid/APKEditor/releases/latest" | jq -r '.assets[0] | .browser_download_url, .size' 2> /dev/null) - [ "${#RESPONSE[@]}" -eq 0 ] && return 1 - - downloadFile "${RESPONSE[0]}" "$APK_EDITOR" - - if [ "${RESPONSE[1]}" == "$(stat -c %s "$APK_EDITOR" 2> /dev/null)" ]; then - print_success "APKEditor downloaded successfully" - break - else - rm "$APK_EDITOR" - print_warning "Download verification failed, retrying..." - fi - ((CTR++)) - done - - print_success "All dependencies installed!" - return 0 -} - -fetchSrc() { - [ -e "$SRC/.info" ] && source "$SRC/.info" - - [ "$INTERNET_ACCESS" == false ] && return - - ping -c 1 github.com &> /dev/null || return - - print_header "Checking for Updates" - - print_info "Checking latest release..." - - TAG=$(curl -s 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') - - if [ "$TAG" == "$VERSION" ]; then - print_success "You're running the latest version ${GREEN}($VERSION)${RESET}" - return - fi - - UPDATE_AVAILABLE=true - - echo -e "${CYAN}╭─────────────────────────────────────────╮${RESET}" - echo -e "${CYAN}│${RESET} ${GREEN}🎉 Enhancify ${BOLD}$TAG${RESET}${GREEN} is available!${RESET} ${CYAN}│${RESET}" - echo -e "${CYAN}╰─────────────────────────────────────────╯${RESET}" - - print_info "Installing update..." - - downloadFile "https://github.com/Graywizard888/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" - - if [ -e "$TAG.zip" ]; then - unzip -qo "$TAG.zip" - rm -rf "$TAG.zip" - for CONTENT in Enhancify-*/* Enhancify-*/.*; do - rm -rf "${SRC:?}/$(basename "$CONTENT")" - mv "$CONTENT" "$SRC/" - done - rm -rf Enhancify-* &> /dev/null - cp -f "$SRC/enhancify" "$PREFIX/bin/enhancify" - chmod +x "$PREFIX/bin/enhancify" - - echo "" - print_success "Enhancify ${BOLD}$TAG${RESET}${GREEN} installed successfully!" - print_info "Launching in 2 seconds..." - sleep 2 - enhancify - exit - else - print_error "Unable to install Enhancify $TAG !!" - print_warning "Please try again with proper Internet" - exit 1 - fi -} - -clear - -echo -e "${BOLD}${MAGENTA}✦ ${CYAN}E N H A N C I F Y${RESET} ${BOLD}${MAGENTA}✦${RESET}" -echo "" - -[ -e "$SRC/.info" ] && source "$SRC/.info" -if [ "$INTERNET_ACCESS" != false ] && ping -c 1 -W 2 github.com &> /dev/null; then - TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/Graywizard888/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) - if [ -n "$TAG" ] && [ "$TAG" != "null" ] && [ "$TAG" != "$VERSION" ]; then - UPDATE_AVAILABLE=true - fi -fi - -if ! installDependencies; then - print_error "Dependencies not installed !!" - print_warning "Run again with stable internet connection." - exit 1 -fi - -fetchSrc - -if [ "$ROOT_ACCESS" != false ] && su -c 'exit' &> /dev/null; then - ROOT_ACCESS=true - RISH_ACCESS=false -elif [ "$RISH_ACCESS" != false ] && rish -c 'exit' &> /dev/null; then - ROOT_ACCESS=false - RISH_ACCESS=true -else - ROOT_ACCESS=false - RISH_ACCESS=false -fi - -cd "$SRC" &> /dev/null || terminate - -echo "" -print_info "Launching Enhancify..." -echo "" - -sleep 1 - -bash main.sh "$ROOT_ACCESS" "$RISH_ACCESS" -EXIT_CODE=$? - -if [ "$EXIT_CODE" -eq 0 ]; then - print_success "Enhancify exited successfully" -else - print_error "Enhancify exited with code: $EXIT_CODE" -fi - -exit "$EXIT_CODE" From 3146585a5501c38b7bb2dc0426a584c354e4a0c3 Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 18 Aug 2026 07:05:07 +0530 Subject: [PATCH 05/11] Delete install.sh --- install.sh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 install.sh diff --git a/install.sh b/install.sh deleted file mode 100644 index 944b8f6..0000000 --- a/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/bash -[ -z "$TERMUX_VERSION" ] && echo -e "Termux not detected !!" && exit 1 -BIN="$PREFIX/bin/enhancify" -curl -sL "https://github.com/Graywizard888/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" -[ -e "$BIN" ] && chmod +x "$BIN" && "$BIN" From b174296b56597a15efba074602d2fa9f0cbe8c67 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Sat, 22 Aug 2026 08:30:28 -0400 Subject: [PATCH 06/11] feat: redirect self-update to fork and add release workflow - enhancify launcher now checks jairjacom/Enhancify releases (not upstream) - install.sh downloads launcher from jairjacom fork - SpecManager.sh changelog fetch points to jairjacom/Enhancify - Restore enhancify and install.sh (deleted upstream in v6.2.2) - Add GitHub Actions workflow: auto-creates release on version tag push --- .github/workflows/release.yml | 42 ++ enhancify | 762 ++++++++++++++++++++++++++++++++++ install.sh | 5 + modules/SpecManager.sh | 2 +- 4 files changed, 810 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 enhancify create mode 100644 install.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9c59b9b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Create Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + name: Create GitHub Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.VERSION }} + name: Enhancify ${{ steps.version.outputs.VERSION }} + body: | + ## Enhancify ${{ steps.version.outputs.VERSION }} + + Fork maintained by [@jairjacom](https://github.com/jairjacom). + + ### Changes in this fork + - rish banner fix: strips "Entering shell..." output from Shizuku (thedjchi fork, Android 17 dev) so Rish mode works correctly on Pixel 9 Pro XL + + ### Install + ```bash + pkg update && pkg upgrade -y && pkg install git -y && termux-setup-storage && git clone https://github.com/jairjacom/Enhancify.git && cd Enhancify && bash install.sh + ``` + draft: false + prerelease: false diff --git a/enhancify b/enhancify new file mode 100644 index 0000000..3782f72 --- /dev/null +++ b/enhancify @@ -0,0 +1,762 @@ +#!/data/data/com.termux/files/usr/bin/bash + +SRC="$HOME/Enhancify" + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +BLUE='\033[0;34m' +MAGENTA='\033[0;35m' +CYAN='\033[0;36m' +WHITE='\033[1;37m' +BOLD='\033[1m' +RESET='\033[0m' + +LIGHT_GREEN='\033[1;32m' +LIGHT_CYAN='\033[1;36m' +LIGHT_YELLOW='\033[1;33m' +DIM='\033[2m' + +SUCCESS="${GREEN}✓${RESET}" +ERROR="${RED}✗${RESET}" +WARNING="${YELLOW}⚠${RESET}" +INFO="${CYAN}ℹ${RESET}" +ARROW="${MAGENTA}➜${RESET}" + +UPDATE_AVAILABLE=false + +print_success() { + echo -e "${SUCCESS} ${GREEN}$1${RESET}" +} + +print_error() { + echo -e "${ERROR} ${RED}$1${RESET}" +} + +print_warning() { + echo -e "${WARNING} ${YELLOW}$1${RESET}" +} + +print_info() { + echo -e "${INFO} ${CYAN}$1${RESET}" +} + +print_step() { + echo -e "${ARROW} ${WHITE}$1${RESET}" +} + +print_header() { + echo -e "\n${BOLD}${MAGENTA}══════════════════════════════════════${RESET}" + echo -e "${BOLD}${WHITE} $1${RESET}" + echo -e "${BOLD}${MAGENTA}══════════════════════════════════════${RESET}\n" +} + +installJavaWithProgress() { + local JAVA_PKG="$1" + local TEMP_LOG=$(mktemp) + local PID + + tput civis 2>/dev/null + + local SPINNER=('⣾' '⣽' '⣻' '⢿' '⡿' '⣟' '⣯' '⣷') + local SPINNER_IDX=0 + + local BAR_WIDTH=30 + local PROGRESS=0 + local STATUS="Initializing..." + local DOWNLOAD_INFO="" + local PHASE=0 + + local BAR_FILLED="━" + local BAR_EMPTY="─" + local BAR_HEAD="▶" + + pkg install "$JAVA_PKG" -y > "$TEMP_LOG" 2>&1 & + PID=$! + + echo "" + echo "" + echo "" + + while kill -0 $PID 2>/dev/null; do + if [ -f "$TEMP_LOG" ]; then + local LAST_LINES=$(tail -5 "$TEMP_LOG" 2>/dev/null) + + if echo "$LAST_LINES" | grep -qi "reading package"; then + STATUS="Reading package lists..." + PROGRESS=5 + PHASE=1 + elif echo "$LAST_LINES" | grep -qi "building dependency"; then + STATUS="Building dependency tree..." + PROGRESS=10 + PHASE=2 + elif echo "$LAST_LINES" | grep -qi "the following.*packages will be"; then + STATUS="Resolving dependencies..." + PROGRESS=15 + PHASE=3 + elif echo "$LAST_LINES" | grep -qi "need to get\|get:"; then + local DL_INFO=$(echo "$LAST_LINES" | grep -oi "get:[0-9]*.*" | tail -1) + if [ -n "$DL_INFO" ]; then + DOWNLOAD_INFO="${DL_INFO:0:35}" + fi + STATUS="Downloading packages..." + if [ $PHASE -lt 4 ]; then + PROGRESS=20 + PHASE=4 + elif [ $PROGRESS -lt 55 ]; then + PROGRESS=$((PROGRESS + 1)) + fi + elif echo "$LAST_LINES" | grep -qi "fetched"; then + STATUS="Download complete..." + PROGRESS=60 + PHASE=5 + DOWNLOAD_INFO="" + elif echo "$LAST_LINES" | grep -qi "selecting\|unpacking"; then + local PKG_NAME=$(echo "$LAST_LINES" | grep -oi "unpacking [^ ]*" | tail -1 | cut -d' ' -f2) + if [ -n "$PKG_NAME" ]; then + STATUS="Unpacking ${PKG_NAME:0:20}..." + else + STATUS="Unpacking packages..." + fi + if [ $PHASE -lt 6 ]; then + PROGRESS=65 + PHASE=6 + elif [ $PROGRESS -lt 80 ]; then + PROGRESS=$((PROGRESS + 1)) + fi + elif echo "$LAST_LINES" | grep -qi "setting up"; then + local PKG_NAME=$(echo "$LAST_LINES" | grep -oi "setting up [^ ]*" | tail -1 | cut -d' ' -f3) + if [ -n "$PKG_NAME" ]; then + STATUS="Setting up ${PKG_NAME:0:20}..." + else + STATUS="Setting up packages..." + fi + if [ $PHASE -lt 7 ]; then + PROGRESS=85 + PHASE=7 + elif [ $PROGRESS -lt 95 ]; then + PROGRESS=$((PROGRESS + 1)) + fi + elif echo "$LAST_LINES" | grep -qi "processing triggers"; then + STATUS="Processing triggers..." + PROGRESS=95 + PHASE=8 + fi + fi + + local FILLED=$((PROGRESS * BAR_WIDTH / 100)) + local EMPTY=$((BAR_WIDTH - FILLED)) + + local BAR="" + for ((i=0; i/dev/null; then + local FULL_BAR="" + for ((i=0; i "$TEMP_LOG" 2>&1 & + PID=$! + + while kill -0 $PID 2>/dev/null; do + printf "\r\033[K ${YELLOW}${SPINNER[$SPINNER_IDX]}${RESET} ${DIM}Removing packages...${RESET}" + SPINNER_IDX=$(( (SPINNER_IDX + 1) % ${#SPINNER[@]} )) + sleep 0.1 + done + + wait $PID + local EXIT_CODE=$? + + printf "\r\033[K" + + if [ $EXIT_CODE -eq 0 ]; then + print_success "$JAVA_PKG uninstalled successfully" + else + print_warning "Some issues during uninstallation (continuing anyway)" + fi + + pkg autoremove -y &>/dev/null + + rm -f "$TEMP_LOG" + return 0 +} + +checkJavaAvailable() { + local JAVA_PKG="$1" + pkg search "$JAVA_PKG" 2>/dev/null | grep -q "^$JAVA_PKG\|/$JAVA_PKG" + return $? +} + +detectJavaVersion() { + if ! command -v java &>/dev/null; then + echo "none" + return + fi + + local JAVA_VER_OUTPUT=$(java -version 2>&1) + + local VERSION_LINE=$(echo "$JAVA_VER_OUTPUT" | head -1) + + if echo "$VERSION_LINE" | grep -qE "\"25\.|version \"25|openjdk 25| 25\."; then + echo "25" + elif echo "$VERSION_LINE" | grep -qE "\"21\.|version \"21|openjdk 21| 21\."; then + echo "21" + elif echo "$VERSION_LINE" | grep -qE "\"17\.|version \"17|openjdk 17| 17\."; then + echo "17" + else + local MAJOR_VER=$(echo "$VERSION_LINE" | grep -oE '[0-9]+' | head -1) + if [ "$MAJOR_VER" == "25" ]; then + echo "25" + elif [ "$MAJOR_VER" == "21" ]; then + echo "21" + elif [ "$MAJOR_VER" == "17" ]; then + echo "17" + else + echo "other" + fi + fi +} + +getJavaPackageName() { + local VERSION="$1" + case "$VERSION" in + "25") echo "openjdk-25" ;; + "21") echo "openjdk-21" ;; + "17") echo "openjdk-17" ;; + *) echo "openjdk-17" ;; + esac +} + +promptJavaUpgrade() { + local CURRENT_VERSION="$1" + + echo "" + echo -e "${YELLOW}╭──────────────────────────────────────────────────╮${RESET}" + echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${WHITE}${BOLD}⚡ Java Upgrade Recommendation${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${DIM}Current:${RESET} ${RED}openjdk-${CURRENT_VERSION}${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${DIM}Available:${RESET} ${GREEN}openjdk-25${RESET} ${CYAN}(Recommended)${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${DIM}Benefits:${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${GREEN}•${RESET} Better patching performance ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${GREEN}•${RESET} Latest tweaks & improvements ${YELLOW}│${RESET}" + echo -e "${YELLOW}│${RESET} ${YELLOW}│${RESET}" + echo -e "${YELLOW}╰──────────────────────────────────────────────────╯${RESET}" + echo "" + echo -ne " ${CYAN}➜${RESET} ${WHITE}Upgrade to openjdk-25? [y/N]: ${RESET}" + read -r UPGRADE_CHOICE + + if [[ "$UPGRADE_CHOICE" =~ ^[Yy]$ ]]; then + return 0 + else + return 1 + fi +} + +HELP="${BOLD}${CYAN}enhancify${RESET} + +${WHITE}Usage:${RESET} ${GREEN}enhancify${RESET} ${YELLOW}[OPTION]${RESET} + +${WHITE}Options:${RESET} + ${YELLOW}-f${RESET} Force re-install Enhancify + ${YELLOW}-u${RESET} Disable Update Check + ${YELLOW}-r${RESET} Disable Root access + ${YELLOW}-R${RESET} Disable Rish access + ${YELLOW}-v${RESET} Print current version + ${YELLOW}-h${RESET} Print help statement" + +while getopts ":furRvh" OPT 2> /dev/null; do + case $OPT in + f) + rm "$SRC/.info" &> /dev/null + ;; + u) + INTERNET_ACCESS=false + ;; + r) + ROOT_ACCESS=false + ;; + R) + RISH_ACCESS=false + ;; + v) + if [ -e "$SRC" ]; then + source "$SRC/.info" + echo -e "${GREEN}Version: ${WHITE}${BOLD}$VERSION${RESET}" + else + print_error "Enhancify not installed !!" + fi + exit + ;; + h) + echo -e "$HELP" + exit + ;; + ?) + print_error "Invalid option specified: ${YELLOW}-${OPTARG}${RESET}" + echo -e "$HELP" + exit 1 + ;; + esac +done + +terminate() { + killall -9 curl &> /dev/null + killall -9 wget &> /dev/null + clear + print_error "Script terminated !!" + exit 1 +} + +cleanup() { + tput cnorm 2>/dev/null +} + +trap cleanup EXIT +trap terminate SIGTERM SIGINT SIGABRT + +fixLibraryIssues() { + print_info "Checking for library issues..." + + if ! wget --version &> /dev/null; then + local ERROR_MSG=$(wget --version 2>&1) + + if grep -q "libandroid-posix-semaphore.so" <<< "$ERROR_MSG" || \ + grep -q "library.*not found" <<< "$ERROR_MSG"; then + + print_error "Critical: Detected library issue" + print_info "Attempting to fix..." + + print_step "Step 1: Updating packages..." + if pkg update -y 2>&1 | grep -q "libandroid-posix-semaphore.so"; then + apt update -y &> /dev/null + fi + + print_step "Step 2: Fixing missing library..." + pkg install libandroid-support libuuid libandroid-posix-semaphore -y &> /dev/null + + print_step "Step 3: Fixing broken dependencies..." + apt --fix-broken install -y &> /dev/null + + print_step "Step 4: Reinstalling wget..." + pkg install wget -y &> /dev/null + + print_step "Step 5: Upgrading packages..." + pkg upgrade -y &> /dev/null + + if wget --version &> /dev/null; then + print_success "Library issue fixed successfully!" + return 0 + else + print_warning "Unable to fix library issue automatically" + print_info "Switching to (Curl) download mechanism..." + return 0 + fi + fi + fi + + print_success "No library issues detected" + return 0 +} + +downloadFile() { + local URL="$1" + local OUTPUT="$2" + local SIZE="$3" + + if wget --version &> /dev/null; then + wget -q --show-progress "$URL" -O "$OUTPUT" + return $? + fi + + print_warning "Using curl as fallback..." + pkg install curl -y + curl -sL --progress-bar "$URL" -o "$OUTPUT" + return $? +} + +installDependencies() { + local BINS BIN CTR RESPONSE + local JAVA_VERSION_INSTALLED="" + local NEED_JAVA_INSTALL=false + local PKGS=() + + print_header "Installing Dependencies" + + if ! fixLibraryIssues; then + print_warning "Library issues failed to solve, using \"Curl\" mechanism..." + fi + + [ -e "$HOME/storage" ] || termux-setup-storage + + BINS=$(ls "$PREFIX/bin") + + local CURRENT_JAVA_VERSION=$(detectJavaVersion) + + if [ "$CURRENT_JAVA_VERSION" != "none" ]; then + print_info "Detected Java version: ${WHITE}${BOLD}openjdk-${CURRENT_JAVA_VERSION}${RESET}" + + if [ "$UPDATE_AVAILABLE" == true ]; then + if [ "$CURRENT_JAVA_VERSION" == "17" ] || [ "$CURRENT_JAVA_VERSION" == "21" ]; then + if checkJavaAvailable "openjdk-25"; then + if promptJavaUpgrade "$CURRENT_JAVA_VERSION"; then + local CURRENT_PKG=$(getJavaPackageName "$CURRENT_JAVA_VERSION") + uninstallJavaWithProgress "$CURRENT_PKG" + NEED_JAVA_INSTALL=true + JAVA_VERSION_INSTALLED="" + else + print_info "Keeping current Java version" + JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" + fi + else + print_info "openjdk-25 not available in repository, keeping current version" + JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" + fi + elif [ "$CURRENT_JAVA_VERSION" == "25" ]; then + print_success "Already running the latest Java version!" + JAVA_VERSION_INSTALLED="25" + else + JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" + fi + else + JAVA_VERSION_INSTALLED="$CURRENT_JAVA_VERSION" + fi + else + NEED_JAVA_INSTALL=true + fi + + if [ "$NEED_JAVA_INSTALL" == true ] || [ -z "$JAVA_VERSION_INSTALLED" ]; then + print_info "Installing Java..." + echo "" + + echo -e "${CYAN}╭────────────────────────────────────────╮${RESET}" + echo -e "${CYAN}│${RESET} ${WHITE}${BOLD}☕ Java Installation${RESET} ${CYAN}│${RESET}" + echo -e "${CYAN}╰────────────────────────────────────────╯${RESET}" + echo "" + + print_step "Searching for openjdk-25..." + if checkJavaAvailable "openjdk-25"; then + print_success "openjdk-25 support detected in repository!" + echo "" + + if installJavaWithProgress "openjdk-25"; then + JAVA_VERSION_INSTALLED="25" + else + print_warning "openjdk-25 installation failed" + fi + else + print_warning "openjdk-25 not available in repository" + fi + + if [ -z "$JAVA_VERSION_INSTALLED" ]; then + echo "" + print_step "Trying openjdk-21..." + + if checkJavaAvailable "openjdk-21"; then + print_success "openjdk-21 detected in repository!" + echo "" + + if installJavaWithProgress "openjdk-21"; then + JAVA_VERSION_INSTALLED="21" + else + print_warning "Checking for library issues..." + fixLibraryIssues + + if installJavaWithProgress "openjdk-21"; then + JAVA_VERSION_INSTALLED="21" + else + print_warning "openjdk-21 installation failed" + fi + fi + else + print_warning "openjdk-21 not available in repository" + fi + fi + + if [ -z "$JAVA_VERSION_INSTALLED" ]; then + echo "" + print_warning "Falling back to openjdk-17..." + print_step "Trying openjdk-17..." + + if checkJavaAvailable "openjdk-17"; then + print_success "openjdk-17 detected in repository!" + echo "" + + if installJavaWithProgress "openjdk-17"; then + JAVA_VERSION_INSTALLED="17" + else + print_error "Failed to install openjdk-17!" + return 1 + fi + else + print_error "No compatible Java version found in repository!" + return 1 + fi + fi + + if [ -n "$JAVA_VERSION_INSTALLED" ]; then + echo -e "${GREEN}╭────────────────────────────────────────╮${RESET}" + echo -e "${GREEN}│${RESET} ${GREEN}✓${RESET} ${WHITE}Java ${BOLD}$JAVA_VERSION_INSTALLED${RESET}${WHITE} installed successfully!${RESET} ${GREEN}│${RESET}" + echo -e "${GREEN}╰────────────────────────────────────────╯${RESET}" + echo "" + fi + fi + + BINS=$(ls "$PREFIX/bin") + + grep -q wget <<< "$BINS" || PKGS+=("wget") + grep -q tput <<< "$BINS" || PKGS+=("ncurses-utils") + grep -q dialog <<< "$BINS" || PKGS+=("dialog") + grep -q pup <<< "$BINS" || PKGS+=("pup") + grep -q jq <<< "$BINS" || PKGS+=("jq") + grep -q aria2c <<< "$BINS" || PKGS+=("aria2") + grep -q '^unzip$' <<< "$BINS" || PKGS+=("unzip") + grep -q '^zip$' <<< "$BINS" || PKGS+=("zip") + + if [ "${#PKGS[@]}" -ne 0 ]; then + print_info "Installing packages: ${YELLOW}${PKGS[*]}${RESET}" + + if ! pkg update 2>&1; then + fixLibraryIssues + pkg update || return 1 + fi + + if ! yes | pkg install "${PKGS[@]}" 2>&1; then + fixLibraryIssues + yes | pkg install "${PKGS[@]}" || return 1 + fi + fi + + sed -i '/allow-external-apps/s/# //' "$HOME/.termux/termux.properties" 2>/dev/null + + [ -e "$SRC/bin" ] || mkdir -p "$SRC/bin" + + AAPT2="$SRC/bin/aapt2" + APK_EDITOR="$SRC/bin/APKEditor.jar" + + CTR=0 && while [ ! -e "$AAPT2" ]; do + [ $CTR -gt 2 ] && return 1 + echo "" + print_info "Downloading aapt2..." + echo "" + readarray -t RESPONSE < <(curl -s "https://api.github.com/repos/Graywizard888/Custom-Enhancify-aapt2-binary/releases/latest" | jq -r --arg ARCH "$(getprop ro.product.cpu.abi)" '.assets[] | if (.name | test($ARCH)) then (.browser_download_url, .size) else empty end' 2> /dev/null) + [ "${#RESPONSE[@]}" -eq 0 ] && return 1 + + downloadFile "${RESPONSE[0]}" "$AAPT2" + chmod +x "$AAPT2" + + if [ "${RESPONSE[1]}" == "$(stat -c %s "$AAPT2" 2> /dev/null)" ]; then + print_success "aapt2 downloaded successfully" + break + else + rm "$AAPT2" + print_warning "Download verification failed, retrying..." + fi + ((CTR++)) + done + + CTR=0 && while [ ! -e "$APK_EDITOR" ]; do + [ $CTR -gt 2 ] && return 1 + echo "" + print_info "Downloading APKEditor..." + echo "" + readarray -t RESPONSE < <(curl -s "https://api.github.com/repos/REAndroid/APKEditor/releases/latest" | jq -r '.assets[0] | .browser_download_url, .size' 2> /dev/null) + [ "${#RESPONSE[@]}" -eq 0 ] && return 1 + + downloadFile "${RESPONSE[0]}" "$APK_EDITOR" + + if [ "${RESPONSE[1]}" == "$(stat -c %s "$APK_EDITOR" 2> /dev/null)" ]; then + print_success "APKEditor downloaded successfully" + break + else + rm "$APK_EDITOR" + print_warning "Download verification failed, retrying..." + fi + ((CTR++)) + done + + print_success "All dependencies installed!" + return 0 +} + +fetchSrc() { + [ -e "$SRC/.info" ] && source "$SRC/.info" + + [ "$INTERNET_ACCESS" == false ] && return + + ping -c 1 github.com &> /dev/null || return + + print_header "Checking for Updates" + + print_info "Checking latest release..." + + TAG=$(curl -s 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2> /dev/null | jq -r '.tag_name') + + if [ "$TAG" == "$VERSION" ]; then + print_success "You're running the latest version ${GREEN}($VERSION)${RESET}" + return + fi + + UPDATE_AVAILABLE=true + + echo -e "${CYAN}╭─────────────────────────────────────────╮${RESET}" + echo -e "${CYAN}│${RESET} ${GREEN}🎉 Enhancify ${BOLD}$TAG${RESET}${GREEN} is available!${RESET} ${CYAN}│${RESET}" + echo -e "${CYAN}╰─────────────────────────────────────────╯${RESET}" + + print_info "Installing update..." + + downloadFile "https://github.com/jairjacom/Enhancify/archive/refs/tags/$TAG.zip" "$TAG.zip" + + if [ -e "$TAG.zip" ]; then + unzip -qo "$TAG.zip" + rm -rf "$TAG.zip" + for CONTENT in Enhancify-*/* Enhancify-*/.*; do + rm -rf "${SRC:?}/$(basename "$CONTENT")" + mv "$CONTENT" "$SRC/" + done + rm -rf Enhancify-* &> /dev/null + cp -f "$SRC/enhancify" "$PREFIX/bin/enhancify" + chmod +x "$PREFIX/bin/enhancify" + + echo "" + print_success "Enhancify ${BOLD}$TAG${RESET}${GREEN} installed successfully!" + print_info "Launching in 2 seconds..." + sleep 2 + enhancify + exit + else + print_error "Unable to install Enhancify $TAG !!" + print_warning "Please try again with proper Internet" + exit 1 + fi +} + +clear + +echo -e "${BOLD}${MAGENTA}✦ ${CYAN}E N H A N C I F Y${RESET} ${BOLD}${MAGENTA}✦${RESET}" +echo "" + +[ -e "$SRC/.info" ] && source "$SRC/.info" +if [ "$INTERNET_ACCESS" != false ] && ping -c 1 -W 2 github.com &> /dev/null; then + TAG=$(curl -s --connect-timeout 5 'https://api.github.com/repos/jairjacom/Enhancify/releases/latest' 2>/dev/null | jq -r '.tag_name' 2>/dev/null) + if [ -n "$TAG" ] && [ "$TAG" != "null" ] && [ "$TAG" != "$VERSION" ]; then + UPDATE_AVAILABLE=true + fi +fi + +if ! installDependencies; then + print_error "Dependencies not installed !!" + print_warning "Run again with stable internet connection." + exit 1 +fi + +fetchSrc + +if [ "$ROOT_ACCESS" != false ] && su -c 'exit' &> /dev/null; then + ROOT_ACCESS=true + RISH_ACCESS=false +elif [ "$RISH_ACCESS" != false ] && rish -c 'exit' &> /dev/null; then + ROOT_ACCESS=false + RISH_ACCESS=true +else + ROOT_ACCESS=false + RISH_ACCESS=false +fi + +cd "$SRC" &> /dev/null || terminate + +echo "" +print_info "Launching Enhancify..." +echo "" + +sleep 1 + +bash main.sh "$ROOT_ACCESS" "$RISH_ACCESS" +EXIT_CODE=$? + +if [ "$EXIT_CODE" -eq 0 ]; then + print_success "Enhancify exited successfully" +else + print_error "Enhancify exited with code: $EXIT_CODE" +fi + +exit "$EXIT_CODE" diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..4469b1a --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +#!/data/data/com.termux/files/usr/bin/bash +[ -z "$TERMUX_VERSION" ] && echo -e "Termux not detected !!" && exit 1 +BIN="$PREFIX/bin/enhancify" +curl -sL "https://github.com/jairjacom/Enhancify/raw/refs/heads/main/enhancify" -o "$BIN" +[ -e "$BIN" ] && chmod +x "$BIN" && "$BIN" diff --git a/modules/SpecManager.sh b/modules/SpecManager.sh index b1c2bd5..9b806b3 100644 --- a/modules/SpecManager.sh +++ b/modules/SpecManager.sh @@ -38,7 +38,7 @@ get_version() { fetch_changelog() { local version="$1" - local repo="Graywizard888/Enhancify" + local repo="jairjacom/Enhancify" local temp_file="$HOME/Enhancify/changelog.json" if [ "$version" = "Not Found" ]; then From 332bc54baf241bac4b328a88f7a7ee8c99643b38 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Sat, 22 Aug 2026 08:58:46 -0400 Subject: [PATCH 07/11] feat: add daily auto-sync workflow with upstream Scheduled workflow runs daily at 9 AM UTC: - Checks if Graywizard888/Enhancify has a new release - If yes, merges upstream/main into fork main - Clean merge: pushes tag + creates GitHub release automatically - Conflict: aborts merge, opens a GitHub issue with fix instructions - Guards against duplicate tags before pushing --- .github/workflows/sync-upstream.yml | 154 ++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 .github/workflows/sync-upstream.yml diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 0000000..074d9b3 --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,154 @@ +name: Sync with Upstream + +on: + schedule: + - cron: '0 9 * * *' # Daily at 9 AM UTC + workflow_dispatch: # Manual trigger from GitHub Actions tab + +permissions: + contents: write + issues: write + +jobs: + sync: + name: Check and sync Graywizard upstream + runs-on: ubuntu-latest + + steps: + - name: Checkout fork (full history) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git identity + run: | + git config user.email "jjaco72@gmail.com" + git config user.name "jairjacom" + + - name: Add upstream and fetch + run: | + git remote add upstream https://github.com/Graywizard888/Enhancify.git + git fetch upstream --tags + + - name: Get upstream latest release tag + id: upstream + run: | + TAG=$(curl -sf https://api.github.com/repos/Graywizard888/Enhancify/releases/latest | jq -r '.tag_name // empty') + if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then + echo "No upstream release found — skipping" + echo "tag=" >> $GITHUB_OUTPUT + else + echo "tag=$TAG" >> $GITHUB_OUTPUT + echo "Upstream latest: $TAG" + fi + + - name: Get fork latest release tag + id: fork + run: | + TAG=$(curl -sf https://api.github.com/repos/jairjacom/Enhancify/releases/latest | jq -r '.tag_name // empty') + echo "tag=$TAG" >> $GITHUB_OUTPUT + echo "Fork latest: $TAG" + + - name: Check if sync is needed + id: check + run: | + UPSTREAM="${{ steps.upstream.outputs.tag }}" + FORK="${{ steps.fork.outputs.tag }}" + if [ -z "$UPSTREAM" ]; then + echo "needed=false" >> $GITHUB_OUTPUT + echo "Upstream has no release — nothing to do" + elif [ "$UPSTREAM" = "$FORK" ]; then + echo "needed=false" >> $GITHUB_OUTPUT + echo "Already at $FORK — nothing to do" + else + echo "needed=true" >> $GITHUB_OUTPUT + echo "New upstream version detected: $UPSTREAM (fork has $FORK)" + fi + + - name: Attempt merge with upstream + if: steps.check.outputs.needed == 'true' + id: merge + run: | + git checkout main + if git merge upstream/main --no-edit; then + echo "success=true" >> $GITHUB_OUTPUT + echo "Merge clean" + else + git merge --abort + echo "success=false" >> $GITHUB_OUTPUT + echo "Merge conflict detected" + fi + + - name: Check tag does not already exist + if: steps.check.outputs.needed == 'true' && steps.merge.outputs.success == 'true' + id: tagcheck + run: | + TAG="${{ steps.upstream.outputs.tag }}" + if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then + echo "exists=true" >> $GITHUB_OUTPUT + echo "Tag $TAG already on fork — skipping tag push" + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Push main and create tag + if: steps.check.outputs.needed == 'true' && steps.merge.outputs.success == 'true' && steps.tagcheck.outputs.exists == 'false' + run: | + git push origin main + git tag ${{ steps.upstream.outputs.tag }} + git push origin ${{ steps.upstream.outputs.tag }} + + - name: Create GitHub release + if: steps.check.outputs.needed == 'true' && steps.merge.outputs.success == 'true' && steps.tagcheck.outputs.exists == 'false' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.upstream.outputs.tag }} + name: Enhancify ${{ steps.upstream.outputs.tag }} + body: | + ## Enhancify ${{ steps.upstream.outputs.tag }} + + Auto-synced from upstream [Graywizard888/Enhancify](https://github.com/Graywizard888/Enhancify). + Fork maintained by [@jairjacom](https://github.com/jairjacom). + + ### Fork changes included + - rish banner fix: strips "Entering shell..." from Shizuku output (thedjchi fork, Android 17 / Pixel 9 Pro XL) + + ### Install + ```bash + pkg update && pkg upgrade -y && pkg install git -y && termux-setup-storage && git clone https://github.com/jairjacom/Enhancify.git && cd Enhancify && bash install.sh + ``` + + - name: Open issue on merge conflict + if: steps.check.outputs.needed == 'true' && steps.merge.outputs.success == 'false' + uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: '⚠️ Manual sync needed — upstream ${{ steps.upstream.outputs.tag }} has conflicts', + body: [ + '## Auto-sync failed: merge conflict detected', + '', + 'Upstream **Graywizard888/Enhancify** released **${{ steps.upstream.outputs.tag }}** but it could not merge cleanly into this fork.', + '', + 'This usually means Graywizard modified one of the 4 rish fix files:', + '- `modules/system/rish.sh`', + '- `modules/system/root.sh`', + '- `system/rish-install.sh`', + '- `system/rish-uninstall.sh`', + '', + '### Steps to fix manually', + '```bash', + 'cd ~/projects/Enhancify', + 'git fetch upstream', + 'git merge upstream/main', + '# resolve conflicts — keep rish_c() wrapper in each file', + 'git push origin main', + 'git tag ${{ steps.upstream.outputs.tag }} && git push origin ${{ steps.upstream.outputs.tag }}', + '```', + '', + `[Failed workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})` + ].join('\n') + }); From 84797466530436a8ff11d7d82c74bdb1e2eda6ce Mon Sep 17 00:00:00 2001 From: jairjacom Date: Fri, 4 Sep 2026 15:58:06 -0400 Subject: [PATCH 08/11] fix: grant workflows write permission to sync-upstream action --- .github/workflows/sync-upstream.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 074d9b3..9f8a3d9 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -8,6 +8,7 @@ on: permissions: contents: write issues: write + workflows: write jobs: sync: From ffbf98bea207a05c5cf896e8ccdf1ce8845df238 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Fri, 4 Sep 2026 15:59:50 -0400 Subject: [PATCH 09/11] fix: strip workflow file changes from upstream merge (token can't push them) --- .github/workflows/sync-upstream.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 9f8a3d9..545c941 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -8,7 +8,6 @@ on: permissions: contents: write issues: write - workflows: write jobs: sync: @@ -72,7 +71,15 @@ jobs: id: merge run: | git checkout main + PRE_MERGE=$(git rev-parse HEAD) if git merge upstream/main --no-edit; then + # GITHUB_TOKEN can never push .github/workflows/ changes - strip any + # workflow file changes upstream brought in, keep everything else. + if ! git diff --quiet "$PRE_MERGE" HEAD -- .github/workflows/; then + git checkout "$PRE_MERGE" -- .github/workflows/ + git commit --amend --no-edit + echo "Stripped upstream workflow file changes (token restriction)" + fi echo "success=true" >> $GITHUB_OUTPUT echo "Merge clean" else From 933765c0124447d8678c50796d8393e608907161 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Fri, 4 Sep 2026 16:01:08 -0400 Subject: [PATCH 10/11] fix: force-create sync tag to avoid collision with upstream's same-named tag --- .github/workflows/sync-upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 545c941..caada12 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -104,7 +104,7 @@ jobs: if: steps.check.outputs.needed == 'true' && steps.merge.outputs.success == 'true' && steps.tagcheck.outputs.exists == 'false' run: | git push origin main - git tag ${{ steps.upstream.outputs.tag }} + git tag -f ${{ steps.upstream.outputs.tag }} git push origin ${{ steps.upstream.outputs.tag }} - name: Create GitHub release From 6983ac3a71852b6b3d28743e548f66a98532fd09 Mon Sep 17 00:00:00 2001 From: jairjacom Date: Sat, 5 Sep 2026 07:10:05 -0400 Subject: [PATCH 11/11] Adopt arena/PR #50 rish() wrapper, replacing our rish_c fix Our rish_c() wrapper only filtered stdout and used grep -v, which silently dropped real output when the banner shared a line with content (e.g. "Entering shell...Success"). The upstream PR #50 fix (built by arena-ai-coding-agent for Graywizard888) shadows rish() itself instead of requiring every call site to opt in, filters both stdout and stderr separately, and strips the banner as a prefix instead of deleting the whole line - fixing both gaps. Verified via bash -n on all touched files and a mock-rish smoke test covering banner-alone, banner+content same line, banner on stderr, no-banner backward compat, and exit-code preservation on failure. --- main.sh | 23 +++++++++++++++++++ modules/system/rish.sh | 28 +++++++++++------------ modules/system/root.sh | 6 ++--- system/rish-install.sh | 48 +++++++++++++++++++++++++++++----------- system/rish-uninstall.sh | 30 +++++++++++++++++++++---- 5 files changed, 99 insertions(+), 36 deletions(-) diff --git a/main.sh b/main.sh index 6dd7283..1b8f268 100644 --- a/main.sh +++ b/main.sh @@ -82,6 +82,29 @@ tput civis ROOT_ACCESS="$1" RISH_ACCESS="$2" +# Android 17 (dev preview) with the thedjchi Shizuku fork prints an +# "Entering shell..." banner (to stdout, and possibly stderr) before every +# command. It is emitted via println(), so it is always on its own line and +# the real command output follows it. We delete that banner line, and also +# strip the banner as a prefix if anything follows it on the same line, so +# captured output (e.g. `$(rish -c "...")`) is never polluted and real +# success/error output keeps priority. The real rish exit code is preserved. +rish() { + local _rish_err _rish_rc _rish_del _rish_strip + _rish_del='/^[[:space:]]*Entering shell\.\.*[[:space:]]*$/d' + _rish_strip='s/^[[:space:]]*Entering shell\.\.*[[:space:]]*//' + _rish_err=$(mktemp) 2>/dev/null + if [ -n "$_rish_err" ]; then + command rish "$@" 2>"$_rish_err" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + sed -e "$_rish_del" -e "$_rish_strip" "$_rish_err" >&2 + rm -f "$_rish_err" + else + command rish "$@" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + fi + return "$_rish_rc" +} for MODULE in $(find modules -type f -name "*.sh"); do source "$MODULE" diff --git a/modules/system/rish.sh b/modules/system/rish.sh index d313134..4a18bde 100644 --- a/modules/system/rish.sh +++ b/modules/system/rish.sh @@ -1,7 +1,5 @@ #!/usr/bin/bash -rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } - applyBackgroundWhitelist() { local PKG="$1" @@ -23,18 +21,18 @@ applyBackgroundWhitelist() { log "Applying background whitelist for $PKG..." local WL_OUTPUT - WL_OUTPUT=$(rish_c "cmd deviceidle whitelist +$PKG" 2>&1) + WL_OUTPUT=$(rish -c "cmd deviceidle whitelist +$PKG" 2>&1) log "deviceidle whitelist output: $WL_OUTPUT" local RIB_OUTPUT - RIB_OUTPUT=$(rish_c "cmd appops set $PKG RUN_IN_BACKGROUND allow" 2>&1) + RIB_OUTPUT=$(rish -c "cmd appops set $PKG RUN_IN_BACKGROUND allow" 2>&1) log "appops RUN_IN_BACKGROUND output: $RIB_OUTPUT" local RAIB_OUTPUT - RAIB_OUTPUT=$(rish_c "cmd appops set $PKG RUN_ANY_IN_BACKGROUND allow" 2>&1) + RAIB_OUTPUT=$(rish -c "cmd appops set $PKG RUN_ANY_IN_BACKGROUND allow" 2>&1) log "appops RUN_ANY_IN_BACKGROUND output: $RAIB_OUTPUT" - if rish_c "cmd deviceidle whitelist" 2>/dev/null | grep -q "$PKG"; then + if rish -c "cmd deviceidle whitelist" 2>/dev/null | grep -q "$PKG"; then log "Background whitelist: $PKG confirmed in device-idle whitelist." return 0 else @@ -72,7 +70,7 @@ runDexOptimization() { log "Executing: cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" local OPT_OUTPUT - OPT_OUTPUT=$(rish_c "cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" 2>&1) + OPT_OUTPUT=$(rish -c "cmd package compile -m $PROFILE_MODE $FORCE_FLAG $PKG" 2>&1) local OPT_EXIT_CODE=$? log "Optimization output: $OPT_OUTPUT" @@ -84,7 +82,7 @@ runDexOptimization() { if [ "$INSTALL_TYPE" == "update" ]; then log "Executing force-stop for updated app: $PKG" local FORCE_STOP_OUTPUT - FORCE_STOP_OUTPUT=$(rish_c "am force-stop $PKG" 2>&1) + FORCE_STOP_OUTPUT=$(rish -c "am force-stop $PKG" 2>&1) log "Force-stop output: $FORCE_STOP_OUTPUT" log "Force-stop completed for $PKG after speed optimization" fi @@ -107,7 +105,7 @@ runDexOptimization() { if [ "$INSTALL_TYPE" == "update" ]; then log "Executing force-stop for updated app: $PKG" local FORCE_STOP_OUTPUT - FORCE_STOP_OUTPUT=$(rish_c "am force-stop $PKG" 2>&1) + FORCE_STOP_OUTPUT=$(rish -c "am force-stop $PKG" 2>&1) log "Force-stop output: $FORCE_STOP_OUTPUT" log "Force-stop completed for $PKG after speed optimization" fi @@ -159,7 +157,7 @@ installAppRish() { cp -f "apps/$APP_NAME/$APP_VER-$SOURCE.apk" "$STORAGE/Patched/$EXPORTED_APK_NAME.apk" &> /dev/null log "Checking if $PATCHED_APP_PKG_NAME is installed" - local INSTALLED_PATCHED_VERSION=$(rish_c "dumpsys package $PATCHED_APP_PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + local INSTALLED_PATCHED_VERSION=$(rish -c "dumpsys package $PATCHED_APP_PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') if [ "$INSTALLED_PATCHED_VERSION" != "" ]; then INSTALL_TYPE="update" @@ -167,10 +165,10 @@ installAppRish() { log "Install type determined: UPDATE" log "Verifying signatures..." local STOCK_APP_PATH - if [ "$(rish_c "pm list packages --user current | grep -q $PATCHED_APP_PKG_NAME && echo Installed")" == "Installed" ]; then - STOCK_APP_PATH=$(rish_c "pm path --user current $PATCHED_APP_PKG_NAME | sed -n '/base/s/package://p'") + if [ "$(rish -c "pm list packages --user current | grep -q $PATCHED_APP_PKG_NAME && echo Installed")" == "Installed" ]; then + STOCK_APP_PATH=$(rish -c "pm path --user current $PATCHED_APP_PKG_NAME | sed -n '/base/s/package://p'") else - STOCK_APP_PATH=$(rish_c "dumpsys package $PATCHED_APP_PKG_NAME | sed -n 's/^[[:space:]]*path: \(.*base\.apk\)/\1/p'") + STOCK_APP_PATH=$(rish -c "dumpsys package $PATCHED_APP_PKG_NAME | sed -n 's/^[[:space:]]*path: \(.*base\.apk\)/\1/p'") log "Dumpsys used to get stock app path, that means the app is installed but in a different user." HIDDEN_APP_INSTALL=true fi @@ -233,7 +231,7 @@ installAppRish() { notify info "Please Wait !!\nUninstalling $PATCHED_APP_APP_NAME using Rish..." if uninstallAppRish false true "$STORAGE"; then log "Uninstallation successful, proceeding with installation." - if ! rish_c "dumpsys package $PATCHED_APP_PKG_NAME" 2>&1 | grep -q "Unable to find package"; then + if ! rish -c "dumpsys package $PATCHED_APP_PKG_NAME" 2>&1 | grep -q "Unable to find package"; then log "Found hidden installation post uninstallation. This might be a different user." HIDDEN_APP_INSTALL=true fi @@ -341,7 +339,7 @@ installAppRish() { log "Installation of $PATCHED_APP_APP_NAME $PATCHED_APP_VERSION completed successfully, finalized code." if [ "$LAUNCH_APP_AFTER_MOUNT" == "on" ]; then - rish_c "settings list secure | sed -n -e 's/\/.*//' -e 's/default_input_method=//p' | xargs am force-stop && pm resolve-activity --brief $PKG_NAME | tail -n 1 | xargs am start -n && am force-stop com.termux" &> /dev/null + rish -c "settings list secure | sed -n -e 's/\/.*//' -e 's/default_input_method=//p' | xargs am force-stop && pm resolve-activity --brief $PKG_NAME | tail -n 1 | xargs am start -n && am force-stop com.termux" &> /dev/null fi return 0 } diff --git a/modules/system/root.sh b/modules/system/root.sh index e02a69e..4ad02dd 100644 --- a/modules/system/root.sh +++ b/modules/system/root.sh @@ -1,13 +1,11 @@ #!/usr/bin/bash -rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } - getInstalledVersion() { if [ "$ROOT_ACCESS" == true ] && su -c "pm list packages | grep -q $PKG_NAME"; then INSTALLED_VERSION=$(su -c dumpsys package "$PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') # We use pm list and dumpsys as fallback. - elif [ "$RISH_ACCESS" = true ] && ( rish_c "pm list packages --user current | grep -q $PKG_NAME" || ! rish_c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package:" ); then - INSTALLED_VERSION=$(rish_c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + elif [ "$RISH_ACCESS" = true ] && ( rish -c "pm list packages --user current | grep -q $PKG_NAME" || ! rish -c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package:" ); then + INSTALLED_VERSION=$(rish -c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') fi } diff --git a/system/rish-install.sh b/system/rish-install.sh index bea2d9f..a9121b6 100644 --- a/system/rish-install.sh +++ b/system/rish-install.sh @@ -12,7 +12,29 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi -rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } +# Android 17 (dev preview) with the thedjchi Shizuku fork prints an +# "Entering shell..." banner (to stdout, and possibly stderr) before every +# command. It is emitted via println(), so it is always on its own line and +# the real command output follows it. We delete that banner line, and also +# strip the banner as a prefix if anything follows it on the same line, so +# captured output (e.g. `$(rish -c "...")`) is never polluted and real +# success/error output keeps priority. The real rish exit code is preserved. +rish() { + local _rish_err _rish_rc _rish_del _rish_strip + _rish_del='/^[[:space:]]*Entering shell\.\.*[[:space:]]*$/d' + _rish_strip='s/^[[:space:]]*Entering shell\.\.*[[:space:]]*//' + _rish_err=$(mktemp) 2>/dev/null + if [ -n "$_rish_err" ]; then + command rish "$@" 2>"$_rish_err" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + sed -e "$_rish_del" -e "$_rish_strip" "$_rish_err" >&2 + rm -f "$_rish_err" + else + command rish "$@" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + fi + return "$_rish_rc" +} log "" log " Initiating rish installation" @@ -21,7 +43,7 @@ log "app name: $APP_NAME" log "exported APK name: $EXPORTED_APK_NAME" log "" -CURRENT_USER=$(rish_c "am get-current-user" 2>/dev/null | tr -d '\r\n' | xargs) +CURRENT_USER=$(rish -c "am get-current-user" 2>/dev/null | tr -d '\r\n' | xargs) CURRENT_USER=${CURRENT_USER:-0} log "Current user: $CURRENT_USER" @@ -54,9 +76,9 @@ if [ -n "$INSTALL_TYPE_OVERRIDE" ]; then log "Install type override provided: $INSTALL_TYPE" else INSTALL_TYPE="new" - if [ "$(rish_c "pm list packages --user current | grep -q $PKG_NAME && echo Installed")" == "Installed" ]; then + if [ "$(rish -c "pm list packages --user current | grep -q $PKG_NAME && echo Installed")" == "Installed" ]; then INSTALL_TYPE="update" - CURRENT_VERSION=$(rish_c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') + CURRENT_VERSION=$(rish -c "dumpsys package $PKG_NAME" | sed -n '/versionName/s/.*=//p' | sed -n '1p') log "Existing installation detected (v$CURRENT_VERSION) - this will be an UPDATE" else log "No existing installation detected - this will be a NEW INSTALL" @@ -68,20 +90,20 @@ if [ -n "$STORAGE" ]; then log "Install type written to $STORAGE/install_type.txt: $INSTALL_TYPE" fi -if [ "$(rish_c "[ -d '/data/local/tmp/enhancify' ] && echo Exists || echo Missing")" == "Missing" ]; then - rish_c "mkdir '/data/local/tmp/enhancify'" +if [ "$(rish -c "[ -d '/data/local/tmp/enhancify' ] && echo Exists || echo Missing")" == "Missing" ]; then + rish -c "mkdir '/data/local/tmp/enhancify'" log "/data/local/tmp/enhancify created." fi -if [ "$(rish_c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Exists" ]; then - rish_c "rm $PATCHED_APP_PATH" +if [ "$(rish -c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Exists" ]; then + rish -c "rm $PATCHED_APP_PATH" log "Residual $PATCHED_APP_PATH deleted" fi log "Moving exported APK to /data/local/tmp/enhancify..." -rish_c "mv -f $EXPORTED_APP_PATH $PATCHED_APP_PATH" +rish -c "mv -f $EXPORTED_APP_PATH $PATCHED_APP_PATH" -if [ "$(rish_c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Missing" ]; then +if [ "$(rish -c "[ -e $PATCHED_APP_PATH ] && echo Exists || echo Missing")" == "Missing" ]; then log "Failed to move patched APK to $PATCHED_APP_PATH" [ -n "$STORAGE" ] && echo "Failed to stage APK for installation (move to /data/local/tmp failed)" > "$STORAGE/install_error.txt" exit 1 @@ -100,7 +122,7 @@ if [ "$BYPASS_LOW_TARGET_SDK_BLOCK" == "on" ]; then fi CMD_RISH="pm install -r -i com.android.vending$INSTALL_FLAGS --user current $PATCHED_APP_PATH" -OUTPUT=$(rish_c "$CMD_RISH" 2>&1) +OUTPUT=$(rish -c "$CMD_RISH" 2>&1) log "Install command: $CMD_RISH" log "Install output: $OUTPUT" @@ -126,7 +148,7 @@ parse_install_failure() { if echo "$OUTPUT" | grep -q "^Success"; then log "Install succeeded." - rish_c "rm -f $PATCHED_APP_PATH" + rish -c "rm -f $PATCHED_APP_PATH" [ -n "$STORAGE" ] && rm -f "$STORAGE/install_error.txt" exit 0 else @@ -137,6 +159,6 @@ else [ -n "$STORAGE" ] && echo "$FAILURE_REASON" > "$STORAGE/install_error.txt" log "Moving APK back to original location." - rish_c "mv -f $PATCHED_APP_PATH $EXPORTED_APP_PATH" + rish -c "mv -f $PATCHED_APP_PATH $EXPORTED_APP_PATH" exit 1 fi diff --git a/system/rish-uninstall.sh b/system/rish-uninstall.sh index 9f71b67..55ef880 100644 --- a/system/rish-uninstall.sh +++ b/system/rish-uninstall.sh @@ -10,7 +10,29 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi -rish_c() { rish -c "$@" | grep -v "^Entering shell\.\.\."; } +# Android 17 (dev preview) with the thedjchi Shizuku fork prints an +# "Entering shell..." banner (to stdout, and possibly stderr) before every +# command. It is emitted via println(), so it is always on its own line and +# the real command output follows it. We delete that banner line, and also +# strip the banner as a prefix if anything follows it on the same line, so +# captured output (e.g. `$(rish -c "...")`) is never polluted and real +# success/error output keeps priority. The real rish exit code is preserved. +rish() { + local _rish_err _rish_rc _rish_del _rish_strip + _rish_del='/^[[:space:]]*Entering shell\.\.*[[:space:]]*$/d' + _rish_strip='s/^[[:space:]]*Entering shell\.\.*[[:space:]]*//' + _rish_err=$(mktemp) 2>/dev/null + if [ -n "$_rish_err" ]; then + command rish "$@" 2>"$_rish_err" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + sed -e "$_rish_del" -e "$_rish_strip" "$_rish_err" >&2 + rm -f "$_rish_err" + else + command rish "$@" | sed -e "$_rish_del" -e "$_rish_strip" + _rish_rc=${PIPESTATUS[0]} + fi + return "$_rish_rc" +} # Uninstall command if [ "$UNINSTALL_FROM_ALL_USERS" = true ]; then @@ -20,7 +42,7 @@ else fi # Execute the uninstall command using rish -OUTPUT=$(rish_c "$CMD_RISH" 2>&1) +OUTPUT=$(rish -c "$CMD_RISH" 2>&1) log "Uninstall command: $CMD_RISH" log "Uninstall output: $OUTPUT" @@ -31,7 +53,7 @@ if echo "$OUTPUT" | grep -q "^Success"; then else log "Uninstall failed or with empty output, checking if package is still present." if [ "$UNINSTALL_FROM_ALL_USERS" == true ]; then - if rish_c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package"; then + if rish -c "dumpsys package $PKG_NAME" 2>&1 | grep -q "Unable to find package"; then log "Package $PKG_NAME no longer present in any user." exit 0 else @@ -39,7 +61,7 @@ else exit 1 fi else - if rish_c "pm list packages --user current" 2>&1 | grep -q "package:$PKG_NAME"; then + if rish -c "pm list packages --user current" 2>&1 | grep -q "package:$PKG_NAME"; then log "Package $PKG_NAME still present for current user." exit 1 else