From b7840540332664ce33061a68b95892fe6e545210 Mon Sep 17 00:00:00 2001 From: joshuaboud Date: Fri, 8 Dec 2023 16:30:34 -0400 Subject: [PATCH] add ability to call useful ubm funcs --- Makefile | 20 +++++++++++++++++++- ubm/ubm_func_wrapper.sh | 10 ++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 ubm/ubm_func_wrapper.sh diff --git a/Makefile b/Makefile index 5bb85de..47f1f05 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ install: ubm/patch_vdev_id_conf \ ubm/on_enclosure_add \ ubm/on_enclosure_remove \ - ubm/slot_led_ctrl + ubm/slot_led_ctrl \ + ubm/ubm_func_wrapper.sh install -m 644 -t "$(DESTDIR)/opt/45drives/ubm" \ ubm/ubm_funcs.sh \ ubm/slot_name_map.txt @@ -32,6 +33,14 @@ endif ln -sf /opt/45drives/tools/wipedev "$(DESTDIR)/usr/bin/wipedev" ln -sf /opt/45drives/ubm/slot_led_ctrl "$(DESTDIR)/usr/bin/slot_led_ctrl" ln -sf /opt/45drives/tools/slot_speeds "$(DESTDIR)/usr/bin/slot_speeds" + for i in \ + block_dev_to_slot_num \ + slot_num_to_slot_name \ + slot_name_to_slot_num \ + block_dev_to_slot_name \ + all_slot_nums \ + all_slot_names \ + ; do ln -sf /opt/45drives/tools/ubm_func_wrapper.sh "$(DESTDIR)/usr/bin/$i"; done uninstall: rm -rf "$(DESTDIR)/etc/45drives/server_info" @@ -47,3 +56,12 @@ uninstall: rm -f "$(DESTDIR)/usr/bin/dalias" rm -f "$(DESTDIR)/usr/bin/wipedev" rm -f "$(DESTDIR)/usr/bin/slot_led_ctrl" + rm -f "$(DESTDIR)/usr/bin/slot_speeds" + for i in \ + block_dev_to_slot_num \ + slot_num_to_slot_name \ + slot_name_to_slot_num \ + block_dev_to_slot_name \ + all_slot_nums \ + all_slot_names \ + ; do rm -f "$(DESTDIR)/usr/bin/$i"; done diff --git a/ubm/ubm_func_wrapper.sh b/ubm/ubm_func_wrapper.sh new file mode 100755 index 0000000..e8396ac --- /dev/null +++ b/ubm/ubm_func_wrapper.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# shellcheck source=./ubm_funcs.sh +source "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")/ubm_funcs.sh" + +UBM_FUNC_NAME=$(basename "$0") + +[ "$UBM_FUNC_NAME" == "ubm_func_wrapper.sh" ] && perror "Intended to be executed via symlink" && exit 2 + +"$UBM_FUNC_NAME" "$@"