autorun.sh revision 4b962b19143139686e01b035fc5f02a89a9beb0d
#
# VirtualBox Guest Additions installation script for *nix guests
#
#
# Copyright (C) 2009-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# Deal with differing "which" semantics
}
# Get the name and execute switch for a useful terminal emulator
#
# Sets $gxtpath to the emulator path or empty
# Sets $gxttitle to the "title" switch for that emulator
# Sets $gxtexec to the "execute" switch for that emulator
# May clobber $gtx*
# Calls mywhich
# gnome-terminal uses -e differently to other emulators
set $gxti
gxttitle=$2
gxtexec=$3
return
;;
esac
done
}
# Quotes its argument by inserting '\' in front of every character save
# for 'A-Za-z0-9/'. Prints the result to stdout.
}
exit 1
fi
# 32-bit or 64-bit?
arch='x86'
;;
arch='amd64'
;;
*)
exit 1
;;
esac
# execute the installer
if test "$ostype" = "Linux"; then
for i in "$path/VBoxLinuxAdditions.run" \
if test -f "$i"; then
TITLE="VirtualBox Guest Additions installation"
"$TITLE" \
"$gxtpath $gxttitle $TITLE_QUOTED $gxtexec $BINARY --xwin" \
"Please try running $i manually."
exit
;;
esac
fi
done
# else: unknown failure
echo "Linux guest additions installer not found -- try to start them manually."
exit 1
elif test "$ostype" = "SunOS"; then
# check for combined package
if test -f "$installfile"; then
# check for pkgadd bin
if test ! -z "$found"; then
else
echo "Could not find pkgadd."
exit 1
fi
fi
# check for pfexec
if test ! -z "$found"; then
# Use su and prompt for password
echo "Could not find pfexec."
else
if test ! -x "$idbin"; then
if test ! -x "$found"; then
echo "Failed to find a suitable user id executable."
exit 1
else
fi
fi
# check if pfexec can get the job done
userid=`$pfexecbin $idbin -u`
else
fi
if test $userid != "0"; then
# pfexec exists but user has no pfexec privileges, switch to using su and prompting password
fi
fi
# create temporary admin file for autoinstall
echo "basedir=default
runlevel=nocheck
conflict=quit
setuid=nocheck
action=nocheck
partial=quit
instance=unique
idepend=quit
rdepend=quit
space=quit
mail=
# check gnome-terminal, use it if it exists.
if test -f "/usr/bin/gnome-terminal"; then
if test -z "$subin"; then
/usr/bin/gnome-terminal --title "Installing VirtualBox Additions" --command "/bin/sh -c '$pfexecbin $pkgaddbin -G -d $installfile -n -a /tmp/vbox.autoinstall SUNWvboxguest; /bin/echo press ENTER to close this window; /bin/read; /bin/rm -f /tmp/vbox.autoinstall'"
else
/usr/bin/gnome-terminal --title "Installing VirtualBox Additions: Root password required." --command "/bin/sh -c '$subin - root -c \"$pkgaddbin -G -d $installfile -n -a /tmp/vbox.autoinstall SUNWvboxguest\"; /bin/echo press ENTER to close this window; /bin/read; /bin/rm -f /tmp/vbox.autoinstall'"
fi
# use xterm
if test -z "$subin"; then
/usr/X11/bin/xterm -title "Installing VirtualBox Additions" -e "$pfexecbin $pkgaddbin -G -d $installfile -n -a /tmp/vbox.autoinstall SUNWvboxguest; /bin/echo press ENTER to close this window; /bin/read; /bin/rm -f /tmp/vbox.autoinstall"
else
/usr/X11/bin/xterm -title "Installing VirtualBox Additions: Root password required." -e "$subin - root -c \"$pkgaddbin -G -d $installfile -n -a /tmp/vbox.autoinstall SUNWvboxguest\"; /bin/echo press ENTER to close this window; /bin/read; /bin/rm -f /tmp/vbox.autoinstall"
fi
else
echo "No suitable terminal not found. -- install additions using pkgadd -d."
fi
exit 0
fi
echo "Solaris guest additions installer not found -- try to start them manually."
exit 1
fi