Ksplice installer script

From CPanelDirect
Jump to: navigation, search
#!/bin/bash
# KSplice Uptrack Installer - detain@interserver.net
# Supports: CentOS, Fedora, Ubuntu, Debian, Oracle Linux, Redhat Enterprise Linux
if [ -e /usr/sbin/uptrack-upgrade ]; then
 echo "Already Installed"
else
 echo "Installing KSplice"
 API_ACCESS_KEY=3e6f6fb143b0088b2b8ad6f714d3b4a340d465f885cfa868ef4e46a77d1bb1ee
 if [ -e /etc/lsb-release ]; then
  . /etc/lsb-release
 elif [ -e /etc/debian_version ]; then
  DISTRIB_ID=Debian
  DISTRIB_CODENAME="$(cat /etc/debian_version | cut -d/ -f1)"
 else
  for i in centos redhat fedora; do
   if [ -e /etc/${i}-release ]; then
    DISTRIB_ID="$(cat /etc/${i}-release | cut -d" " -f1)"
   fi
  done
 fi
 echo "Distribution: $DISTRIB_ID"
 if [ "$DISTRIB_ID" = "Ubuntu" ]; then
  echo "deb http://www.ksplice.com/apt $DISTRIB_CODENAME ksplice"  > /etc/apt/sources.list.d/ksplice.list
  echo "deb-src http://www.ksplice.com/apt $DISTRIB_CODENAME ksplice" >> /etc/apt/sources.list.d/ksplice.list
  apt-get update
  apt-get install ca-certificates
  wget -N https://www.ksplice.com/apt/ksplice-archive.asc
  apt-key add ksplice-archive.asc
  apt-get update
  apt-get install uptrack
 elif [ "$DISTRIB_ID" = "Debian" ]; then
  echo "deb http://www.ksplice.com/apt $DISTRIB_CODENAME ksplice"  > /etc/apt/sources.list.d/ksplice.list
  echo "deb-src http://www.ksplice.com/apt $DISTRIB_CODENAME ksplice" >> /etc/apt/sources.list.d/ksplice.list
  apt-get update
  apt-get install ca-certificates
  wget -N https://www.ksplice.com/apt/ksplice-archive.asc
  apt-key add ksplice-archive.asc
  echo "uptrack uptrack/accesskey string $API_ACCESS_KEY" | debconf-set-selections
  apt-get update
  apt-get install uptrack
 elif [ "$DISTRIB_ID" = "CentOS" ]; then
  rpm -i http://www.ksplice.com/yum/uptrack/centos/ksplice-uptrack-release.noarch.rpm
  yum -y install uptrack
 elif [ "$DISTRIB_ID" = "Fedora" ]; then
  rpm -i http://www.ksplice.com/yum/uptrack/fedora/ksplice-uptrack-release.noarch.rpm
  yum -y install uptrack
 elif [ "$DISTRIB_ID" = "Oracle" ]; then
  rpm -i http://www.ksplice.com/yum/uptrack/ol/ksplice-uptrack-release.noarch.rpm
  yum -y install uptrack
 elif [ "$DISTRIB_ID" = "Redhat" ]; then
  rpm -i http://www.ksplice.com/yum/uptrack/rhel/ksplice-uptrack-release.noarch.rpm
  yum -y install uptrack
 else
  rpm -i http://www.ksplice.com/yum/uptrack/rhel/ksplice-uptrack-release.noarch.rpm
  yum -y install uptrack
 fi
 sed -i /etc/uptrack/uptrack.conf s#"INSERT_ACCESS_KEY"#"$API_ACCESS_KEY"#g
 sed -i /etc/uptrack/uptrack.conf s#"autoinstall = no"#"autoinstall = yes"#g
 /usr/sbin/uptrack-upgrade -y
fi