From 9c1d73d8a585c09f4e33f358621e691fd9c7119d Mon Sep 17 00:00:00 2001 From: shrx Date: Tue, 16 Jun 2026 08:51:35 +0200 Subject: [PATCH] Added(termux-install): Add command to install apps via the package installer, supporting split APK bundles --- CMakeLists.txt | 1 + scripts/termux-install.in | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 scripts/termux-install.in diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b1f9e..937e460 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ set(script_files scripts/termux-fingerprint scripts/termux-infrared-frequencies scripts/termux-infrared-transmit + scripts/termux-install scripts/termux-job-scheduler scripts/termux-keystore scripts/termux-location diff --git a/scripts/termux-install.in b/scripts/termux-install.in new file mode 100644 index 0000000..99acaf1 --- /dev/null +++ b/scripts/termux-install.in @@ -0,0 +1,31 @@ +#!@TERMUX_PREFIX@/bin/sh +set -e -u + +SCRIPTNAME=termux-install +show_usage () { + echo "Usage: $SCRIPTNAME file" + echo "Install an application, showing the system confirmation dialog." + echo "The argument may be a single .apk, a directory of split APKs, or a split" + echo "bundle (.apkm/.apks/.xapk) whose APKs are installed together as one session." + exit 0 +} + +while getopts :h option +do + case "$option" in + h) show_usage;; + ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;; + esac +done +shift $((OPTIND-1)) + +if [ $# = 0 ]; then echo "$SCRIPTNAME: missing file argument"; exit 1; fi +if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi + +if [ ! -e "$1" ]; then + echo "$1 does not exist" + exit 1 +fi + +# Note that the file path can contain whitespace. +@TERMUX_PREFIX@/libexec/termux-api Install --es file "$(realpath "$1")"