Sample Header Ad - 728x90

Fetch packages (and dependencies) using only the specified APT mirror

0 votes
1 answer
136 views
I am trying to fetch some .debs that I can install in an airgapped machine (which is also a different architecture). My idea is to pass some configuration options to apt so that it will only look at the specified mirrors (and avoid messing up the system I'm running this on).
LLVM_GPG_PATH=/tmp/llvm.gpg
curl -fsSL "https://apt.llvm.org/llvm-snapshot.gpg.key " | gpg --dearmor -o ${LLVM_GPG_PATH}

DEBIAN_GPG_PATH=/tmp/debian.gpg
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x80d15823b7fd1561f9f7bcdddc30d7c23cbbabee " | gpg --dearmor -o ${DEBIAN_GPG_PATH}

cat > /tmp/sources.list << EOF
deb [signed-by=${DEBIAN_GPG_PATH}] http://deb.debian.org/debian  buster main
deb [signed-by=${LLVM_GPG_PATH}] http://apt.llvm.org/buster/  llvm-toolchain-buster-18 main
EOF

apt update --option "Dir::State=/tmp/apt/"\
           --option "Dir::Etc::sourcelist=${STAGING_DIRECTORY}/apt/sources.list"\
           --option "APT::Architecture=arm64"\
           --option "APT::Architectures=arm64"

# Eventually do something like this:
# apt install --option "Dir::Etc::sourcelist=/tmp/sources.list"\
#             --option "Dir::Cache=/tmp/cache/"
#             --option "Dir::Cache::archives=/tmp/archives/"
#             --download-only
#             libc++-18-dev:arm64
When I run something like this, the apt update step prints out updates from the repos I added but also many others.
Hit:1 http://deb.debian.org/debian  buster InRelease
Hit:2 https://apt.llvm.org/buster  llvm-toolchain-buster-18 InRelease                                                             
Get:3 http://security.ubuntu.com/ubuntu  noble-security InRelease [126 kB]                                  
Get:4 http://archive.ubuntu.com/ubuntu  noble InRelease [256 kB]
Ign:5 http://security.ubuntu.com/ubuntu  noble-security/main arm64 Packages
Ign:6 http://security.ubuntu.com/ubuntu  noble-security/multiverse arm64 Packages
Ign:7 http://security.ubuntu.com/ubuntu  noble-security/universe arm64 Packages
...
How can I stop that? (Side question, is there an easier way to do this?)
Asked by digitalPhonix (3 rep)
Jul 19, 2024, 09:20 PM
Last activity: Aug 12, 2024, 10:16 AM