ceph/src/loadclass.sh

27 lines
616 B
Bash
Raw Normal View History

2009-05-27 22:53:15 +00:00
#!/bin/bash
fname=$1
2010-07-07 14:47:57 +00:00
[ -z "$fname" ] && exit
2009-05-27 22:53:15 +00:00
[ -e $fname ] || { echo "file no found: $fname"; exit; }
name="`nm $fname | grep __cls_name__ | sed 's/.*__cls_name__//g' | head -1`"
2010-07-07 14:47:57 +00:00
[ -z "$name" ] && exit
2009-05-27 22:53:15 +00:00
ver="`nm $fname | grep __cls_ver__ | sed 's/.*__cls_ver__//g' | sed 's/_/\./g' | head -1`"
2010-07-07 14:47:57 +00:00
[ -z "$ver" ] && exit
2009-05-27 22:53:15 +00:00
echo loading $name v$ver
fl=`file $fname`
arch=""
[ `echo "$fl" | grep -c i386` -gt 0 ] && arch="i386"
[ `echo "$fl" | grep -c x86-64` -gt 0 ] && arch="x86-64"
2010-07-07 14:47:57 +00:00
[ -z "$arch" ] && { echo "lib architecture not identified"; exit; }
2009-05-27 22:53:15 +00:00
`dirname $0`/ceph class add $name $ver $arch --in-data=$fname