termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.17k stars 3.02k forks source link

[Pacman]: termux-change-repo #10952

Closed Sarisan closed 2 years ago

Sarisan commented 2 years ago

Problem description

termux-change-repo doesn't check if apt is installed, it starts without any message and finishes with next error if apt is not installed:

/data/data/com.termux/files/usr/bin/termux-change-repo: line 266: apt: command not found

What steps will reproduce the bug?

  1. Remove apt with pacman -Rns apt
  2. Run termux-change-repo
  3. Finish mirror setup

What is the expected behavior?

termux-change-repo should check if apt is installed before opening mirror setup or it should contain pacman mirrors too

System information

termux-info:

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=pacman
TERMUX_APP_PID=10800
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=pacman
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# /data/data/com.termux/files/usr/etc/pacman.conf
[main]
Server = https://s3.amazonaws.com/termux-main.pacman/aarch64
[x11]
Server = https://s3.amazonaws.com/termux-x11.pacman/aarch64
[root]
Server = https://s3.amazonaws.com/termux-root.pacman/aarch64
Updatable packages:
All packages up to date
termux-tools version:
0.186
Android version:
11
Kernel build information:
Linux localhost 4.14.245-QuicksilveR-ginkgo-v2.5/a2dbd412 #1 SMP PREEMPT Mon Oct 4 02:10:01 CEST 2021 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Redmi Note 8
agnostic-apollo commented 2 years ago

Probably needs something like following instead of just apt update, assuming pacman command is correct.

https://github.com/termux/termux-packages/blob/3ee0b7b09d27fec0292b2cf315e1c6bd38b2bcfb/packages/termux-tools/termux-change-repo#L266

# Setup TERMUX_APP_PACKAGE_MANAGER
source "@TERMUX_PREFIX@/bin/termux-setup-package-manager" || exit 1

case "$TERMUX_APP_PACKAGE_MANAGER" in
    apt) apt update;;
    pacman) pacman -Syy;;
esac
Maxython commented 2 years ago

or it should contain pacman mirrors too

Mirrors for pacman don't exist yet, so it doesn't make sense to configure termux-change-repo to work with pacman.

agnostic-apollo commented 2 years ago

Ah, right, I guess you can also just run apt update if if command -v apt 1>/dev/null for now.