Skip to content

Commit

Permalink
add ability to call useful ubm funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaboud committed Dec 8, 2023
1 parent e6049bc commit b784054
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
10 changes: 10 additions & 0 deletions ubm/ubm_func_wrapper.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"

0 comments on commit b784054

Please sign in to comment.