blob: 3010df1c249582ace099374388705a8542cc56c2 [file] [log] [blame]
ramonsalguer8ac0f082020-06-03 20:13:34 +02001#!/bin/sh -eux
2
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
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
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.
14
15# set a default HOME_DIR environment variable if not set
16HOME_DIR="${HOME_DIR:-/home/vagrant}";
17
18case "$PACKER_BUILDER_TYPE" in
19parallels-iso|parallels-pvm)
20 mkdir -p /tmp/parallels;
21 mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels;
22 VER="`cat /tmp/parallels/version`";
23
24 echo "Parallels Tools Version: $VER";
25
26 /tmp/parallels/install --install-unattended-with-deps \
27 || (code="$?"; \
28 echo "Parallels tools installation exited $code, attempting" \
29 "to output /var/log/parallels-tools-install.log"; \
30 cat /var/log/parallels-tools-install.log; \
31 exit $code);
32 umount /tmp/parallels;
33 rm -rf /tmp/parallels;
34 rm -f $HOME_DIR/*.iso;
35
36 # Parallels Tools for Linux includes native auto-mount script,
37 # which causes losing some of Vagrant-relative shared folders.
38 # So, we should disable this behavior.
39 # https://github.com/Parallels/vagrant-parallels/issues/325#issuecomment-418727113
40 auto_mount_script='/usr/bin/prlfsmountd'
41 if [ -f "${auto_mount_script}" ]; then
42 echo -e '#!/bin/sh\n'\
43 '# Shared folders auto-mount is disabled by Vagrant ' \
44 > "${auto_mount_script}"
45 fi
46 ;;
47esac