Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: installer/linux/generic/setup.sh

Issue 173081: Setup script for O3D plugin installer. This is the installer that we will giv... Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/sh
2 # Installs O3D plugin for Linux.
3 #
4 # Copyright 2009, Google Inc.
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are
9 # met:
10 #
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above
14 # copyright notice, this list of conditions and the following disclaimer
15 # in the documentation and/or other materials provided with the
16 # distribution.
17 # * Neither the name of Google Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived from
19 # this software without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 PATH=$PATH:/usr/bin/:/usr/local/bin
34
35 CheckArch() {
36 # Look for 32 or 64 bit arch from the kernel. If we can not get a read
37 # on the arch, we'll go with "unknown".
38 ARCH=$(uname -m)
39 case $ARCH in
40 i?86 | i86*)
41 ARCH="32bit";;
42 x86_64 | amd64)
43 ARCH="64bit";;
44 *)
45 ARCH="unknown";;
46 esac
47
48 echo "System architecture mapped to: $ARCH"
49 }
50
51
52 SetRootUser() {
53 # We need to be root (or run as sudo) in order to perform setup.
54 USER=$(id -u)
55 if [ "$USER" != "0" ]; then
56 echo "You must be root (or sudo) to install this package."
57 exit 1
58 fi
59 }
60
61
62 SetupO3d() {
63 # Create npapi plugin directories, copy and symlink libs.
64 O3D_DIR="/opt/google/o3d"
65
66 PLUGIN_DIRS="/usr/lib/firefox/plugins
67 /usr/lib/iceape/plugins
68 /usr/lib/iceweasel/plugins
69 /usr/lib/midbrowser/plugins
70 /usr/lib/mozilla/plugins
71 /usr/lib/xulrunner/plugins
72 /usr/lib/xulrunner-addons/plugins"
73
74 LIBS="libCg.so
75 libCgGL.so
76 libGLEW.so.1.5"
77
78 LIB3D="libnpo3dautoplugin.so"
79
80 echo -n "Creating plugin directories..."
81 mkdir -p $PLUGIN_DIRS $O3D_DIR
82 echo "ok"
83
84 echo -n "Copying plugins to $O3D_DIR..."
85 install --mode=644 ${LIB3D} $O3D_DIR
86 install --mode=644 ${LIBS} $O3D_DIR
87 echo "ok"
88
89 echo -n "Creating symlinks to plugins..."
90 for dir in $PLUGIN_DIRS; do
91 ln -sf ${O3D_DIR}/${LIB3D} ${dir}/
92 done
93 echo "ok"
94
95 # If 32bit arch, use /usr/lib. If 64bit, use /usr/lib32
96 if [ "$ARCH" = "32bit" ]; then
97 LIBDIR="/usr/lib"
98 elif [ "$ARCH" = "64bit" ]; then
99 LIBDIR="/usr/lib32"
100 NP_WRAP="yes"
101 else
102 echo "$ARCH not recognized"
103 exit 1
104 fi
105
106 echo -n "Creating symlinks to libs..."
107 mkdir -p $LIBDIR
108 for lib in $LIBS; do
109 if [ -e "${LIBDIR}/${lib}" ]; then
110 echo "$lib already exists, not replacing."
111 else
112 ln -s ${O3D_DIR}/${lib} ${LIBDIR}/
113 fi
114 done
115 echo "ok"
116
117 # 64bit only: Check for nspluginwrapper, wrap libnpo3dautoplugin.so if found.
118 if [ "$NP_WRAP" = "yes" ]; then
119 echo -n "Attempting to wrap $LIB3D via nspluginwrapper..."
120 NSPW=$(which nspluginwrapper)
121 if [ -z "$NSPW" ]; then
122 echo "nspluginwrapper not found. Without nspluginwrapper you will be"
123 echo "unable to use O3D in 64-bit browsers. Continue installation? (y/n)"
124 read answer
125 if [ "$answer" = "y" ]; then
126 echo "Ok, Installation complete."
127 exit 0
128 else
129 echo "Aborted install at user request."
130 exit 1
131 fi
132 fi
133 WRAPPED_PLUGIN_PATH="/usr/lib/mozilla/plugins/npwrapper.libnpo3dautoplugin.s o"
134 APPS="iceape iceweasel firefox xulrunner midbrowser xulrunner-addons"
135 echo -n "Wrapping $LIB3D..."
136 $NSPW -i ${O3D_DIR}/${LIB3D}
137 echo "ok"
138 echo -n "Creating symlinks to npwrapper.libnpo3dautoplugin.so..."
139 for app in $APPS; do
140 ln -sf $WRAPPED_PLUGIN_PATH /usr/lib/${app}/plugins/
141 done
142 echo "ok"
143 fi
144
145 if [ $? -ne 0 ]; then
146 echo "Installation failed"
147 exit 1
148 else
149 echo "Installation completed successfully!"
150 fi
151 }
152
153 CheckArch
154 SetRootUser
155 SetupO3d
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698