Skip to content

Instantly share code, notes, and snippets.

@briantissue
Last active May 17, 2017 14:28
Show Gist options
  • Save briantissue/3b8635fb5a4393978159f8d0fc51923d to your computer and use it in GitHub Desktop.
Save briantissue/3b8635fb5a4393978159f8d0fc51923d to your computer and use it in GitHub Desktop.
Ubuntu Air-Gapped Servers Package Retrieval
#!/bin/bash
# Used for Airgapped Ubuntu Servers; downloads package and required dependencies
# Just SCP them over to the server that needs them. Ensure OS/Kernel is the same on both.
# Feel free to comment if you have a suggestion to improve the script
read -p "Please enter the package name you would like to look for: " packagesearch
apt-cache search "$packagesearch"
read -p "Please enter the verified package name you would like to download: " package
apt-cache depends "$package" | grep Depends: >> deb.list
sed -i -e 's/[<>|:]//g' deb.list
sed -i -e 's/Depends//g' deb.list
sed -i -e 's/ //g' deb.list
filename="deb.list"
while read -r line
do
name="$line"
apt-get download "$name"
done < "$filename"
apt-get download "$package"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment