termux-tools: add new system value TERMUX_MAIN_PACKAGE_FORMAT

This commit is contained in:
Maxython 2022-02-01 16:35:47 +03:00 committed by Henrik Grimler
parent ff70390e81
commit 16a6f0caad
3 changed files with 8 additions and 7 deletions

View File

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://termux.com/
TERMUX_PKG_DESCRIPTION="Basic system tools for Termux"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.160
TERMUX_PKG_VERSION=0.161
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_ESSENTIAL=true

View File

@ -23,6 +23,9 @@ else
done
fi
# for the correct operation of scripts that work with the package manager
export TERMUX_MAIN_PACKAGE_FORMAT="@TERMUX_PACKAGE_FORMAT@"
if [ -f @TERMUX_PREFIX@/lib/libtermux-exec.so ]; then
export LD_PRELOAD=@TERMUX_PREFIX@/lib/libtermux-exec.so
$SHELL -c "coreutils --coreutils-prog=true" > /dev/null 2>&1 || unset LD_PRELOAD

View File

@ -1,7 +1,5 @@
#!/bin/bash
TERMUX_PACKAGE_FORMAT="@TERMUX_PACKAGE_FORMAT@"
if [ "$#" != "0" ]; then
echo 'usage: termux-info'
echo 'Provides information about Termux, and the current system. Helpful for debugging.'
@ -14,9 +12,9 @@ updates() {
if [ "$(id -u)" = "0" ]; then
echo "Running as root. Cannot check package updates."
else
if [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ]; then
if [ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" ]; then
pacman -Sy >/dev/null 2>&1
updatable=$(pacman -Qeu)
updatable=$(pacman -Qu)
else
apt update >/dev/null 2>&1
updatable=$(apt list --upgradable 2>/dev/null | tail -n +2)
@ -86,7 +84,7 @@ fi
output+="Packages CPU architecture:
$(
if [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ]; then
if [ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" ]; then
pacman-conf | grep Architecture | sed 's/Architecture = //g'
else
dpkg --print-architecture
@ -94,7 +92,7 @@ $(
)
Subscribed repositories:
$(
if [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ]; then
if [ "$TERMUX_MAIN_PACKAGE_FORMAT" = "pacman" ]; then
repo_subscriptions_pacman
else
repo_subscriptions_apt