VirtualBox

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

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

Linux Additions/installer: fixed autorun.sh header

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