termux-packages/packages/termux-tools
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
..
build.sh apt: prevent usage of certain commands as root 2019-11-13 16:38:40 +02:00
chsh termux-tools: use @TERMUX_PREFIX@ instead of path in sources 2019-09-20 00:16:26 +03:00
dalvikvm termux-tools: Unset LD_PRELOAD in dalvikvm 2017-11-01 15:08:50 +01:00
login termux-tools: use @TERMUX_PREFIX@ instead of path in sources 2019-09-20 00:16:26 +03:00
motd termux-tools: remove unneeded line 2019-04-14 21:39:21 +03:00
pkg apt: prevent usage of certain commands as root 2019-11-13 16:38:40 +02:00
su termux-tools: Add /sbin to su path (fixes #4345) 2019-10-06 01:26:36 +02:00
termux-fix-shebang termux-tools: use @TERMUX_PREFIX@ instead of path in sources 2019-09-20 00:16:26 +03:00
termux-info apt: prevent usage of certain commands as root 2019-11-13 16:38:40 +02:00
termux-open termux-tools: use default shebang in sources 2019-09-19 23:41:31 +03:00
termux-open-url
termux-reload-settings termux-tools: use default shebang in sources 2019-09-19 23:41:31 +03:00
termux-setup-storage termux-tools: use default shebang in sources 2019-09-19 23:41:31 +03:00
termux-wake-lock
termux-wake-unlock