File: loadsphinx

package info (click to toggle)
ruby-riddle 2.3.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,752 kB
  • sloc: sql: 25,022; php: 5,992; ruby: 4,757; sh: 59; makefile: 5
file content (39 lines) | stat: -rwxr-xr-x 845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash

version=$1
name="sphinx-$version"
url="http://sphinxsearch.com/files/$name-release.tar.gz"
bucket="thinking-sphinx"
directory="ext/sphinx"
prefix="`pwd`/$directory"
file="ext/$name.tar.gz"

download_and_compile_source () {
  curl -O $url
  tar -zxf $name-release.tar.gz
  cd $name-release
  ./configure --with-mysql --with-pgsql --enable-id64 --prefix=$prefix
  make
  make install
  cd ..
  rm -rf $name-release.tar.gz $name-release
}

load_cache () {
  mkdir ext
  curl -o $file http://$bucket.s3.amazonaws.com/bincaches/$name.tar.gz
  tar -zxf $file
}

push_cache () {
  tar -czf $file $directory
  aws s3 cp $file s3://$bucket/bincaches/$name.tar.gz --acl public-read
}

if curl -i --head --fail http://$bucket.s3.amazonaws.com/bincaches/$name.tar.gz
then
  load_cache
else
  download_and_compile_source
  push_cache
fi