Skip to content

Instantly share code, notes, and snippets.

@haeramkeem
Last active April 16, 2022 12:14
Show Gist options
  • Save haeramkeem/492e0685498e159b6f72bb286e78a9d7 to your computer and use it in GitHub Desktop.
Save haeramkeem/492e0685498e159b6f72bb286e78a9d7 to your computer and use it in GitHub Desktop.
Download the debian packages with all dependencies included
#!/bin/bash
# download .deb from apt
# download the packages with all dependencies included from apt
# `grep -v "i386"` will discard all dependencies with i386 architecture
# ref: https://stackoverflow.com/a/45489718
# usage:
# $1: package name (only one permitted)
# $2: package save directory path (mkdir if path not found)
function dl_deb {
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
--no-pre-depends ${1} | grep "^\w" | grep -v "i386")
mkdir -pv $2
mv ./*.deb $2/.
}
# Usage Examples
dl_deb httpd .
@ProtoSeo
Copy link

감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment