Last active
April 16, 2022 12:14
-
-
Save haeramkeem/492e0685498e159b6f72bb286e78a9d7 to your computer and use it in GitHub Desktop.
Download the debian packages with all dependencies included
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
감사합니다.