#!/bin/sh
##########################################################
-# Copyright (C) 2006-2019 VMware, Inc. All rights reserved.
+# Copyright (C) 2006-2021 VMware, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# usage(): prints how to use this script
usage()
{
- echo ""
- echo "Usage: $0 [-h]"
- echo " -h prints this usage statement"
- exit 1
+ echo ""
+ echo "Usage: $0 [-hux]"
+ echo " -h prints this usage statement"
+ echo " -u updates the host with the state of support data" \
+ "collection process"
+ echo " -x transfers support data to the host"
+ exit 1
}
#internal state machine state for update
update=0
+#internal state machine state for transfering logs to host
+transfer=0
+
# UpdateState($state): Updates the VM with the given state.
UpdateState()
{
runcmd "/tmp/modules.txt" /sbin/lsmod
runcmd "/tmp/uname.txt" uname -a
runcmd "/tmp/issue.txt" cat /etc/issue
- if which rpm &> /dev/null; then
+ if which rpm > /dev/null; then
runcmd "/tmp/rpm-qa.txt" rpm -qa
fi
+ if which apt > /dev/null; then
+ runcmd "/tmp/apt-list.txt" apt list
+ fi
runcmd "/tmp/netstat-lan.txt" netstat -lan
runcmd "/tmp/route.txt" route
runcmd "/tmp/free.txt" free
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
TARFILE=vm-`date +%Y-%m-%d`.$$.tar.gz
-VER=0.92
+VER=0.93
# Parse args
for option in $@
"-u")
update=1
;;
+ "-x")
+ transfer=1
+ ;;
*)
usage
;;
# Clean up temporary files
trap - HUP INT QUIT TERM ABRT; cleanup
-banner "Uploading archive to host..."
-vmware-xferlogs enc $TARFILE 2>/dev/null
+if [ $transfer -eq 1 ]; then
+ banner "Transferring support data to the host..."
+ vmware-xferlogs enc $TARFILE 2>/dev/null
-if [ $? != 0 ]; then
- banner "Could not transmit logs successfully: either the vmware-xferlogs " \
- "binary is not in the path, or you are not in a virtual machine."
+ if [ $? != 0 ]; then
+ banner "Could not transfer the support data successfully: either " \
+ "vmware-xferlogs binary is not in the path, or you are not " \
+ "in a virtual machine."
+ fi
+else
+ banner "Skipping support data transfer to the host."
fi
UpdateState $VMSUPPORT_ENDING
/*********************************************************
- * Copyright (C) 1998-2020 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2021 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
}
/* Put together absolute vm-support filename. */
- vmSupport = g_strdup_printf("cscript \"%s%s%s\" -u",
+ vmSupport = g_strdup_printf("cscript \"%s%s%s\" -u -x",
vmSupportPath, DIRSEPS, vmSupportCmd);
vm_free(vmSupportPath);
#else
- gchar *vmSupportCmdArgv[] = {"vm-support", "-u", NULL};
+ gchar *vmSupportCmdArgv[] = {"vm-support", "-u", "-x", NULL};
g_message("Starting vm-support script - %s\n", vmSupportCmdArgv[0]);
if (!g_spawn_async(NULL, vmSupportCmdArgv, NULL,