3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # set a default HOME_DIR environment variable if not set
16 HOME_DIR
="${HOME_DIR:-/home/vagrant}";
18 case "$PACKER_BUILDER_TYPE" in
19 vmware-iso|vmware-vmx
)
21 # make sure we have /sbin in our path. RHEL systems lack this
26 mkdir
-p /tmp
/vmware-archive
;
27 mount
-o loop
$HOME_DIR/linux.iso
/tmp
/vmware
;
29 TOOLS_PATH
="`ls /tmp/vmware/VMwareTools-*.tar.gz`";
30 VER
="`echo "${TOOLS_PATH}" | cut -f2 -d'-'`";
31 MAJ_VER
="`echo ${VER} | cut -d '.' -f 1`";
33 echo "VMware Tools Version: $VER";
35 tar xzf
${TOOLS_PATH} -C /tmp
/vmware-archive
;
36 if [ "${MAJ_VER}" -lt "10" ]; then
37 /tmp
/vmware-archive
/vmware-tools-distrib
/vmware-install.pl
--default;
39 /tmp
/vmware-archive
/vmware-tools-distrib
/vmware-install.pl
--force-install;
43 rm -rf /tmp
/vmware-archive
;
44 rm -f $HOME_DIR/*.iso
;