Commit Graph

51 Commits

Author SHA1 Message Date
Zoey Mertes
8e6249f1bd
termux-tools: Add Purdue LUG mirror (#9553) 2022-03-30 02:30:03 +09:00
Henrik Grimler
c0f00c9137
termux-tools: pkg: convert spaces to tabs in indentation
%ci:no-build
2022-03-01 13:32:37 +01:00
Henrik Grimler
43f510f29b
termux-tools: pkg: add more mirrors to rotation list
To decrease load on individual mirrors.
2022-03-01 13:31:13 +01:00
Krishna Kanhaiya
12063e27dd
termux-tools: change domain name of github mirror (#9068) 2022-02-18 19:20:37 +05:30
Leonid Pliushch
43ab4e0881
termux-tools: pkg: use cloudflare-backed host as default
Switch users to packages-cf.termux.org as primary package server to
avoid DNS issues with FossHost endpoint. This also should improve
download speeds.

However apt default sources.list should still use packages.termux.org
2021-10-30 12:41:27 +03:00
Leonid Pliushch
f7142c23db
termux-tools: pkg: ensure that pkgcache exists before attempting to check modification time 2021-06-30 10:59:44 +03:00
Simeon Huang
8da081c823
termux-tools: add mirror termux.librehat.com (#7052) 2021-06-25 17:56:31 +03:00
Krishna Kanhaiya
ea9e90052c
Another Termux Mirror hosted on GH release. (#7034)
* Added another termux mirror
This mirror is hosting on Github release.

* Revised naming convention and sorted alphabetically
2021-06-20 18:24:10 +05:30
Leonid Pliushch
1952a8a2e7
termux-tools: update path for termux.mentality.rip mirror 2021-06-04 17:58:54 +03:00
Leonid Pliushch
a34fe61158
termux-tools: pkg: update list of repository urls 2021-06-03 01:46:49 +03:00
Leonid Pliushch
f38de1945b termux-tools: pkg: run apt update if no package list available for current mirror 2021-05-19 16:25:59 +03:00
Leonid Pliushch
c605627c40 termux-tools: pkg: fix possible case where $current_mirror receives a multiline value 2021-05-19 16:25:59 +03:00
Leonid Pliushch
1e5ca4b743 termux-tools: pkg: fix bug where last_modified returned negative values 2021-05-19 16:25:59 +03:00
Leonid Pliushch
cf3236e9e8 termux-tools: pkg: try to avoid cases where pkgcache is up-to-date but sources.list has been changed
A small percentage of users reporting issue where `pkg install` shows that
package is not available, though it is present in our apt repository. This
happens when sources.list has been changed without subsequent `apt update`.

Now `pkg` will force run `apt update` if sources.list was modified after
packages list update but cache still not expired.
2021-05-19 16:25:59 +03:00
Leonid Pliushch
03663a8e42
termux-tools: pkg: fix traffic share values
There should not be equal values.
2021-05-18 16:04:39 +03:00
Leonid Pliushch
d5fac3a9d7
termux-tools: pkg: get rid of redundant IPFS gateway, use dweb.link as IPFS gateway, recalculate traffic shares 2021-05-18 15:56:34 +03:00
Krishna Kanhaiya
e63d89bdc1
Added new repo/mirror (#6821) 2021-05-18 12:26:39 +05:30
Dario Vladovic
ecd1a46232 termux-tools: pkg: add hostname helper 2021-04-07 19:38:12 +03:00
Dario Vladovic
29e41670ed termux-tools: pkg: calculate cache age using last_modified 2021-04-07 19:38:12 +03:00
Dario Vladovic
a8d6930b8d termux-tools: pkg: extract mirror check to function 2021-04-07 19:38:12 +03:00
Dario Vladović
ac2ec670dd
termux-tools: pkg: add info as show alias (#6498) 2021-03-10 06:48:07 +01:00
Leonid Pliushch
b613af721f
termux-tools: pkg: replace ipfs.2read.net gateway
ipfs.2read.net has limited bandwidth which is a problem when downloading
large packages.
2021-02-15 20:41:15 +02:00
Leonid Pliushch
b10c5eb196
termux-tools: pkg: don't use ipfs.sloppyta.co due to aggressive caching
Clients using ipfs.sloppyta.co IPFS gateway won't see repo updates.

Use termux.mentality.rip web mirror as it seems working fine now.
2021-02-15 18:32:28 +02:00
Leonid Pliushch
d6cc31ce65
termux-tools: pkg: update ipfs gateways & mirrors list 2021-02-12 20:20:05 +02:00
Leonid Pliushch
130f10f0a1
termux-tools: pkg: rotate ipfs gateways and mirrors 2021-02-12 18:52:51 +02:00
Leonid Pliushch
b373b3dfff
termux-tools: pkg: replace main.termux-mirror.ml 2021-02-10 21:33:02 +02:00
Leonid Pliushch
058b1c7ad4
termux-tools: pkg: mirrors should not have same weight 2021-01-03 12:51:00 +02:00
Leonid Pliushch
4b8ffa260e
termux-tools: pkg: disable mirror termux.mentality.rip
Doesn't receive updates since December 25, 2020.
2021-01-02 23:05:36 +02:00
Leonid Pliushch
99fff21d87
termux-tools: pkg: use termux.org as primary mirror 2020-12-24 17:13:50 +02:00
Leonid Pliushch
c101139097
termux-tools: pkg: send more info in user-agent string
Send termux-tools package version, build-time app package name and
installation prefix. Just like with apt.
2020-12-24 17:13:45 +02:00
Leonid Pliushch
d98a741ac6 termux-tools: pkg: when checking mirrors, force terminate curl command after 6 seconds timeout
Before this, we had only '--connect-timeout 5' option specified but unfortunately
it doesn't work in cases when remote host is behind some proxy (e.g. CloudFlare)
but is not connected to Internet.

To prevent curl from hanging for unspecified amount of time, we need to introduce
external timeout here.
2020-11-12 20:02:17 +02:00
Leonid Pliushch
0cb1b82333 fix hardcoded Termux directories in mpd, renameutils, termux-tools 2020-10-30 22:15:19 +02:00
Leonid Pliushch
46425818bc termux-tools: avoid duplicate slashes in URLs when checking mirror availability
Really this is not an issue, but double slashes make logs looking a bit weird:

... "HEAD //dists/stable/Release HTTP/1.1" ...
2020-08-11 20:42:17 +03:00
Leonid Pliushch
fc0e77edb2 termux-tools: fix typo in pkg 2020-08-04 01:39:52 +03:00
Leonid Pliushch
578f66a5e3 termux-tools: use 5 seconds connection timeout when testing mirror availability 2020-08-02 01:50:34 +03:00
Leonid Pliushch
22a4bf8cfe termux-tools: use weight-based mirror selection (#5628)
* Weight-based mirror selection: do not give each mirror same usage ratio as hosts have different properties.
* Rotate mirrors after 6h: pkg now checks usability of all mirrors before selecting one, this takes time but we may want to reduce delays before the actual `apt` operation will be started.
* Update apt cache after 20min: reduce amount of necessary package list queries. We even can go with 1h, but since we prefer origin repository over mirrors as download source, 20 minutes should be fine.
2020-08-01 20:25:19 +03:00
Leonid Pliushch
0c682b3cd6 termux-tools: improve usage info for pkg
* Avoid long lines.
* Add missing info for some commands.
* Do not show deb cache size if its size cannot be determined, for example if cache dir was deleted.
2020-08-01 02:49:07 +03:00
buttaface
4801874eb6 termux-tools: add 'pkg autoclean' and command descriptions to help (#5627) 2020-08-01 15:21:10 +03:00
Leonid Pliushch
9c1635f1c3 termux-tools: fix path to pkgcache.bin after apt update, add support for pkg clean 2020-07-31 19:31:42 +03:00
Leonid Pliushch
c30de5e30b termux-tools: use https://termux.org/packages/ as fallback instead of direct Bintray URL 2020-07-31 14:29:31 +03:00
Leonid Pliushch
713c7160fc termux-tools: automatically pick a mirror by pkg (#5621)
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.
2020-07-31 14:18:43 +03:00
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
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
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
Guillermo Robles
78fc1f2328 Correct support of remove command in pkg
Fixes #3681
2019-04-16 17:59:53 +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
9e77a1160e packages->pkg in help text (#1599)
* packages->pkg in help text

* Fix pkg at a second placec
2017-10-01 21:42:37 +02:00
Fredrik Fornwall
207314894d termux-tools: Add 'pkg add' as alias install 2017-06-13 16:32:24 +02:00