diff --git a/scripts/termux-open.in b/scripts/termux-open.in index 9c81630..541b797 100644 --- a/scripts/termux-open.in +++ b/scripts/termux-open.in @@ -43,8 +43,8 @@ fi case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac am broadcast --user "$TERMUX__USER_ID" \ - -a $ACTION \ - -n com.termux/com.termux.app.TermuxOpenReceiver \ + -a "$ACTION" \ + -n "@TERMUX_APP_PACKAGE@/@TERMUX_APP_PACKAGE@.app.TermuxOpenReceiver" \ $EXTRAS \ -d "$FILE" \ > /dev/null diff --git a/scripts/termux-reload-settings.in b/scripts/termux-reload-settings.in index 4e71f8a..25239a1 100644 --- a/scripts/termux-reload-settings.in +++ b/scripts/termux-reload-settings.in @@ -11,4 +11,4 @@ fi case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac -am broadcast --user "$TERMUX__USER_ID" -a com.termux.app.reload_style com.termux > /dev/null +am broadcast --user "$TERMUX__USER_ID" -a "@TERMUX_APP_PACKAGE@.app.reload_style" "@TERMUX_APP_PACKAGE@" > /dev/null diff --git a/scripts/termux-reset.in b/scripts/termux-reset.in index 6f807a7..aa14b7c 100644 --- a/scripts/termux-reset.in +++ b/scripts/termux-reset.in @@ -2,6 +2,9 @@ unset LD_PRELOAD LD_LIBRARY_PATH +AM_APK_PATH="@TERMUX_PREFIX@/libexec/termux-am/am.apk" +AM_APK_TMP_PATH="@TERMUX_CACHE_DIR@/termux-am/am.apk" + echo echo "You are going to reset your Termux installation." echo @@ -18,7 +21,7 @@ if ! [[ $CHOICE =~ (Y|y) ]]; then else HAS_TERMUX_AM=false - if [ -f "@TERMUX_PREFIX@/libexec/termux-am/am.apk" ]; then + if [ -f "$AM_APK_PATH" ]; then HAS_TERMUX_AM=true echo "Preserving package 'termux-am' for later use..." @@ -26,10 +29,10 @@ else if [ -d "@TERMUX_CACHE_DIR@" ]; then /system/bin/rm -rf "@TERMUX_CACHE_DIR@/termux-am" /system/bin/mkdir -p "@TERMUX_CACHE_DIR@/termux-am" - /system/bin/cp "@TERMUX_PREFIX@/libexec/termux-am/am.apk" "@TERMUX_CACHE_DIR@/termux-am/am.apk" + /system/bin/cp "$AM_APK_PATH" "$AM_APK_TMP_PATH" # In case copying am.apk failed. - if [ ! -e "@TERMUX_CACHE_DIR@/termux-am/am.apk" ]; then + if [ ! -e "$AM_APK_TMP_PATH" ]; then HAS_TERMUX_AM=false fi fi @@ -44,7 +47,12 @@ else echo "Terminating all sessions..." /system/bin/killall -9 "$SHELL" else - export CLASSPATH="@TERMUX_CACHE_DIR@/termux-am/am.apk" - /system/bin/app_process / com.termux.termuxam.Am stopservice com.termux/.app.TermuxService + # - https://github.com/termux/TermuxAm/commit/598a9c06 + if [ -w "$AM_APK_TMP_PATH" ]; then + chmod 0400 "$AM_APK_TMP_PATH" + fi + + export CLASSPATH="$AM_APK_TMP_PATH" + /system/bin/app_process -Xnoimage-dex2oat / "com.termux.termuxam.Am" stopservice "@TERMUX_APP_PACKAGE@/@TERMUX_APP_PACKAGE@.app.TermuxService" fi fi diff --git a/scripts/termux-setup-storage.in b/scripts/termux-setup-storage.in index c621234..51961ab 100644 --- a/scripts/termux-setup-storage.in +++ b/scripts/termux-setup-storage.in @@ -27,5 +27,6 @@ fi case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac am broadcast --user "$TERMUX__USER_ID" \ - --es com.termux.app.reload_style storage \ - -a com.termux.app.reload_style com.termux > /dev/null + -a "@TERMUX_APP_PACKAGE@.app.reload_style" \ + --es "@TERMUX_APP_PACKAGE@.app.reload_style" "storage" \ + "@TERMUX_APP_PACKAGE@" > /dev/null diff --git a/scripts/termux-wake-lock.in b/scripts/termux-wake-lock.in index ba4b899..088f55a 100644 --- a/scripts/termux-wake-lock.in +++ b/scripts/termux-wake-lock.in @@ -10,6 +10,6 @@ case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac am startservice \ --user "$TERMUX__USER_ID" \ - -a com.termux.service_wake_lock \ - com.termux/com.termux.app.TermuxService \ + -a "@TERMUX_APP_PACKAGE@.service_wake_lock" \ + "@TERMUX_APP_PACKAGE@/@TERMUX_APP_PACKAGE@.app.TermuxService" \ > /dev/null diff --git a/scripts/termux-wake-unlock.in b/scripts/termux-wake-unlock.in index a4b1f57..ca2ac6b 100644 --- a/scripts/termux-wake-unlock.in +++ b/scripts/termux-wake-unlock.in @@ -10,6 +10,6 @@ case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac am startservice \ --user "$TERMUX__USER_ID" \ - -a com.termux.service_wake_unlock \ - com.termux/com.termux.app.TermuxService \ + -a "@TERMUX_APP_PACKAGE@.service_wake_unlock" \ + "@TERMUX_APP_PACKAGE@/@TERMUX_APP_PACKAGE@.app.TermuxService" \ > /dev/null