VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/installer/autorun.sh@ 26465

Last change on this file since 26465 was 26465, checked in by vboxsync, 15 years ago

Additions/installer: set eol style LF to autorun.sh

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1#!/bin/sh
2#
3# Sun VirtualBox
4# VirtualBox Guest Additions installation script for Linux
5
6#
7# Copyrign Microsystems, Inc.
8#
9# Sun Microsystems, Inc.
10# All rights reserved
11#
12
13PATH=$PATH:/bin:/sbin:/usr/sbin
14
15ostype=`uname -s`
16if test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then
17 echo "Linux/Solaris not detected."
18 exit 1
19fi
20
21# 32-bit or 64-bit?
22path=`dirname $0`
23case `uname -m` in
24 i[3456789]86|x86|i86pc)
25 arch='x86'
26 ;;
27 x86_64|amd64|AMD64)
28 arch='amd64'
29 ;;
30 *)
31 echo "Unknown architecture `uname -m`."
32 exit 1
33 ;;
34esac
35
36# execute the installer
37if test "$ostype" = "Linux"; then
38 if test -f "$path/VBoxLinuxAdditions-$arch.run"; then
39 exec gksu /bin/sh "$path/VBoxLinuxAdditions-$arch.run"
40 fi
41
42 # else: unknown failure
43 echo "Linux guest additions installer not found -- try to start them manually."
44 exit 1
45
46elif test "$ostype" = "SunOS"; then
47
48 # check for combined package
49 installfile="$path/VBoxSolarisAdditions.pkg"
50 if test -f "$installfile"; then
51
52 # check for pkgadd bin
53 pkgaddbin=pkgadd
54 found=`which pkgadd | grep "no pkgadd"`
55 if test ! -z "$found"; then
56 if test -f "/usr/sbin/pkgadd"; then
57 pkgaddbin=/usr/sbin/pkgadd
58 else
59 echo "Could not find pkgadd."
60 exit 1
61 fi
62 fi
63
64 # check for pfexec
65 pfexecbin=pfexec
66 found=`which pfexec | grep "no pfexec"`
67 if test ! -z "$found"; then
68 # Use su and prompt for password
69 echo "Could not find pfexec."
70 subin=`which su`
71 else
72 idbin=/usr/xpg4/bin/id
73 if test ! -x "$idbin"; then
74 found=`which id 2> /dev/null`
75 if test ! -x "$found"; then
76 echo "Failed to find a suitable user id executable."
77 exit 1
78 else
79 idbin=$found
80 fi
81 fi
82
83 # check if pfexec can get the job done
84 if test "$idbin" = "/usr/xpg4/bin/id"; then
85 userid=`$pfexecbin $idbin -u`
86 else
87 userid=`$pfexecbin $idbin | cut -f1 -d'(' | cut -f2 -d'='`
88 fi
89 if test $userid != "0"; then
90 # pfexec exists but user has no pfexec privileges, switch to using su and prompting password
91 subin=`which su`
92 fi
93 fi
94
95 # create temporary admin file for autoinstall
96 echo "basedir=default
97runlevel=nocheck
98conflict=quit
99setuid=nocheck
100action=nocheck
101partial=quit
102instance=unique
103idepend=quit
104rdepend=quit
105space=quit
106mail=
107" > /tmp/vbox.autoinstall
108
109 # check gnome-terminal, use it if it exists.
110 if test -f "/usr/bin/gnome-terminal"; then
111 # use su/pfexec
112 if test -z "$subin"; then
113 /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'"
114 else
115 /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'"
116 fi
117 elif test -f "/usr/X11/bin/xterm"; then
118 # use xterm
119 if test -z "$subin"; then
120 /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"
121 else
122 /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"
123 fi
124 else
125 echo "No suitable terminal not found. -- install additions using pkgadd -d."
126 rm -f /tmp/vbox.autoinstall
127 fi
128
129 exit 0
130 fi
131
132 echo "Solaris guest additions installer not found -- try to start them manually."
133 exit 1
134fi
135
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette