Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,23 @@ function ozone_add_to_classpath_userpath
fi
}

function ozone_update_native_symlink
{
if [ -z "$TARGET_FILE" ]; then
echo "Error: libhadoop doesn't support platform combination ($OS_TYPE / $ARCH_TYPE)." >&2
return 1
elif pushd "${OZONE_HOME}/lib/native" > /dev/null 2>&1; then
# Check if it already exists but points to the wrong target
if [ -L "$LINK_FILE" ] && [ "$(readlink "$LINK_FILE")" != "$TARGET_FILE" ]; then
# Forcefully recreate it so it points to the correct target file
ln -sf "$TARGET_FILE" "$LINK_FILE" > /dev/null 2>&1
fi
popd > /dev/null
else
return 1
fi
}

## @description Routine to configure any OS-specific settings.
## @audience public
## @stability stable
Expand All @@ -1352,20 +1369,10 @@ function ozone_os_tricks
TARGET_FILE="libhadoop_osx_aarch_64.dylib"
fi

pushd lib/native > /dev/null
# If no matching file variant was found for the current environment
if [ -z "$TARGET_FILE" ]; then
echo "Error: libhadoop doesn't support platform combination ($OS_TYPE / $ARCH_TYPE)." >&2
else
LINK_FILE="libhadoop.dylib"
# Check if it already exists but points to the wrong target
if [ -L "$LINK_FILE" ] && [ "$(readlink "$LINK_FILE")" != "$TARGET_FILE" ]; then
# Forcefully recreate it so it points to the correct target file
ln -sf "$TARGET_FILE" "$LINK_FILE" > /dev/null 2>&1
fi
export DYLD_LIBRARY_PATH=$OZONE_HOME/lib/native:$DYLD_LIBRARY_PATH
LINK_FILE="libhadoop.dylib"
if ozone_update_native_symlink; then
export DYLD_LIBRARY_PATH="${OZONE_HOME}/lib/native":$DYLD_LIBRARY_PATH
fi
popd > /dev/null
;;
Linux)

Expand All @@ -1381,21 +1388,10 @@ function ozone_os_tricks
TARGET_FILE="libhadoop_linux_x86_64.so"
fi

pushd . > /dev/null && cd lib/native
# If no matching file variant was found for the current environment
if [ -z "$TARGET_FILE" ]; then
echo "Error: libhadoop doesn't support platform combination ($OS_TYPE / $ARCH_TYPE)." >&2
else
LINK_FILE="libhadoop.so"

# Check if it already exists but points to the wrong target
if [ -L "$LINK_FILE" ] && [ "$(readlink "$LINK_FILE")" != "$TARGET_FILE" ]; then
# Forcefully recreate it so it points to the correct target file
ln -sf "$TARGET_FILE" "$LINK_FILE" > /dev/null 2>&1
fi
export LD_LIBRARY_PATH=$OZONE_HOME/lib/native:$LD_LIBRARY_PATH
LINK_FILE="libhadoop.so"
if ozone_update_native_symlink; then
export LD_LIBRARY_PATH="${OZONE_HOME}/lib/native":$LD_LIBRARY_PATH
fi
popd > /dev/null
;;
CYGWIN*)
# Flag that we're running on Cygwin to trigger path translation later.
Expand Down
Loading