2018-04-19 10:35:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2018-04-19 11:33:51 +00:00
|
|
|
hosts="$@"
|
2018-04-19 10:35:41 +00:00
|
|
|
|
2018-05-02 06:32:19 +00:00
|
|
|
if [ -z "$hosts" ]; then
|
|
|
|
echo "Usage: $(basename $0) [user1@]host1 [[user2@]host2]..."
|
2018-04-19 10:35:41 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
packages=""
|
|
|
|
|
2018-05-02 06:32:19 +00:00
|
|
|
while read -r line; do
|
2018-04-19 11:05:34 +00:00
|
|
|
packageName=$(echo $line | cut -d"_" -f1)
|
2018-04-19 10:35:41 +00:00
|
|
|
packages="$packages $packageName"
|
2018-04-19 11:05:34 +00:00
|
|
|
done < "$PWD/debian/files"
|
2018-04-19 10:35:41 +00:00
|
|
|
|
2018-05-02 06:32:19 +00:00
|
|
|
if [ -z "$packages" ]; then
|
2018-04-19 11:05:34 +00:00
|
|
|
echo "No packages found to install."
|
2018-04-19 10:35:41 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# FIXME: Packages are not upgraded when config files are changed
|
|
|
|
|
2018-04-19 12:05:16 +00:00
|
|
|
echo -e "\n# Upgrading servers\n"
|
2018-04-19 10:35:41 +00:00
|
|
|
|
2018-05-02 06:32:19 +00:00
|
|
|
for host in $hosts; do
|
2018-04-19 10:35:41 +00:00
|
|
|
echo " * Upgrading $host"
|
2018-05-02 06:32:19 +00:00
|
|
|
ssh $host "update-repo vn && apt-get --quiet --yes install $packages"
|
2018-04-19 10:35:41 +00:00
|
|
|
done
|