HP/UX fixes

This commit is contained in:
2025-10-28 11:02:06 -04:00
parent 67050cf3a0
commit 6c1f8c926e
6 changed files with 210 additions and 82 deletions

View File

@@ -6,43 +6,42 @@
#
# usage: list_mv.ksh
get_script_dir() {
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
src="$0"
while [ -h "$src" ]; do
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
src=$(readlink "$src")
case $src in
/*) ;; # absolute path
*) src="$dir/$src";;
esac
done
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
dir=$(cd -P "$(dirname "$src")" >/dev/null 2>&1 && pwd)
echo "$dir"
}
MYDIR=$(get_script_dir)
. $MYDIR/rbk_api.conf
. $MYDIR/rubrik.conf
. $MYDIR/oracle_funcs.ksh
# Script starts here
echo "Service account in use is $ID"
echo "Managed Volumes"
echo "Managed Volumes visible to this account:"
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume"
rest_api_get
awk '{
pos = 1
while (match(substr($0, pos), /"name":"[^"]*"/)) {
name = substr($0, pos + RSTART + 7, RLENGTH - 8)
# Remove any trailing quote if present
sub(/"$/, "", name)
print name
pos += RSTART + RLENGTH - 1
}
}' /tmp/rbkresponse.$$
awk '
{
line = $0
pos = 1
while (match(substr(line, pos), /"name":"[^"]*"/)) {
start = pos + RSTART + 7
len = RLENGTH - 9
name = substr(line, start, len)
pos += RSTART + RLENGTH - 1
if (match(substr(line, pos), /"isWritable":[ ]*(true|false)/)) {
start_w = pos + RSTART + 12
len_w = RLENGTH - 13
writable = substr(line, start_w, len_w)
print name ": isWritable=" writable
pos += RSTART + RLENGTH - 1
}
}
}
' /tmp/rbkresponse.$$
cleanup