See https://github.com/termux/termux-packages/issues/5620.
Implements automatic mirror selection:
* Pick a random URL of top 4 mirrors of Termux main repository and use it during 30 minutes limit, then rotate to a new one. Distribute traffic accross multiple mirrors, including origin Bintray repository.
* During 30 minutes limit, let `pkg` to check whether mirror is accessible on each run. If mirror is not accessible, use a new one. Mirrors are not guaranteed to be 100% accessible, so let pkg to check which one is working before using `apt`.
* Skip rotating if using `.cn` mirrors - Chinese users will not want to use something else due to great firewall and download speed issues.
Set RWX permissions recursively on $PREFIX before deleting it. This
is needed to ensure that all files and directories can be deleted
by `rm`.
However this may not work if permissions were messed up with root.
* termux-tools: add termux-change-repo script
Simplifies changing repositories to a mirror, useful when Bintray downloads hit the roof
* *-repo: add etc/apt/sources.list.d/* to TERMUX_PKG_CONFFILES
Usage of package manager as root has certain bad effects in Termux such as
messed up SELinux contexts and ownership. Root checks done in 'pkg' wrapper
are not reliable because one can execute 'apt' directly or with third-party
script downloaded from the Internet.
This commit adds user id check and if it found that uid is 0, apt will
refuse to do any work in root session. These checks done in such way so
they cannot be bypassed in any way unless command is executed as non-root
user.
Those who use Termux via ADB root shell should be able to switch to Termux
user id with command 'su' in order to have package manager working.
---
This change also affects the 'termux-info' utility:
* It will no longer use 'apt policy' to detect subscribed repositories. Each
source will be checked by script manually.
* Information will be copied to clipboard only if 'termux-api' is installed.
* Syntax error in timeout command is fixed: 'timeout' doesn't understand the
argument '-t'.
* Minor information entries reordering.
When installing or searching for packages, the `apt update` will run only if it
was not executed within the last 5 minutes. Command `pkg upgrade` will
always execute `apt update` to ensure that latest package versions were
picked during upgrade.
Linter will check packages submitted for CI build. If error was found,
build will not be allowed.
To ensure that all build.sh scripts are consistent and have at least
minimal allowed quality, linter is permanently enabled for all branches
and pull requests.
Variables
TERMUX_PKG_PLATFORM_INDEPENDENT
TERMUX_DEBUG
TERMUX_PKG_HAS_DEBUG
TERMUX_PKG_ESSENTIAL
TERMUX_SUBPKG_ESSENTIAL
TERMUX_PKG_NO_STATICSPLIT
TERMUX_PKG_BUILD_IN_SRC
TERMUX_PKG_FORCE_CMAKE
TERMUX_PKG_HOSTBUILD
should not accept arbitrary values for marking them "enabled". Instead
they should accept boolean values which makes them easier to handle and
also makes their meaning clear.
build-package.sh should make decision based on variable's value but not on
whether it is set or empty.
%ci:no-build
Some packages are not getting installed after busybox was replaced by separate
packages. This commit should fix that by specifying core packages as dependencies
of the "termux-tools".
This mirrors the search order in the standard Android PATH, so that the
right tool is used consistently. This makes it easier for something like
Kernel Assisted Superuser to co-exist with Magisk.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Remove top both from busybox (which is broken on Android 8+), and
procps (which has issues on Android 8+) and use a system wrapper
in termux-tools instead.
As we now use bin/login even from e.g. sshd we need to handle
arguments by forwarding it to the login shell and not displaying
a motd in that case. Fixes#1529.
Previously the wrappers assumed that if
/system/bin/linker64
that LD_LIBRARY_PATH should be set to /system/lib64. This seems
to not always be the case (see #192) and hopefully the system
binaries should work without LD_LIBRARY_PATH being set, so we
just unset it before calling the system binary.
Previously the wrapper scripts for binaries in /system/bin used
/system/bin/getprop to determine if /system/lib or /system/lib64
should be used for the LD_LIBRARY_PATH.
We now switch to checking for /system/bin/linker64 which should be
more robust and faster. Fixes#214.
On several devices several tools in /system/bin/ requires
LD_LIBRARY_PATH to contain /system/lib(64). Check for the bit-ness
with `getprop ro.product.cpu.abilist64` and setup the environment
accordingly.
Closes#193.
Closes#206.
This fixes Android 6 problems (so closes#26).
It also rebuilds termux-elf-cleaner when needed
and bumps some build revisions for packages
needed updates to remove DT_VERDEF and DT_VERDEFNUM.