Files
scylladb/scripts/scylla_install_pkg
Takuya ASADA a42b2bb0d6 dist/ami: Install scylla metapackage and debuginfo on AMI
Install scylla metapackage and debuginfo on AMI to make AMI to report bugs easier.
Fixes #1496

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1469635071-16821-1-git-send-email-syuu@scylladb.com>
(cherry picked from commit 9b59bb59f2)
2016-08-05 09:48:19 +03:00

85 lines
2.1 KiB
Bash
Executable File

#!/bin/bash -e
#
# Copyright (C) 2015 ScyllaDB
if [ "`id -u`" -ne 0 ]; then
echo "Requires root permission."
exit 1
fi
print_usage() {
echo "scylla_install_pkg --local-pkg /home/scylla/rpms --repo [URL]"
echo " --local-pkg install locally built .rpm/.deb on specified directory"
echo " --repo specify .repo/.list file URL"
exit 1
}
LOCAL_PKG=
UNSTABLE=0
REPO=
while [ $# -gt 0 ]; do
case "$1" in
"--local-pkg")
LOCAL_PKG=$2
shift 2
;;
"--repo")
REPO=$2
shift 2
;;
*)
print_usage
shift 1
;;
esac
done
. /etc/os-release
if [ "$ID" = "ubuntu" ]; then
echo "#!/bin/sh" >> /usr/sbin/policy-rc.d
echo "exit 101" >> /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
cp /etc/hosts /etc/hosts.orig
echo 127.0.0.1 `hostname` >> /etc/hosts
if [ "$REPO" != "" ]; then
curl -o /etc/apt/sources.list.d/scylla.list $REPO
fi
apt-get update
if [ "$LOCAL_PKG" = "" ]; then
apt-get install -y --force-yes scylla
else
if [ ! -f /usr/bin/gdebi ]; then
apt-get install -y --force-yes gdebi-core
fi
echo Y | gdebi $LOCAL_PKG/scylla-kernel-conf*.deb
echo Y | gdebi $LOCAL_PKG/scylla-conf*.deb
echo Y | gdebi $LOCAL_PKG/scylla-server_*.deb
echo Y | gdebi $LOCAL_PKG/scylla-server-dbg*.deb
echo Y | gdebi $LOCAL_PKG/scylla-jmx*.deb
echo Y | gdebi $LOCAL_PKG/scylla-tools*.deb
echo Y | gdebi $LOCAL_PKG/scylla_*.deb
fi
mv /etc/hosts.orig /etc/hosts
rm /usr/sbin/policy-rc.d
else
if [ "$REPO" != "" ]; then
curl -o /etc/yum.repos.d/scylla.repo $REPO
fi
if [ "$ID" = "centos" ]; then
yum install -y epel-release
elif [ "$ID" = "rhel" ]; then
rpm -ivh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm
else
echo "Unsupported distribution"
exit 1
fi
if [ "$LOCAL_PKG" = "" ]; then
yum install -y scylla
else
yum install -y $LOCAL_PKG/scylla-*.*.rpm
fi
fi