mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
dist/ami: setup correct repository when --localrpm specified
There was no way to setup correct repo when AMI is building by --localrpm option, since AMI does not have access to 'version' file, and we don't passed repo URL to the AMI.
So detect optimal repo path when starting build AMI, passes repo URL to the AMI, setup it correctly.
Note: this changes behavor of build_ami.sh/scylla_install_pkg's --repo option.
It was repository URL, but now become .repo/.list file URL.
This is optimal for the distribution which requires 3rdparty packages to install scylla, like CentOS7.
Existing shell scripts which invoking build_ami.sh are need to change in new way, such as our Jenkins jobs.
Fixes #1414
Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1469636377-17828-1-git-send-email-syuu@scylladb.com>
(cherry picked from commit d3746298ae)
This commit is contained in:
committed by
Pekka Enberg
parent
192e935832
commit
f9b0a29def
5
dist/ami/build_ami.sh
vendored
5
dist/ami/build_ami.sh
vendored
@@ -8,7 +8,7 @@ fi
|
||||
print_usage() {
|
||||
echo "build_ami.sh --localrpm --repo [URL]"
|
||||
echo " --localrpm deploy locally built rpms"
|
||||
echo " --repo specify repository URL"
|
||||
echo " --repo specify .repo/.list file URL"
|
||||
exit 1
|
||||
}
|
||||
LOCALRPM=0
|
||||
@@ -16,7 +16,8 @@ while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"--localrpm")
|
||||
LOCALRPM=1
|
||||
INSTALL_ARGS="$INSTALL_ARGS --localrpm"
|
||||
REPO=`./scripts/scylla_current_repo`
|
||||
INSTALL_ARGS="$INSTALL_ARGS --localrpm --repo $REPO"
|
||||
shift 1
|
||||
;;
|
||||
"--repo")
|
||||
|
||||
37
scripts/scylla_current_repo
Executable file
37
scripts/scylla_current_repo
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$(./SCYLLA-VERSION-GEN)
|
||||
SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
|
||||
SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
if [ "$SCYLLA_VERSION" = "666.development" ]; then
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
CODENAME=`lsb_release -c|awk '{print $2}'`
|
||||
if [ "$CODENAME" = "trusty" ]; then
|
||||
CODENAME=ubuntu
|
||||
fi
|
||||
echo https://downloads.scylladb.com/deb/unstable/$CODENAME/master/latest/scylla.list
|
||||
elif [ "$ID" = "centos" ]; then
|
||||
echo https://downloads.scylladb.com/rpm/unstable/centos/master/latest/scylla.repo
|
||||
elif [ "$ID" = "fedora" ]; then
|
||||
echo https://downloads.scylladb.com/rpm/unstable/fedora/master/latest/scylla.repo
|
||||
else
|
||||
echo "Unsupported distribution."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
REPO_VERSION=$(echo $SCYLLA_VERSION |sed -e "s/^\([0-9]*\.[0-9]*\).*/\1/")
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
CODENAME=`lsb_release -c|awk '{print $2}'`
|
||||
echo http://downloads.scylladb.com/deb/ubuntu/scylla-$REPO_VERSION-$CODENAME.list
|
||||
elif [ "$ID" = "centos" ]; then
|
||||
echo http://downloads.scylladb.com/rpm/centos/scylla-$REPO_VERSION.repo
|
||||
elif [ "$ID" = "fedora" ]; then
|
||||
echo http://downloads.scylladb.com/rpm/fedora/scylla-$REPO_VERSION.repo
|
||||
else
|
||||
echo "Unsupported distribution."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -10,7 +10,7 @@ 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"
|
||||
echo " --repo specify .repo/.list file URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -42,10 +42,8 @@ if [ "$ID" = "ubuntu" ]; then
|
||||
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
|
||||
if [ "$REPO" != "" ]; then
|
||||
curl -o /etc/apt/sources.list.d/scylla.list $REPO
|
||||
fi
|
||||
apt-get update
|
||||
if [ "$LOCAL_PKG" = "" ]; then
|
||||
@@ -62,19 +60,14 @@ if [ "$ID" = "ubuntu" ]; then
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user