Skip to content

Instantly share code, notes, and snippets.

@till
Created October 21, 2010 00:38
Show Gist options
  • Select an option

  • Save till/637669 to your computer and use it in GitHub Desktop.

Select an option

Save till/637669 to your computer and use it in GitHub Desktop.

Revisions

  1. till revised this gist Oct 21, 2010. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions setup-percona-server.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    #!/bin/sh
    ############################
    # Author: Till Klampaeckel #
    # License: New BSD License #
    ############################

    version=$1

  2. till created this gist Oct 21, 2010.
    50 changes: 50 additions & 0 deletions setup-percona-server.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    #!/bin/sh

    version=$1

    if [ "x$version" = "x" ]; then
    echo "Usage: ./$0 5.0|5.1"
    exit 1
    fi

    distro=$(lsb_release -s -c)

    apt_opt="-q" # --dry-run

    gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
    if [ "$?" -gt 0 ]; then
    echo "Could not download key."
    exit 1
    fi

    gpg -a --export CD2EFD2A | apt-key add -
    if [ "$?" -gt 0 ]; then
    echo "Could not import key."
    exit 1
    fi

    percona_repo="/etc/apt/sources.list.d/percona.list"
    if [ ! -e $percona_repo ]; then
    repo="deb http://repo.percona.com/apt ${distro} main\n"
    repo="${repo}deb-src http://repo.percona.com/apt ${distro} main"

    echo -n "$repo" > $percona_repo
    fi

    apt-get -q update

    if [ "$version" = "5.0" ]; then

    apt-get install $apt_opt percona-sql-common percona-sql-client-5.0
    apt-get install $apt_opt percona-sql-server-5.0

    elif [ "$version" = "5.1" ]; then

    apt-get install $apt_opt percona-server-common percona-server-client-5.1
    apt-get install $apt_opt percona-server-server-5.1

    else

    echo "Version: ${version} - wat?"

    fi