04-26-2016
Sure, and thanks for the assistance. I'll insert a little of the code here:
Code :
#!/bin/sh
###getopt for command line arguments.
###Handle the following
### -i install, rpm ivh
### -u upgrade, rpm Uvh )
### -b upgrade but no server info
### -c cloud config path (option for internal usage in bootstrap)
### -h help
PATH=/usr/bin:/bin
umask 022
NATIVE_INSTALLER_FILE=MFEcma.dmg #NATIVE_INSTALL_PACKAGE_NAME_HERE
command=$0
install=
upgrade=
extract=
directory=
unzip_exe_size=104088
cloud=
usage()
{
echo "Usage: $command [-i|-u|-b|-h ]"
echo "-i : fresh install "
echo "-u : upgrade install"
echo "-b :Upgrade Agent only , no server info will be updated"
echo "-h : show this help"
echo ""
}
user=`id | cut -d'=' -f2 | cut -d\( -f1`
if [ $user -ne 0 ]; then
echo "This package needs root authentication to install."
exit 1
fi
###BZ 392336 Bail out if NWA exists
if [ -d /Library/NETAepoagt ];then
echo "Detected presence of previous agent in /Library/NETAepoagt. Installation cannot continue."
exit 1
fi
###Validation: No args, go away
if [ $# -eq 0 ]; then
usage
exit 1
fi
updateserverinfo="yes"
##First get the options
while getopts e:ic:ubh: opt
do case "$opt" in
i) install="yes";;
c) cloud="$OPTARG";;
u) upgrade="yes";;
b) upgrade="yes";;
h) usage
exit 0;;
[?]) usage
exit 1;;
esac
value=`expr $OPTIND - 1`
done
shift $value
returncode=0
keydata_dir=/Library/McAfee/cma/scratch/keydata
###Cannot have install and upgrade together
if [ ! -z "$install" ] && [ ! -z "$upgrade" ];then
echo You cannot specify install and upgrade at the same time
usage
exit 1
fi
##Cannot have "neither install, nor upgrade"
if [ -z "$install" ] && [ -z "$upgrade" ];then
echo "Neither install nor upgrade has been specified in the options"
usage
exit 1
fi
if [ -e /Volumes/MFECMA ];then
echo /Volumes/MFECMA already exists.The agent disk image cannot be mounted
echo Please move or rename /Volumes/MFECMA and then rerun this setup
exit 1
fi
###Okay, now that everything has been checked, its time to get going
##First we need to extract everything to a temp location,
##and then unzip it to the final destination
if [ ! -z "$cloud" ];then
#For Agent installation through bootstrap.
echo "Agent installation through bootstrap."
if [ ! -d "$cloud" ];then
echo "Cloud config path doesn't exist($cloud)."
exit 1
else
directory="$cloud"
temp_directory="$cloud"
fi
else
#For On-Prem install
temp_directory=`mktemp -d mfeXXXXXX`
if [ -f /etc/cma.d/bootstrap.xml ];then
rm -rf /etc/cma.d/bootstrap.xml
fi
if [ -z "$directory" ];then
directory=$temp_directory
fi
if [ -f "$directory" ];then
echo Output destination specified is a file which laready exists. Cannot overwrite
rm -rf "$temp_directory"
exit 1
fi
if [ ! -e "$directory" ];then
mkdir -p "$directory"
fi
fi
if [ -e "$temp_directory" ] ;then
###installer has checks for disk space, and so I wont bother about it.
###unzip will also complain is there isnt enough space for the extracted file
###So, all I care about is to have enough space for the zip itself.
###Since the zip is appended to this file itself, it would never be larger that
###this sfx itself.So havin enough space in $temp_dir to hold the sfx is good enough
if [ -z "$cloud" ];then
required_space=`stat -f %z "$command"`
required_space=`expr $required_space \* 2`
echo space required to copy archive is $required_space bytes
available_space=`df -k $temp_directory | tail -n -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
#convert the kb to bytes
available_space=`expr $available_space \* 1024`
echo space available at $temp_directory is $available_space bytes
if [ $required_space -gt $available_space ];then
echo Not enough space to extract contents
rm -rf $temp_directory
exit 1
fi
echo "extracting archive to $directory... please wait"
SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' "$0"`
# take the archive portion of this file and pipe it to unzip
tail +$SKIP "$command" > "$temp_directory"/payload
block_size=512
nblocks=`expr $unzip_exe_size / $block_size`
remainder=`expr $unzip_exe_size % $block_size`
if [ 0 != $remainder ];then
nblocks=`expr $nblocks + 1`
fi
dd if="$temp_directory"/payload of="$temp_directory"/unz bs=$block_size count=$nblocks
dd if="$temp_directory"/payload of="$temp_directory"/package.zip bs=$block_size skip=$nblocks
chmod +x "$temp_directory"/unz
# /bin/sh "$temp_directory"/unz -j -o $"$temp_directory"/package.zip -d "$directory"
unzip -j -o $"$temp_directory"/package.zip -d "$directory"
rm -rf "$temp_directory"/package.zip
rm -rf "$temp_directory"/unz
fi
if [ -n "$install" ] || [ -n "$upgrade" ];then
if [ "$updateserverinfo" = "yes" ] ; then
mkdir -p "$keydata_dir"
returncode=$?
if [ $returncode -ne 0 ] ; then
echo "Failed to create keydata directory.exiting"
exit 1
fi
cp -f "$directory"/sitelist.xml "$keydata_dir"/SiteList.xml
cp -f "$directory"/srpubkey.bin "$keydata_dir"
cp -f "$directory"/reqseckey.bin "$keydata_dir"
cp -f "$directory"/sr2048pubkey.bin "$keydata_dir"
cp -f "$directory"/req2048seckey.bin "$keydata_dir"
cp -f "$directory"/agentfipsmode "$keydata_dir"/agentfipsmode
cp -f "$directory"/RepoKeys.ini "$keydata_dir"/RepoKeys.ini
if [ ! -f "$keydata_dir"/SiteList.xml ] || [ ! -f "$keydata_dir"/srpubkey.bin ] || [ ! -f "$keydata_dir"/reqseckey.bin ] || [ ! -f "$keydata_dir"/sr2048pubkey.bin ] || [ ! -f "$keydata_dir"/req2048seckey.bin ];then
echo "Could not find key data files. Installation cannot continue"
rm -rf "$keydata_dir"
exit 1
fi
fi
fi
hdiutil attach -nobrowse "$directory/MFEcma.dmg"
fi
####Now do the actual install/ upgrade stuff
####The actual operations for copying the reqseckey and other files should already be there in the installer
returncode=0
if [ -z "$extract" ];then
mypwd=`pwd`
cd "/Volumes/MFECMA"
echo "IsLegacyEPO:N" > /etc/mainstall.config
echo "ConfigDirPath:/Volumes/MFECMA" >> /etc/mainstall.config
echo "StartService:Y" >> /etc/mainstall.config
flag=1
pltvrsn=`/usr/bin/sw_vers | grep ProductVersion | cut -d: -f2`
majvrsn=`echo $pltvrsn | cut -d. -f1`
minvrsn=`echo $pltvrsn | cut -d. -f2`
if [ -f /Library/McAfee/cma/bin/msaconfig ];then
flag=0;
fi
if (($majvrsn>=10 && $minvrsn>=6 && $flag)); then
sudo /usr/sbin/pkgutil --forget comp.nai.cmamac > /dev/null 2>&1
fi
sudo /usr/sbin/installer -pkg cma.pkg -target "/"
returncode=$?
sleep 5
cd "$mypwd"
hdiutil detach /Volumes/MFECMA
rm -rf /etc/mainstall.config
else
hdiutil detach /Volumes/MFECMA
fi
if [ -z "$cloud" ];then
rm -rf "$temp_directory"
fi
if [ $returncode -ne 0 ];then
rm -rf "$keydata_dir"
exit 1
fi
if [ -d "$keydata_dir" ] ; then
rm -rf "$keydata_dir"
fi
exit 0
8 More Discussions You Might Find Interesting
1. Solaris
Hi,
I am trying to apply the steps in the below link:
http://manageengine.adventnet.com/products/applications_manager/help/appendix/snmp-agent-discovery.html#solaris
but I couldn't continue with the step number 2 ... what is the path of C compiler.
export PATH=<gcc path>:$PATH
... (3 Replies)
Discussion started by: adel8483
3 Replies
2. Solaris
FYI: As of 5/25, all dat updates are failing when uvscan v4.40 is run. McAfee has discontinued support for v4.40 in Jan 07. You will need to upgrade to v5.10 to support the new dat updates.
http://www.mcafee.com/us/enterprise/support/customer_service/end_life.html (0 Replies)
Discussion started by: mhm4
0 Replies
3. Linux
Hi all,
I wanted to install the latest version of firefox 2 but it seems when I attempt to install it, it seems to be saying it is looking for c libraries version 2.3? I believe I currently have an older version of the c libraries. I am currently running Sun's JDS Linux 2003. My Mozilla web... (1 Reply)
Discussion started by: scriptingmani
1 Replies
4. Programming
I am trying to install a perl module using a tar file and am having trouble doing so. I see that on the system there are two version of perl installed.
/usr/bin/perl -v
/usr/perl5/5.6.1/lib/sun4-solaris-64int
/usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int
... (0 Replies)
Discussion started by: metallica1973
0 Replies
5. Shell Programming and Scripting
hi guys i want a script manually copy all directories and files. Dont want to use cp-r, cp-R or any variant. How to do this, the piece of code i need is commented in the script
#!bin/bash
IFS=$'\n'
if test "$1" = ""
then
wd=pwd
else
wd=$1
fi
for file in $(find $1)... (0 Replies)
Discussion started by: Wolverine89
0 Replies
6. Shell Programming and Scripting
hi guys i want a script manually copy all directories and files. Dont want to use cp-r, cp-R or any variant. How to do this, the piece of code i need is commented in the script
Code:
#!bin/bash
IFS=$'\n'
if test "$1" = ""
then
wd=pwd
else
wd=$1
fi
for file in... (1 Reply)
Discussion started by: Wolverine89
1 Replies
7. Solaris
Hi All;
My server's root partition was encapsulated with VxVM, I try to convert it to ZFS. I successfully de-encapsulated root. Now I try to mirror 2 root disks using ZFS. But I receive following error:
# zpool create rpool mirror c0t0d0s0 c0t1d0s0
invalid vdev specification
use '-f' to... (6 Replies)
Discussion started by: reseki
6 Replies
8. Red Hat
My Redhat Enterprise 5 system is vulnerable to POODLE and there does not seem to be a Redhat fix coming down the pipe. So I have downloaded OpenSSL 1.0.1j from source and built it. My question is ho do I make sure the Apache and Tomcat use the1.0.1j version and not the distro version.
Thanks,... (0 Replies)
Discussion started by: caspersgrin
0 Replies