3 # Compile and run a librados application outside of the ceph build system, so
4 # that we can be sure librados.h[pp] is still usable and hasn't accidentally
5 # started depending on internal headers.
7 # The script assumes all dependencies - e.g. curl, make, gcc, librados headers,
8 # libradosstriper headers, boost headers, etc. - are already installed.
11 source $
(dirname $0)/..
/ceph-helpers-root.sh
15 SOURCES
="hello_radosstriper.cc
20 BINARIES_TO_RUN
="hello_world_c
23 BINARIES
="${BINARIES_TO_RUN}hello_radosstriper_cpp
25 # parse output like "octopus (dev)"
26 case $
(librados-config
--release |
grep -Po ' \(\K[^\)]+') in
30 BRANCH
=$
(librados-config
--release | cut
-d' ' -f1);;
32 echo "unknown release '$(librados-config --release)'" >&2
35 DL_PREFIX
="http://git.ceph.com/?p=ceph.git;a=blob_plain;hb=${BRANCH};f=examples/librados/"
36 #DL_PREFIX="https://raw.githubusercontent.com/ceph/ceph/master/examples/librados/"
40 for f
in $BINARIES$SOURCES ; do
45 function get_sources
() {
46 for s
in $SOURCES ; do
47 curl
--progress-bar --output $s ${DL_PREFIX}$s
51 function check_sources
() {
52 for s
in $SOURCES ; do
57 function check_binaries
() {
58 for b
in $BINARIES ; do
64 function run_binaries
() {
65 for b
in $BINARIES_TO_RUN ; do
66 .
/$b -c /etc
/ceph
/ceph.conf
72 centos|fedora|rhel|opensuse
*|suse|sles
)
73 install gcc-c
++ make libradospp-devel librados-devel
;;
74 ubuntu|debian|devuan|softiron
)
75 install g
++ make libradospp-dev librados-dev
;;
77 echo "$(distro_id) is unknown, $@ will have to be installed manually."