Commit Graph

5 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
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
Henrik Grimler b3cdbc0402 termux-info: add subscribed repositories to printed info 2019-03-31 19:34:54 +02:00
Fredrik Fornwall b069947e0d termux-tools: Avoid pm list in termux-info (#1426) 2017-11-21 05:59:47 +01:00
Oliver Schmidhauser 833973d1be Add termux-info tool (#422)
* Add termux-info tool

* Add more information to termux-info

* Resolve conflicts. Add comment and fix Typo.

* remove empty lines in output
2017-04-09 00:07:06 +02:00