Commit Graph

118 Commits

Author SHA1 Message Date
Leonid Pliushch
dc14c12940 apt: prevent usage of certain commands as root
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.
2019-11-13 16:38:40 +02:00
Efreak
63733da336 Don't run apt update if it's been run recently (#4135)
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.
2019-11-10 16:29:05 +02:00
Fredrik Fornwall
8bb0f44ad7 termux-tools: bump version 2019-10-06 10:00:12 +02:00
Fredrik Fornwall
8223845be1 termux-tools: Add /sbin to su path (fixes #4345) 2019-10-06 01:26:36 +02:00
Leonid Pliushch
f72f7bec3b termux-tools: bump version 2019-09-20 00:17:45 +03:00
Leonid Pliushch
ccb9ab922a termux-tools: use @TERMUX_PREFIX@ instead of path in sources
Ensure that scripts always use correct prefix-specific path.
2019-09-20 00:16:26 +03:00
Leonid Pliushch
51cdbe0073 termux-tools: use default shebang in sources
This will allow build system to set shebang according to the
current TERMUX_PREFIX.
2019-09-19 23:41:31 +03:00
Leonid Pliushch
4d3a6658d4 termux-tools: do not print motd on OpenSSH login when config PrintMotd=no
Now OpenSSH will not print motd on its own which may result in duplicate.
Instead it will control the login script via environment variable.

Fixes https://github.com/termux/termux-packages/issues/3941.
2019-09-06 01:59:07 +03:00
Leonid Pliushch
8701462951 add new linter script & fix packages where needed
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.
2019-08-14 14:27:55 +03:00
Leonid Pliushch
c352216c63 packages: standardize values of several control variables for build.sh
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
2019-08-12 18:49:13 +03:00
Leonid Pliushch
b563281d63 undo "Unsplit essential packages"
Seems it is not possible to unsplit these packages currently.

%ci:reset-backlog
2019-08-11 19:44:55 +03:00
Leonid Pliushch
eefe9fbe26 xz-utils: unsplit from liblzma
Same reason as for curl and bzip2.
2019-08-11 17:40:39 +03:00
Leonid Pliushch
864a138534 unsplit bzip2 from libbz2
Same reason as for 'curl'.
2019-08-11 17:40:39 +03:00
Leonid Pliushch
f9b5f96b5a libcurl: unsplit 'curl' subpackage
Both packages are essential and expect to be in bootstrap installation so
splitting is quite useless here.
2019-08-11 17:40:39 +03:00
Leonid Pliushch
e37b3fd5c4 termux-tools: add core packages to dependencies
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".
2019-08-05 13:46:51 +03:00
Leonid Pliushch
026ebfd1c1 termux-exec should be a dependency of termux-tools
Because it is used by login script and termux-tools is essential anyway.
2019-07-22 02:05:02 +03:00
Leonid Pliushch
4832078d86 reformat build.sh for some packages
* Packages where dependencies were sorted are bumped.
2019-07-22 01:51:28 +03:00
Leonid Pliushch
27856c752e termux-tools: provide wrapper for /system/bin/umount
Good addition since we already have wrapper for /system/bin/mount.
2019-07-01 23:43:43 +03:00
Leonid Pliushch
40db2641cf termux-tools: provide wrapper for /system/bin/mount
Right now Termux doesn't have utility 'mount' available. Also
on Samsung devices executing /system/bin/mount can cause
linking errors.

Issue https://github.com/termux/termux-packages/issues/4002.
2019-06-30 19:13:32 +03:00
Leonid Pliushch
935fa9f4c1 termux-tools: bump to v0.66 2019-05-06 23:24:31 +03:00
Leonid Pliushch
2e28a119ef termux-tools: prevent word-splitting of arguments with space 2019-05-06 23:22:47 +03:00
Leonid Pliushch
14e3026432 termux-tools: handle arguments for "pkg upgrade"
Fix for https://github.com/termux/termux-packages/issues/3758.
2019-05-06 23:21:38 +03:00
Henrik Grimler
498efb4601 termux-tools: bump revision 2019-04-16 19:46:27 +02:00
Guillermo Robles
78fc1f2328 Correct support of remove command in pkg
Fixes #3681
2019-04-16 17:59:53 +02:00
Leonid Pliushch
651b637ec5 termux-tools: bump version 2019-04-14 21:44:11 +03:00
Leonid Pliushch
cab8ab6c72 termux-tools: remove unneeded line 2019-04-14 21:39:21 +03:00
Leonid Pliushch
b285112c02 termux-tools: simplify notes about reporting issues 2019-04-14 21:39:21 +03:00
Leonid Pliushch
9660fbda37 termux-tools: remove mailing list from motd 2019-04-14 21:39:21 +03:00
Henrik Grimler
908c815e2d termux-tools: indent motd message 2019-04-14 21:39:21 +03:00
Leonid Pliushch
0adc9c5bb9 termux-tools: improve default motd 2019-04-14 21:39:21 +03:00
Leonid Pliushch
8d57afa4b0 Merge branch 'master' into app_995 2019-04-13 18:41:02 +03:00
Leonid Pliushch
5d29da3dc6 termux-tools: do not start login shell if not running on terminal
Fixes execution of commands via non-interactive shell with OpenSSH.
Issue https://github.com/termux/termux-packages/issues/3620.
2019-04-04 12:50:54 +03:00
Henrik Grimler
b3cdbc0402 termux-info: add subscribed repositories to printed info 2019-03-31 19:34:54 +02:00
Tom Yan
25612e0536 termux-tools: companion of termux/termux-app#1031 2019-02-12 11:15:39 +08:00
Wetitpig
5f8864c10d Improve formatting of parantheses for functions 2019-02-09 21:06:31 +02:00
Leonid Pliushch
47e114d0a8 termux-tools: do not provide file path with slash at the beginning
See https://github.com/termux/termux-app/issues/995.
2019-01-27 15:12:38 +01:00
Leonid Pliushch
2b72c14c4a termux-tools: distrubute under GPL-3.0
Same license as for Termux app.
2019-01-21 17:17:53 +02:00
Leonid Pliushch
46d333adba add licenses for more packages 2019-01-21 17:17:53 +02:00
Jason A. Donenfeld
db23fe725f termux-tools: use proper su search order
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>
2018-12-24 00:05:07 +01:00
Fredrik Fornwall
0a612d4a5c Use system top
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.
2018-11-28 03:02:11 +01:00
Leonid Pliushch
01e27ce4f8 termux-tools: export SHELL variable on login (#2632) 2018-07-14 00:02:50 +02:00
Fredrik Fornwall
59dcdde121 termux-tools: Bump version to 0.55 after su warning in pkg 2018-06-13 01:44:07 +02:00
Jonas L
50e0cb6a8b Add root check to pkg
This prevents users from using "su pkg ..." which breaks permissions
2018-06-13 01:34:48 +02:00
Oliver Schmidhauser
7f1e6c977a unset LD_PRELOAD in su because magist 16.4 is 32 bit only 2018-05-03 22:46:20 +02:00
its-pointless
4c95eb0d93 termux-tools: Work around for when termux-exec is broken 2018-02-21 00:08:15 +01:00
Fredrik Fornwall
e9cdab3c29 termux-tools: Depend on termux-am (fixes #2101) 2018-02-06 22:34:07 +01:00
Michał Bednarski
3aa671da67 termux-am: Add package 2018-02-05 00:19:21 +01:00
Fredrik Fornwall
3fc4aa5920 termux-tools: Unset LD_PRELOAD when calling system
Some 64-bit systems seems to have 32-bit binaries in /system/bin,
so unset LD_PRELOAD before calling them. See #551.
2018-01-24 17:20:25 +01:00
Fredrik Fornwall
b069947e0d termux-tools: Avoid pm list in termux-info (#1426) 2017-11-21 05:59:47 +01:00
Fredrik Fornwall
d3215a81dd termux-tools: Unset LD_PRELOAD in dalvikvm
See https://github.com/termux/termux-packages/issues/1736
2017-11-01 15:08:50 +01:00