diff --git a/dist/ami/build_ami.sh b/dist/ami/build_ami.sh index f8e1a9ed64..828a4e673d 100755 --- a/dist/ami/build_ami.sh +++ b/dist/ami/build_ami.sh @@ -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") diff --git a/scripts/scylla_current_repo b/scripts/scylla_current_repo new file mode 100755 index 0000000000..72c1eaa70e --- /dev/null +++ b/scripts/scylla_current_repo @@ -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 diff --git a/scripts/scylla_install_pkg b/scripts/scylla_install_pkg index 2b7bf46f63..2a319770eb 100755 --- a/scripts/scylla_install_pkg +++ b/scripts/scylla_install_pkg @@ -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