Something went wrong on our end
-
David Hoese authoredDavid Hoese authored
reinstall_ceilo_driver.sh 1.34 KiB
#!/usr/bin/env bash
# Description: This script must be run as root and will reinstall the "MOXA"
# drivers for the ethernet to serial adapter so the ceilometer can be
# communicated with. This should be run on reboot as the driver seems to
# have trouble with kernel updates and maybe even reboots of the server.
oops() {
echo "ERROR: $*"
exit 1
}
if [ $UID -ne 0 ]; then
echo "ERROR: This script must be run as root (UID 0)."
exit 1
fi
TARBALL="/opt/metobs/misc/npreal2_v5.2.3_build_23031011.tgz"
if [ ! -f $TARBALL ]; then
echo "ERROR: Source tarball does not exist"
exit 1
fi
SRC_DIR="/tmp/moxa"
if [ ! -d $SRC_DIR ]; then
cd `dirname $SRC_DIR`
tar -xzf $TARBALL
if [ ! -d $SRC_DIR ]; then
echo "ERROR: Could not extract moxa drivers"
exit 1
fi
fi
DRIVER_DST="/usr/lib/npreal2/driver"
# Uninstall the old drivers
if [ -d $DRIVER_DST ]; then
cd $DRIVER_DST
./mxuninst
fi
cd "${SRC_DIR}"
# expect "Do you want to continue installing?"
/usr/bin/expect <(cat << EOF
spawn ./mxinst SP1
expect "Do you want to enable secure function?"
send -- "N\r"
expect "Installation process is completed."
EOF
)
# Add the server
cd $DRIVER_DST || oops "Driver install directory doesn't exist"
./mxaddsvr 192.168.16.27 4
status=$?
if [ $? -ne 0 ]; then
echo "ERROR: Could not install driver"
exit 1
fi