Files
scylladb/scripts/scylla_install_pkg
Takuya ASADA 88fde0a91e dist/ami: fix dependency unresolved error on AMI build script with local package, by adding scylla-conf package
Since we added scylla-conf package, we cannot install scylla-server/-tools without the package, because of this --localrpm is failing.
So copy scylla-conf package to AMI, and install it to fix the problem.
2016-05-19 06:26:23 +09:00

89 lines
2.5 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 repository 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
echo "deb http://s3.amazonaws.com/downloads.scylladb.com/deb/ubuntu trusty/scylladb multiverse" > /etc/apt/sources.list.d/scylla.list
else
echo "deb $REPO trusty/scylladb multiverse" > /etc/apt/sources.list.d/scylla.list
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-conf*.deb
echo Y | gdebi $LOCAL_PKG/scylla-server*.deb
echo Y | gdebi $LOCAL_PKG/scylla-jmx*.deb
echo Y | gdebi $LOCAL_PKG/scylla-tools*.deb
fi
mv /etc/hosts.orig /etc/hosts
rm /usr/sbin/policy-rc.d
else
if [ "$ID" = "fedora" ]; then
if [ "$REPO" = "" ]; then
curl http://downloads.scylladb.com/rpm/fedora/scylla.repo > /etc/yum.repos.d/scylla.repo
else
curl $REPO > /etc/yum.repos.d/scylla.repo
fi
elif [ "$ID" = "centos" ] || [ "$ID" = "rhel" ]; then
if [ "$REPO" = "" ]; then
curl http://downloads.scylladb.com/rpm/centos/scylla.repo > /etc/yum.repos.d/scylla.repo
else
curl $REPO > /etc/yum.repos.d/scylla.repo
fi
yum install -y epel-release
else
echo "Unsupported distribution"
exit 1
fi
if [ "$LOCAL_PKG" = "" ]; then
yum install -y scylla
else
yum install -y $LOCAL_PKG/scylla-conf*.x86_64.rpm $LOCAL_PKG/scylla-server*.x86_64.rpm $LOCAL_PKG/scylla-jmx*.noarch.rpm $LOCAL_PKG/scylla-tools*.noarch.rpm
fi
fi