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/.github/workflows/setup-build-tools.yml b/.github/workflows/setup-build-tools.yml index 0e78b2b..251d5e6 100644 --- a/.github/workflows/setup-build-tools.yml +++ b/.github/workflows/setup-build-tools.yml @@ -16,10 +16,10 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v7 + uses: actions/checkout@v6 - name: Set up JDK 17 - uses: actions/setup-java@v6 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '17' @@ -154,7 +154,7 @@ jobs: cat build-tools-info/version.txt - name: Cache Build Tools - uses: actions/cache@v6 + uses: actions/cache@v5 with: path: ${{ env.ANDROID_HOME }}/build-tools/${{ env.BUILD_TOOLS_VERSION }} key: android-build-tools-${{ runner.os }}-${{ env.BUILD_TOOLS_VERSION }} diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 0000000..caada12 --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,162 @@ +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 + 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 + 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 -f ${{ 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') + }); diff --git a/enhancify b/enhancify index f4c80b2..3782f72 100644 --- a/enhancify +++ b/enhancify @@ -669,7 +669,7 @@ 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 [ "$TAG" == "$VERSION" ]; then print_success "You're running the latest version ${GREEN}($VERSION)${RESET}" @@ -684,7 +684,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 +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/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" 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/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 diff --git a/system/rish-install.sh b/system/rish-install.sh index ce9bc4b..a9121b6 100644 --- a/system/rish-install.sh +++ b/system/rish-install.sh @@ -12,6 +12,30 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi +# 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" log "package: $PKG_NAME" diff --git a/system/rish-uninstall.sh b/system/rish-uninstall.sh index d64837b..55ef880 100644 --- a/system/rish-uninstall.sh +++ b/system/rish-uninstall.sh @@ -10,6 +10,30 @@ else log() { echo "- $1" >> "$STORAGE/rish_log.txt"; } fi +# 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 CMD_RISH="pm uninstall --user all $PKG_NAME"