Skip to content

Instantly share code, notes, and snippets.

@hhoover
Created August 9, 2011 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhoover/1135125 to your computer and use it in GitHub Desktop.
Save hhoover/1135125 to your computer and use it in GitHub Desktop.
lscloudkick function
#!/bin/bash
function ostype() {
if [ -e /etc/redhat-release ]; then
export distro="Redhat/CentOS"
else
if [ "$(lsb_release -d | awk '{print $2}')" == "Ubuntu" ];then
export distro="Ubuntu"
else
echo -e "could not detect operating system" && export distro="Other"
fi
fi
}
function lscloudkick() {
if [[ $distro = "Redhat/CentOS" ]]; then
cat > /etc/yum.repos.d/cloudkick.repo <<-EOF
[cloudkick]
name=Cloudkick
baseurl=http://packages.cloudkick.com/redhat/x86_64
gpgcheck=0
EOF
yum -y -q install cloudkick-agent
chkconfig cloudkick-agent on
echo -e "Please enter the login credentials and start the agent."
cloudkick-config
elif [ "${distro}" == "Ubuntu" ]; then
echo 'deb http://packages.cloudkick.com/ubuntu lucid main' > /etc/apt/sources.list.d/cloudkick.list
curl http://packages.cloudkick.com/cloudkick.packages.key | apt-key add -
apt-get -q update
apt-get -y -q install cloudkick-agent
echo -e "Please enter the login credentials and start the agent."
cloudkick-config
else
echo "Unsupported OS. See https://support.cloudkick.com/Category:Installing_Cloudkick"
exit
fi
}
ostype
lscloudkick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment