1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#!/bin/bash -e # install the right packages function install_package { echo "Attempting to install $1" sudo apt-get install -y $dep echo "Attempt complete." } echo "Checking for required packages..." for dep in "apt-mirror" "zsync"; do if dpkg-query -s $dep 2>/dev/null |grep Status: |grep -q installed; then echo "$dep is installed..." else echo "$dep is not installed..." install_package $dep fi done |