#!/bin/sh PREREQ_ERROR=0 LIBCURL_SO=`ldconfig -p | grep "libcurl" | awk -F ">" '{print $2}' | awk -F " " '{print $1; exit 0}'` if [ -z "$LIBCURL_SO" ]; then echo "Error: Please install curl." PREREQ_ERROR=1 fi # test for availablity of gpg which gpg 1> /dev/null 2> /dev/null if [ $? -ne 0 ]; then echo "Error: gpg needs to be installed and available in PATH" PREREQ_ERROR=1 fi if [ $PREREQ_ERROR -eq 1 ]; then exit 1 fi # pythonVersion check must be repeated for each section version=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)') if [ ! -z "$version" ]; then echo "Using python3" pythonVersion="python3" else version=$(python2 -V 2>&1 | grep -Po '(?<=Python )(.+)') if [ ! -z "$version" ]; then echo "Using python2" pythonVersion="python2" else echo "Python not found." fi fi # Only check for ctypes if python2 is installed if [ "$pythonVersion" = "python2" ]; then echo "Checking for ctypes python module..." python2 -c "import ctypes" 1> /dev/null 2> /dev/null cmdline_ctypes=$? if [ $cmdline_ctypes -ne 0 ]; then echo "Error: Python does not support ctypes on this system. Please install the ctypes module for Python or upgrade to a newer version of python that comes with the ctypes module." echo "Please remove the omi package and try again after installing the ctypes module or upgrading Python. You can check if the ctypes module is installed by starting python and running the command: 'import ctypes'" exit 1 fi fi echo "Cleanning up existing dsc_hosts..." kill $(ps -eo pid,cmd | grep '/opt/dsc/bin/dsc_host' | grep -v grep | tr -s ' ' | sed 's/^[ \t]*//' | cut -d' ' -f1) -9 2&>1 > /dev/null chmod -R 777 /opt/dsc # Clean dsc directory in case of install and clean echo "Deployment operation type :" $1 if [ "$1" = "1" -o "$1" = 1 -o "$1" = "install" -o "$1" = "clean" ]; then echo "Cleanning directory /opt/dsc..." rm -rfv /opt/dsc fi rm -f /etc/opt/omi/conf/omsconfig/inventory_lock echo "Cleaned up existing dsc_hosts..." exit 0