summaryrefslogtreecommitdiffstats
path: root/src/loadclass.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/loadclass.sh
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/loadclass.sh')
-rwxr-xr-xsrc/loadclass.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/loadclass.sh b/src/loadclass.sh
new file mode 100755
index 000000000..f05de6944
--- /dev/null
+++ b/src/loadclass.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+fname=$1
+[ -z "$fname" ] && exit
+
+[ -e $fname ] || { echo "file no found: $fname"; exit; }
+
+name="`nm $fname | grep __cls_name__ | sed 's/.*__cls_name__//g' | head -1`"
+[ -z "$name" ] && exit
+
+ver="`nm $fname | grep __cls_ver__ | sed 's/.*__cls_ver__//g' | sed 's/_/\./g' | head -1`"
+[ -z "$ver" ] && exit
+
+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"
+
+[ -z "$arch" ] && { echo "lib architecture not identified"; exit; }
+
+`dirname $0`/ceph class add $name $ver $arch --in-data=$fname
+
+