2013-09-02 14:01:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-04-20 14:44:14 +00:00
|
|
|
#set -e
|
|
|
|
# not all breakage is un-recoverable...
|
2013-09-02 14:01:50 +00:00
|
|
|
|
|
|
|
cmd_hostname="$1"
|
|
|
|
if test -z "$cmd_hostname"; then
|
2013-10-31 22:26:16 +00:00
|
|
|
echo "Usage: $0 HOSTNAME REPO TAGPATTERN"
|
2013-09-02 14:01:50 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmd_repo="$2"
|
|
|
|
if test -z "$cmd_repo"; then
|
2013-10-31 22:26:16 +00:00
|
|
|
echo "Usage $0 HOSTNAME REPO TAGPATTERN"
|
2013-09-02 14:01:50 +00:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2013-10-31 22:26:16 +00:00
|
|
|
cmd_tags="$3"
|
|
|
|
if test -z "$cmd_tags"; then
|
|
|
|
echo "Usage $0 HOSTNAME REPO TAGPATTERN"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2016-04-20 14:44:14 +00:00
|
|
|
apt-get -y update
|
|
|
|
apt-get -y upgrade
|
2016-04-20 13:37:25 +00:00
|
|
|
for pkg in rsync git git-core wget; do
|
|
|
|
apt-get -y install $pkg
|
|
|
|
done
|
2016-08-28 19:22:48 +00:00
|
|
|
dpkg -i cosmos_1.5-1_all.deb
|
2013-09-02 14:01:50 +00:00
|
|
|
|
|
|
|
if ! test -d /var/cache/cosmos/repo; then
|
|
|
|
cosmos clone "$cmd_repo"
|
|
|
|
fi
|
|
|
|
|
|
|
|
hostname $cmd_hostname
|
|
|
|
|
|
|
|
perl -pi -e "s,#COSMOS_REPO_MODELS=.*,COSMOS_REPO_MODELS=\"\\\$COSMOS_REPO/global/:\\\$COSMOS_REPO/$cmd_hostname/\"," /etc/cosmos/cosmos.conf
|
2013-10-31 22:36:37 +00:00
|
|
|
perl -pi -e "s,#COSMOS_UPDATE_VERIFY_GIT_TAG_PATTERN=.*,COSMOS_UPDATE_VERIFY_GIT_TAG_PATTERN=\"${cmd_tags}*\"," /etc/cosmos/cosmos.conf
|
2013-09-02 14:01:50 +00:00
|
|
|
|
2013-10-31 21:18:39 +00:00
|
|
|
env COSMOS_BASE=/var/cache/cosmos COSMOS_KEYS=/var/cache/cosmos/repo/global/overlay/etc/cosmos/keys /var/cache/cosmos/repo/global/post-tasks.d/015cosmos-trust
|
2013-09-02 14:01:50 +00:00
|
|
|
|
2014-03-04 17:56:08 +00:00
|
|
|
(date; nohup cosmos -v update && nohup cosmos -v apply; date) 2>&1 | tee /var/log/cosmos.log
|
|
|
|
|
2013-09-02 14:01:50 +00:00
|
|
|
|
|
|
|
exit 0
|