#!/bin/sh
#-------------------------------------------------------------------------------
# charon_menu_ncu
#-------------------------------------------------------------------------------
# Copyright (C) 2013-2022 STROMASYS.
# All rights reserved.
#
#set -x
VERSION=1.1

. `dirname $0`/charon_common
. `dirname $0`/charon_common_menu

display_header "Network Configuration Utility"
echo

if test `id -u` -ne 0
then
  tput bold
  echo "Must be root !"
  tput sgr0
  echo
  exit 1
fi

NCU=`which ncu 2>/dev/null`
if test -z "${NCU}"
then
  if test -n "`find /opt/charon -name ncu 2>/dev/null`"
  then
    tput bold
    echo "'ncu' is installed on this server but the PATH has not been set."
    tput sgr0
    echo
    tput bold
    echo "[31mIt is recommended to logoff and login before using CHARON."
    tput sgr0
    echo "or to leave the menu then run:"
    echo 
    echo "# [1m. /etc/profile.d/charon_axp.sh[0m (for CHARON-AXP before V4.6)"
    echo "and/or"
    echo "# [1m. /etc/profile.d/charon.sh[0m     (for CHARON-VAX & CHARON-AXP V4.6+)"
    echo
    exit 3
  else
    tput bold
    echo "'ncu' is not installed on this server"
    tput sgr0
    echo
    exit 2
  fi
else
  ${NCU}
fi

exit
