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.
This commit is contained in:
parent
c5eeff5b0b
commit
c101139097
@ -36,9 +36,12 @@ termux_step_make_install() {
|
||||
termux-open termux-open-url termux-reload-settings termux-reset \
|
||||
termux-setup-storage termux-wake-lock termux-wake-unlock termux-change-repo; do
|
||||
install -Dm700 $TERMUX_PKG_BUILDER_DIR/$script $TERMUX_PREFIX/bin/$script
|
||||
sed -i -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
|
||||
-e "s|@TERMUX_HOME@|${TERMUX_ANDROID_HOME}|g" \
|
||||
-e "s|@TERMUX_CACHE_DIR@|${TERMUX_CACHE_DIR}|g" \
|
||||
sed -i -e "s%\@TERMUX_APP_PACKAGE\@%${TERMUX_APP_PACKAGE}%g" \
|
||||
-e "s%\@TERMUX_BASE_DIR\@%${TERMUX_BASE_DIR}%g" \
|
||||
-e "s%\@TERMUX_CACHE_DIR\@%${TERMUX_CACHE_DIR}%g" \
|
||||
-e "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" \
|
||||
-e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" \
|
||||
-e "s%\@PACKAGE_VERSION\@%${TERMUX_PKG_VERSION}%g" \
|
||||
$TERMUX_PREFIX/bin/$script
|
||||
done
|
||||
|
||||
|
@ -63,7 +63,13 @@ select_mirror() {
|
||||
if [ -n "$(find @TERMUX_CACHE_DIR@/apt/pkgcache.bin -mmin -360 2>/dev/null)" ]; then
|
||||
if [ -n "${current_mirror}" ]; then
|
||||
echo -n "Checking availability of current mirror: "
|
||||
if timeout 6 curl --connect-timeout 5 --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${current_mirror%/}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
if timeout 6 curl \
|
||||
--head \
|
||||
--fail \
|
||||
--connect-timeout 5 \
|
||||
--location \
|
||||
--user-agent 'Termux-PKG/1.0 mirror-checker (termux-tools @PACKAGE_VERSION@) Termux (@TERMUX_APP_PACKAGE@; install-prefix:@TERMUX_PREFIX@)' \
|
||||
"${current_mirror%/}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
echo "ok"
|
||||
return
|
||||
else
|
||||
@ -77,7 +83,13 @@ select_mirror() {
|
||||
local w total_mirror_weight=0
|
||||
for w in "${!mirrors[@]}"; do
|
||||
echo -n "[*] ${mirrors[$w]}: "
|
||||
if timeout 6 curl --connect-timeout 5 --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${mirrors[$w]%/}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
if timeout 6 curl \
|
||||
--head \
|
||||
--fail \
|
||||
--connect-timeout 5 \
|
||||
--location \
|
||||
--user-agent 'Termux-PKG/1.0 mirror-checker (termux-tools @PACKAGE_VERSION@) Termux (@TERMUX_APP_PACKAGE@; install-prefix:@TERMUX_PREFIX@)' \
|
||||
"${mirrors[$w]%/}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
echo "ok"
|
||||
total_mirror_weight=$((total_mirror_weight + w))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user