#!/bin/bash set -e hosts="$@" if [ -z "$hosts" ]; then echo "Usage: $(basename $0) [user1@]host1 [[user2@]host2]..." exit 1 fi packages="" while read -r line; do packageName=$(echo $line | cut -d"_" -f1) packages="$packages $packageName" done < "$PWD/debian/files" if [ -z "$packages" ]; then echo "No packages found to install." exit 1 fi # FIXME: Packages are not upgraded when config files are changed echo -e "\n# Upgrading servers" for host in $hosts; do echo -e "\n * Upgrading $host\n" ssh $host "update-repo vn && TERM=dumb DEBIAN_FRONTEND=noninteractive apt-get -qq --yes install $packages" done