This repository has been archived on 2020-01-17. You can view files and clone it, but cannot push or open issues or pull requests.
vn-repo/vn-deploy

31 lines
633 B
Plaintext
Raw Permalink Normal View History

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-08-29 15:25:01 +00:00
echo -e "\n# Upgrading servers"
2018-04-19 10:35:41 +00:00
2018-05-02 06:32:19 +00:00
for host in $hosts; do
2018-08-29 15:27:19 +00:00
echo -e "\n * Upgrading $host\n"
2019-03-28 16:24:46 +00:00
ssh $host "update-repo vn && TERM=dumb DEBIAN_FRONTEND=noninteractive apt-get -qq --yes install $packages"
2018-04-19 10:35:41 +00:00
done