1
|
1 |
#!/bin/bash
|
|
2 |
#
|
10
|
3 |
# Script for setting up the Desktop Build Environment on Solaris
|
1
|
4 |
#
|
|
5 |
# CDDL HEADER START
|
|
6 |
#
|
|
7 |
# The contents of this file are subject to the terms of the
|
|
8 |
# Common Development and Distribution License, Version 1.0 only
|
|
9 |
# (the "License"). You may not use this file except in compliance
|
|
10 |
# with the License.
|
|
11 |
#
|
|
12 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
13 |
# or http://www.opensolaris.org/os/licensing.
|
|
14 |
# See the License for the specific language governing permissions
|
|
15 |
# and limitations under the License.
|
|
16 |
#
|
|
17 |
# When distributing Covered Code, include this CDDL HEADER in each
|
|
18 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
19 |
# If applicable, add the following below this CDDL HEADER, with the
|
|
20 |
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
21 |
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
22 |
#
|
|
23 |
# CDDL HEADER END
|
|
24 |
#
|
|
25 |
#
|
10
|
26 |
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
1
|
27 |
# Use is subject to license terms.
|
|
28 |
#
|
|
29 |
|
|
30 |
IFS='
|
|
31 |
'
|
10
|
32 |
|
|
33 |
# this is listed separately because we are using the spec file
|
|
34 |
# included in the pkgbuild tarball
|
|
35 |
PKGBUILD_VERSION=1.3.0
|
1
|
36 |
|
10
|
37 |
# Modules needed for building GNOME:
|
|
38 |
GNOME_MODULES="ant m4 autoconf automake libtool bison coreutils diff flex gettext make subversion"
|
|
39 |
# Modules needed for building KDE:
|
|
40 |
KDE_MODULES="ant m4 autoconf automake libtool bison coreutils diff flex gettext subversion gnuawk gnused cmake make yasm"
|
|
41 |
# Not needed for either GNOME or KDE, but useful to have:
|
|
42 |
OPT_MODULES="rsync cvs"
|
|
43 |
# SFE has the same deps as GNOME
|
|
44 |
SFE_MODULES=$GNOME_MODULES
|
|
45 |
install_kde=no
|
|
46 |
install_gnome=no
|
|
47 |
install_sfe=no
|
|
48 |
install_opt=no
|
1
|
49 |
|
|
50 |
# Obsolete packages to be pkgrm'd. Mostly renamed packages.
|
|
51 |
OLD_PKGS="JDSautomake JDSautoconf JDSlibtool JDSm4 JDSgettext JDSfileutils
|
|
52 |
JDSmake JDSpatch CBEpatch JDSflex JDScvs SUNWpkgbuild"
|
|
53 |
|
10
|
54 |
# default log file. Changed to /tmp/desktop-cbe.install.log.$$ if the user
|
1
|
55 |
# installing is not root
|
10
|
56 |
LOGFILE=/var/sadm/install/logs/desktop-cbe.install.log.$$
|
1
|
57 |
|
10
|
58 |
# packages required for building things. cbe-install will check if they
|
1
|
59 |
# are installed and install them if not.
|
10
|
60 |
|
|
61 |
# Solaris SVr4 packages:
|
|
62 |
CBE_SVR4_DEPENDENCIES="SUNWarc SUNWgpch SUNWhea SUNWsfwhea SUNWwgetr
|
|
63 |
SUNWwgetu SUNWgtar SUNWxcu4 SUNWsprot SUNWxwinc
|
|
64 |
SUNWxorg-headers SUNWbtool SUNWlibmr SUNWlibm"
|
|
65 |
|
|
66 |
# OpenSolaris pkg(5) packages:
|
|
67 |
CBE_PKG_DEPENDENCIES="SUNWgpch SUNWhea SUNWsfwhea SUNWwget SUNWgtar
|
|
68 |
SUNWxcu4 SUNWsprot SUNWxwinc SUNWxorg-headers
|
|
69 |
SUNWbtool SUNWlibm"
|
|
70 |
|
|
71 |
# alternatives (SUNW version of tools preferred to CBE version)
|
1
|
72 |
|
10
|
73 |
# by detault install alternatives when available
|
|
74 |
install_alt=yes
|
|
75 |
# by default, install alternatives without asking
|
|
76 |
ask_alt=no
|
|
77 |
|
|
78 |
ALT_make=SUNWgmake
|
|
79 |
ALT_m4=SUNWgm4
|
|
80 |
ALT_autoconf=SUNWaconf
|
|
81 |
ALT_automake="SUNWgnu-automake-110 SUNWgnu-automake-19"
|
|
82 |
ALT_libtool=SUNWlibtool
|
|
83 |
ALT_bison=SUNWbison
|
|
84 |
ALT_coreutils=SUNWgnu-coreutils
|
|
85 |
ALT_diff=SUNWgnu-diffutils
|
|
86 |
ALT_flex=SUNWflexlex
|
|
87 |
# not yet available
|
|
88 |
#ALT_gettext=SUNWgnu-gettext
|
|
89 |
ALT_subversion=SUNWsvn
|
1
|
90 |
|
|
91 |
# default cbe install location
|
10
|
92 |
cbe_prefix=/opt/dtbld
|
1
|
93 |
# this should be set to a reasonable value in install_pkgbuild()
|
|
94 |
pkgbuild_topdir=/fix/me
|
|
95 |
|
|
96 |
# default value for the "who is the build user" question
|
|
97 |
logname=${LOGNAME:-`logname`}
|
|
98 |
if [ -x /usr/xpg4/bin/id ]; then
|
|
99 |
uid=`/usr/xpg4/bin/id -u`
|
|
100 |
username=`/usr/xpg4/bin/id -un`
|
|
101 |
else
|
|
102 |
uid=`/bin/id | cut -f2 -d= | cut -f1 -d'('`
|
|
103 |
username=`/bin/id |cut -f2 -d'(' | cut -f1 -d')'`
|
|
104 |
fi
|
|
105 |
export HOME="$(eval cd ~$username; pwd)"
|
|
106 |
|
|
107 |
always_uninstall_existing=
|
|
108 |
always_skip_existing=
|
|
109 |
|
|
110 |
# write a message to the log file
|
|
111 |
# not visible to the user
|
|
112 |
log () {
|
|
113 |
for msg in "${@}"; do
|
|
114 |
echo "`date`: $msg" >> $LOGFILE
|
|
115 |
done
|
|
116 |
}
|
|
117 |
|
|
118 |
# print a message to the user and also write it to the log file
|
|
119 |
msg () {
|
|
120 |
for msg in "${@}"; do
|
|
121 |
echo $msg
|
|
122 |
echo "`date`: $msg" >> $LOGFILE
|
|
123 |
done
|
|
124 |
}
|
|
125 |
|
10
|
126 |
# print a message to the user and also write it to the log file
|
|
127 |
msg_err () {
|
|
128 |
for msg in "${@}"; do
|
|
129 |
echo ERROR: $msg 1>&2
|
|
130 |
echo "`date`: ERROR: $msg" >> $LOGFILE
|
|
131 |
done
|
|
132 |
}
|
|
133 |
|
|
134 |
# clean up if installation is aborted
|
|
135 |
tempdirs=
|
|
136 |
remove_tempdirs () {
|
|
137 |
IFS=:
|
|
138 |
for tdir in $tempdirs; do
|
|
139 |
case "$tdir" in
|
|
140 |
/tmp/* )
|
|
141 |
cd /tmp
|
|
142 |
rm -rf "$tdir"
|
|
143 |
;;
|
|
144 |
esac
|
|
145 |
done
|
|
146 |
}
|
|
147 |
trap remove_tempdirs QUIT EXIT
|
|
148 |
|
|
149 |
|
1
|
150 |
# alternate root directory
|
|
151 |
rootdir=/
|
|
152 |
|
|
153 |
process_cl () {
|
|
154 |
while [ $# != 0 ]; do
|
|
155 |
case "$1" in
|
|
156 |
-R )
|
|
157 |
shift
|
|
158 |
if [ $# == 0 ]; then
|
|
159 |
echo "Option -R requires an argument."
|
|
160 |
exit 1
|
|
161 |
fi
|
|
162 |
rootdir=$1
|
|
163 |
case "$rootdir" in
|
|
164 |
/* )
|
|
165 |
;;
|
|
166 |
* )
|
|
167 |
echo "The argument to -R must be an absolute path name"
|
|
168 |
exit 1
|
|
169 |
esac
|
|
170 |
;;
|
|
171 |
-h|--help)
|
|
172 |
echo "Usage: $0 [options]"
|
|
173 |
echo "options:"
|
|
174 |
echo " -h, --help print this usage info"
|
|
175 |
echo " -R rootdir install CBE packages in alternate root directory rootdir"
|
10
|
176 |
echo " -k, --kde install the packages needed for building KDE"
|
|
177 |
echo " -g, --gnome install the packages needed for building GNOME"
|
|
178 |
echo " -s, --sfe install the packages needed for building GNOME"
|
|
179 |
echo " -o, --optional install the optional packages"
|
|
180 |
echo " --ask-alt ask for confirmation before installing alternative"
|
|
181 |
echo " tools ([Open]Solaris tools instead of CBE tools)"
|
|
182 |
echo " --no-alt do not install alternatives, only CBE tools"
|
1
|
183 |
exit 0
|
|
184 |
;;
|
10
|
185 |
--ask-alt)
|
|
186 |
ask_alt=yes
|
|
187 |
;;
|
|
188 |
--no-alt)
|
|
189 |
install_alt=no
|
|
190 |
;;
|
|
191 |
-k|--kde)
|
|
192 |
install_kde=yes
|
|
193 |
;;
|
|
194 |
-g|--gnome)
|
|
195 |
install_gnome=yes
|
|
196 |
;;
|
|
197 |
-s|--sfe)
|
|
198 |
install_gnome=yes
|
|
199 |
;;
|
|
200 |
-o|--optional)
|
|
201 |
install_opt=yes
|
|
202 |
;;
|
1
|
203 |
*)
|
|
204 |
echo "Unknown option: $1"
|
|
205 |
exit 1
|
|
206 |
;;
|
|
207 |
esac
|
|
208 |
shift
|
|
209 |
done
|
|
210 |
}
|
|
211 |
|
11
|
212 |
# check the type and name of the compiler
|
|
213 |
# set CXX to match CC
|
|
214 |
identify_compiler () {
|
|
215 |
id_CC=$1
|
|
216 |
id_CC_name=unknown
|
|
217 |
id_CC_release=
|
|
218 |
id_CC_version=
|
|
219 |
id_CC_rev=
|
|
220 |
id_CC_label=unknown
|
|
221 |
|
|
222 |
id_CC_dir=$(dirname $id_CC)
|
|
223 |
|
|
224 |
# check if it's gcc
|
|
225 |
cc_version=$($id_CC --version 2>&1)
|
|
226 |
echo "$cc_version" | grep 'gcc (GCC)' > /dev/null && {
|
|
227 |
id_CC_name='GNU gcc'
|
|
228 |
id_CC_version=$(echo "$cc_version" | grep 'gcc (GCC)' | cut -f3 -d' ')
|
|
229 |
id_CC_release=$(echo $id_CC_version | cut -f1 -d.)
|
|
230 |
id_CC_label=gcc${id_CC_release}
|
|
231 |
CXX="$id_CC_dir/g++"
|
|
232 |
if [ ! -x "$CXX" ]; then
|
|
233 |
msg "WARNING: $CXX not found"
|
|
234 |
fi
|
|
235 |
log "$id_CC is $id_CC_name release $id_CC_release"
|
|
236 |
return
|
|
237 |
}
|
|
238 |
cc_version=$($id_CC -V 2>&1)
|
|
239 |
echo "$cc_version" | grep '^cc: Sun ' > /dev/null && {
|
|
240 |
id_CC_name='Sun Studio'
|
|
241 |
id_CC_version=$(echo "$cc_version" | grep '^cc: Sun ' | sed -e 's/^cc: Sun.* C \([0-9][0-9.]*\) .*/\1/')
|
|
242 |
id_CC_rev=$(echo "$cc_version" | grep '^cc: Sun ' | sed -e 's/^cc: Sun.* C [0-9][0-9.]* \(.\)*/\1/')
|
|
243 |
id_CC_rev=$(echo "$id_CC_rev" | grep '^cc: Sun ' | sed -e 's/SunOS_[^ ]* //')
|
|
244 |
if [ "x$id_CC_version" = x5.7 ]; then
|
|
245 |
id_CC_label='ss10'
|
|
246 |
id_CC_release='Vulcan'
|
|
247 |
id_CC_name='Sun Studio 10'
|
|
248 |
elif [ "x$id_CC_version" = x5.8 ]; then
|
|
249 |
id_CC_label='ss11'
|
|
250 |
id_CC_release='Venus'
|
|
251 |
id_CC_name='Sun Studio 11'
|
|
252 |
elif [ "x$id_CC_version" = x5.9 ]; then
|
|
253 |
id_CC_label='ss12'
|
|
254 |
id_CC_release='Mars'
|
|
255 |
id_CC_name='Sun Studio 12'
|
|
256 |
elif [ "x$id_CC_version" = x5.10 ]; then
|
|
257 |
id_CC_label='sexp'
|
|
258 |
id_CC_release='Ceres'
|
|
259 |
id_CC_name='Sun Studio Express'
|
|
260 |
else
|
|
261 |
id_CC_label="Studio_$id_CC_version"
|
|
262 |
id_CC_release="$id_CC_version"
|
|
263 |
fi
|
|
264 |
CXX="$id_CC_dir/CC"
|
|
265 |
if [ ! -x "$CXX" ]; then
|
|
266 |
msg "WARNING: $CXX not found"
|
|
267 |
fi
|
|
268 |
log "$id_CC is $id_CC_name release $id_CC_release"
|
|
269 |
return
|
|
270 |
}
|
|
271 |
msg "WARNING: could not identify $id_CC = $cc_version"
|
|
272 |
}
|
|
273 |
|
10
|
274 |
# create a build environent config file for the given build compiler
|
|
275 |
make_env () {
|
11
|
276 |
env_compiler=$1
|
|
277 |
envdir=$tempdir/env
|
|
278 |
logrun mkdir -p $envdir
|
|
279 |
identify_compiler $env_compiler
|
|
280 |
if [ "$id_CC_name" = unknown ]; then
|
|
281 |
return
|
|
282 |
fi
|
|
283 |
# identify_compiler sets CXX to match CC
|
|
284 |
# also id_CC_name, id_CC_label, id_CC_version, id_CC_release, id_CC_rev
|
|
285 |
env_file="$envdir/$id_CC_label"
|
12
|
286 |
env_nr=1
|
|
287 |
while test -f $env_file; do
|
|
288 |
env_file="$envdir/${id_CC_label}.${env_nr}"
|
|
289 |
env_nr=$(($env_nr + 1))
|
|
290 |
done
|
11
|
291 |
echo '# Build environment config file for the Desktop CBE' > "$env_file"
|
|
292 |
echo "CC_name='$id_CC_name'" >> "$env_file"
|
|
293 |
echo "CC_version='$id_CC_version'" >> "$env_file"
|
|
294 |
echo "CC_release='$id_CC_release'" >> "$env_file"
|
|
295 |
echo "CC_rev='$id_CC_rev'" >> "$env_file"
|
|
296 |
echo "cc_dir='$id_CC_dir'" >> "$env_file"
|
|
297 |
echo "CC='$env_compiler'" >> "$env_file"
|
|
298 |
echo "CXX='$CXX'" >> "$env_file"
|
10
|
299 |
}
|
|
300 |
|
|
301 |
# look for compilers in known locations
|
|
302 |
find_compilers () {
|
11
|
303 |
compiler_found=no
|
10
|
304 |
# FIXME: if CC = gcc, set CFLAGS to -std=c99
|
|
305 |
msg "Locating compilers..."
|
11
|
306 |
arch=$(uname -p)
|
12
|
307 |
known_compilers="/sgnome/onnv-tools/$arch/SS12/bin/cc /sgnome/onnv-tools/$arch/SS11/bin/cc /ws/onnv-tools/SUNWspro/SS12/bin/cc /ws/onnv-tools/SUNWspro/SS11/bin/cc /opt/SUNWspro/bin/cc /usr/bin/cc /opt/SunStudioExpress/bin/cc /usr/bin/gcc /usr/sfw/bin/gcc /usr/gnu/bin/gcc"
|
10
|
308 |
if [ "x$CC" != x ]; then
|
|
309 |
if [ ! -x $CC ]; then
|
|
310 |
unset CC
|
|
311 |
else
|
|
312 |
echo " $known_compilers " | grep " $CC " > /dev/null || \
|
|
313 |
known_compilers="$CC $known_compilers"
|
|
314 |
fi
|
|
315 |
fi
|
|
316 |
for compiler in $known_compilers; do
|
11
|
317 |
if [ -x $compiler -a ! -d $compiler ]; then
|
10
|
318 |
make_env $compiler
|
11
|
319 |
compiler_found=yes
|
|
320 |
fi
|
|
321 |
done
|
|
322 |
}
|
|
323 |
|
12
|
324 |
# download pkgbuild from sourceforge using wget
|
|
325 |
download_pkgbuild () {
|
|
326 |
mkdir -p $tardir
|
13
|
327 |
/usr/sfw/bin/wget -nd -nH --tries=1 -T 60 -O $tardir/pkgbuild-${PKGBUILD_VERSION}.tar.bz2 http://internode.dl.sourceforge.net/sourceforge/pkgbuild/pkgbuild-${PKGBUILD_VERSION}.tar.bz2 || {
|
12
|
328 |
msg "Failed to download pkgbuild, cannot continue."
|
|
329 |
exit 1
|
|
330 |
}
|
|
331 |
}
|
|
332 |
|
11
|
333 |
ask_compiler () {
|
|
334 |
ask 'Enter the path to the C compiler' ans_compiler
|
|
335 |
if [ ! -x $ans_compiler ]; then
|
|
336 |
msg "Invalid answer: $ans_compiler is not an executable"
|
|
337 |
return 1
|
|
338 |
fi
|
|
339 |
if [ -d $ans_compiler ]; then
|
|
340 |
msg "Invalid answer: $ans_compiler is a directory"
|
|
341 |
return 1
|
|
342 |
fi
|
|
343 |
identify_compiler "$ans_compiler"
|
|
344 |
if [ x$ans_compiler == xunknown ]; then
|
|
345 |
msg "Unknown compiler: $ans_compiler"
|
|
346 |
return 1
|
|
347 |
fi
|
|
348 |
compiler_found=yes
|
|
349 |
make_env "$ans_compiler"
|
|
350 |
return 0
|
|
351 |
}
|
|
352 |
|
|
353 |
# ask the user for additional compiler locations
|
|
354 |
ask_compilers () {
|
|
355 |
first=$1
|
|
356 |
ans_more_compilers=yes
|
|
357 |
while [ $ans_more_compilers = yes ]; do
|
|
358 |
if [ "x$first" = xfirst ]; then
|
|
359 |
msg "You need a C compiler in order to use the Desktop CBE"
|
|
360 |
ask_compiler && first=no
|
|
361 |
else
|
|
362 |
ask_yes_no 'Would you like to configure more compilers for use with the Desktop CBE?' ans_more_compilers no
|
|
363 |
if [ $ans_more_compilers = yes ]; then
|
|
364 |
ask_compiler
|
|
365 |
fi
|
10
|
366 |
fi
|
1
|
367 |
done
|
|
368 |
}
|
|
369 |
|
11
|
370 |
# print the details of a compiler specified by its env config file
|
|
371 |
display_compiler () {
|
|
372 |
. $1
|
|
373 |
echo "$2 - $CC_name $CC_version ($CC_release) in $cc_dir"
|
10
|
374 |
}
|
|
375 |
|
|
376 |
# select the default compiler configuration
|
|
377 |
select_default_compiler () {
|
11
|
378 |
if [ $compiler_found = yes ]; then
|
|
379 |
echo
|
12
|
380 |
echo "The following compilers were found on your system:"
|
11
|
381 |
i=1
|
|
382 |
for env in $envdir/*; do
|
|
383 |
display_compiler $env $i
|
|
384 |
eval env_$i="$env"
|
|
385 |
i=$((i + 1))
|
|
386 |
done
|
12
|
387 |
i=$(($i - 1))
|
11
|
388 |
if [ "x$1" != xdont_ask ]; then
|
|
389 |
ask_compilers
|
12
|
390 |
# don't ask again if the user whats to configure more compilers
|
|
391 |
select_default_compiler dont_ask
|
|
392 |
return
|
11
|
393 |
fi
|
|
394 |
else
|
|
395 |
echo "No compilers were found on your system."
|
|
396 |
if [ $PKG_SYSTEM = pkg ]; then
|
|
397 |
ask_yes_no "Would you like the to install compilers now?" \
|
|
398 |
ans_install_compiler yes
|
|
399 |
if [ x$ans_install_compiler = yes ]; then
|
|
400 |
install_compilers_pkg && {
|
|
401 |
find_compilers
|
12
|
402 |
# don't ask again if the user whats
|
|
403 |
# to configure more compilers
|
11
|
404 |
select_default_compiler dont_ask
|
|
405 |
return
|
|
406 |
}
|
|
407 |
fi
|
|
408 |
fi
|
|
409 |
ask_compilers first
|
|
410 |
select_default_compiler dont_ask
|
|
411 |
return
|
|
412 |
fi
|
|
413 |
|
12
|
414 |
if [ $i = 1 ]; then
|
|
415 |
# there's only one compiler no need to ask which one's the default
|
|
416 |
ans_default_compiler=1
|
|
417 |
else
|
|
418 |
ans_default_compiler=9999
|
|
419 |
while [ $ans_default_compiler -gt $i ]; do
|
|
420 |
ask 'Please select the default compiler' ans_default_compiler $i
|
|
421 |
is_number "$ans_default_compiler" || {
|
|
422 |
echo "Please enter a number from 1 to $i"
|
|
423 |
ans_default_compiler=9999
|
|
424 |
}
|
|
425 |
done
|
|
426 |
fi
|
11
|
427 |
eval default_env="\$env_$ans_default_compiler"
|
|
428 |
if [ ! -f $default_env ]; then
|
|
429 |
msg "Internal error in cbe-install, please report to desktop-discuss"
|
|
430 |
fi
|
|
431 |
. $default_env
|
|
432 |
export CC
|
|
433 |
export CXX
|
10
|
434 |
}
|
|
435 |
|
|
436 |
# verify that the running system is suitable for the Desktop CBE
|
|
437 |
# and set up some variables
|
1
|
438 |
init () {
|
|
439 |
myos=`uname -s`
|
|
440 |
if [ "x$myos" != xSunOS ]; then
|
|
441 |
echo "Run this script on a Solaris system."
|
|
442 |
exit 1
|
|
443 |
fi
|
|
444 |
|
|
445 |
umask 0022
|
12
|
446 |
the_cpu=`uname -p`
|
|
447 |
if [ "x$the_cpu" != xsparc ]; then
|
|
448 |
the_cpu=x86
|
|
449 |
fi
|
1
|
450 |
|
|
451 |
myos_rel=`uname -r`
|
|
452 |
if [ "x$myos_rel" = "x5.10" -o "x$myos_rel" = "x5.10.1" -o "x$myos_rel" = "x5.11" ]; then
|
10
|
453 |
:
|
1
|
454 |
else
|
10
|
455 |
echo "Solaris 10, Solaris Nevada or OpenSolaris required."
|
1
|
456 |
exit 1
|
|
457 |
fi
|
|
458 |
|
10
|
459 |
if [ "x$myos_rel" = "x5.10" ]; then
|
|
460 |
solaris_pkg_dir=/cdrom/cdrom0/Solaris_10/Product
|
|
461 |
elif [ "x$myos_rel" = "x5.11" ]; then
|
|
462 |
solaris_pkg_dir=/cdrom/cdrom0/Solaris_11/Product
|
|
463 |
fi
|
|
464 |
|
1
|
465 |
mydir=$(cd $(dirname $0); pwd);
|
10
|
466 |
tardir=${mydir}/tarballs
|
1
|
467 |
|
|
468 |
CBE_VERSION=`cat $mydir/CBE_VERSION`
|
10
|
469 |
echo "Desktop Common Build Environment (CBE) Installer version $CBE_VERSION"
|
1
|
470 |
|
|
471 |
my_id=`/usr/xpg4/bin/id -u`
|
|
472 |
if [ "x$my_id" != x0 ]; then
|
10
|
473 |
prof_sw_inst=`/bin/profiles | nl -s: | grep 'Software Installation' | cut -f1 -d:`
|
|
474 |
prof_pri_adm=`/bin/profiles | nl -s: | grep 'Primary Administrator' | cut -f1 -d:`
|
|
475 |
prof_basic_usr=`/bin/profiles | nl -s: | grep 'Basic Solaris User' | cut -f1 -d:`
|
|
476 |
if [ "x$prof_sw_inst" = x -a "x$prof_pri_adm" = x ]; then
|
|
477 |
echo 'Run this script as root or as a user with the "Software Installation"'
|
|
478 |
echo 'or "Primary Administrator" profile.'
|
|
479 |
test -x /usr/bin/users-admin && {
|
|
480 |
echo
|
|
481 |
echo 'You can also use the users-admin program (System -> Administration ->'
|
|
482 |
echo 'Users and Groups in the GNOME menu) to assign profiles.'
|
|
483 |
echo
|
|
484 |
}
|
|
485 |
echo 'See the user_attr(4) and profiles(1) manual pages for further details'
|
1
|
486 |
exit 1
|
10
|
487 |
else
|
|
488 |
if [ "x$prof_basic_usr" != x ]; then
|
|
489 |
if [ "x$prof_sw_inst" != x ]; then
|
|
490 |
if [ $prof_sw_inst -gt $prof_basic_usr ]; then
|
|
491 |
echo 'The "Software Installation" profile in /etc/user_attr should appear'
|
|
492 |
echo 'before Basic Solaris User.'
|
|
493 |
exit 1
|
|
494 |
fi
|
|
495 |
fi
|
|
496 |
if [ "x$prof_pri_adm" != x ]; then
|
|
497 |
if [ $prof_pri_adm -gt $prof_basic_usr ]; then
|
|
498 |
echo 'The "Primary Administrator" profile in /etc/user_attr should appear'
|
|
499 |
echo 'before Basic Solaris User.'
|
|
500 |
exit 1
|
|
501 |
fi
|
|
502 |
fi
|
|
503 |
fi
|
1
|
504 |
fi
|
10
|
505 |
LOGFILE=/tmp/desktop-cbe-${CBE_VERSION}.install.log.$$
|
1
|
506 |
else
|
10
|
507 |
LOGFILE=/var/sadm/install/logs/desktop-cbe-${CBE_VERSION}.install.log.$$
|
1
|
508 |
fi
|
|
509 |
|
10
|
510 |
# svr4 or pkg(5)
|
|
511 |
check_pkg_system
|
|
512 |
msg "Using \"$PKG_SYSTEM\" packaging system"
|
|
513 |
|
1
|
514 |
msg "Checking for required packages..."
|
10
|
515 |
if [ $PKG_SYSTEM = pkg ]; then
|
|
516 |
check_cbe_dependencies_pkg $CBE_PKG_DEPENDENCIES
|
|
517 |
else
|
|
518 |
check_cbe_dependencies_svr4 $CBE_SVR4_DEPENDENCIES
|
|
519 |
fi
|
|
520 |
if [ $DEPS_OK = yes ]; then
|
|
521 |
msg "All required packages are installed."
|
|
522 |
else
|
|
523 |
if [ $DEPS_INSTALLED = yes ]; then
|
|
524 |
msg "Successfully installed all required packages"
|
|
525 |
else
|
|
526 |
msg "WARNING: some required packages are missing. Expect build issues..."
|
|
527 |
fi
|
|
528 |
fi
|
1
|
529 |
|
13
|
530 |
need_tarballs=no
|
16
|
531 |
if [ ! -f $mydir/pkgs-${the_cpu}/CBElibtool/pkginfo ]; then
|
|
532 |
# no packages found, will need to build from source
|
|
533 |
test ! -f $tardir/pkgbuild-${PKGBUILD_VERSION}.tar.bz2 && {
|
|
534 |
download_pkgbuild
|
|
535 |
need_tarballs=yes
|
|
536 |
}
|
|
537 |
fi
|
13
|
538 |
|
1
|
539 |
if ! pkginfo -R $rootdir -q 'SUNWgpch.*'; then
|
|
540 |
echo "ERROR: pkgbuild requires the GNU patch utility (/usr/bin/gpatch)."
|
|
541 |
echo "ERROR: please install SUNWgpch from your Solaris installation media"
|
10
|
542 |
echo "ERROR: before installing the Desktop CBE."
|
1
|
543 |
exit 1
|
|
544 |
fi
|
|
545 |
|
|
546 |
if ! pkginfo -R $rootdir -q 'SUNWgtar.*'; then
|
|
547 |
echo "ERROR: pkgbuild requires the GNU tar utility (/usr/sfw/bin/gtar)."
|
|
548 |
echo "ERROR: please install SUNWgtar from your Solaris installation media"
|
10
|
549 |
echo "ERROR: before installing the Desktop CBE."
|
1
|
550 |
exit 1
|
|
551 |
fi
|
|
552 |
|
|
553 |
if [ -f /usr/sfw/include/glib.h ]; then
|
10
|
554 |
echo "WARNING: /usr/sfw/include/glib.h is in conflict with the Desktop headers."
|
1
|
555 |
echo "WARNING: Please remove this file or SUNWGlib to avoid build problems."
|
|
556 |
echo
|
|
557 |
echo "Press Enter to continue"
|
|
558 |
read dummy
|
|
559 |
fi
|
|
560 |
|
|
561 |
if ! pkginfo -R $rootdir -q 'SUNWwgetu.*'; then
|
|
562 |
echo "WARNING: pkgbuild requires wget for full functionality."
|
|
563 |
echo "WARNING: please install SUNWwgetr and SUNWwgetu from your"
|
|
564 |
echo "WARNING: Solaris installation media"
|
|
565 |
echo
|
|
566 |
echo "Press Enter to continue"
|
|
567 |
read dummy
|
|
568 |
fi
|
|
569 |
|
|
570 |
log "Running on `uname -a`"
|
|
571 |
log "My directory is $mydir"
|
|
572 |
|
10
|
573 |
ENV_SET=`env | grep '^[a-zA-Z0-9_]*=' | cut -f1 -d=`
|
1
|
574 |
for var in $ENV_SET; do
|
|
575 |
case $var in
|
|
576 |
PS1|PS2|HZ|TERM|SHELL|OLDPWD|PATH|MAIL|PWD|TZ|SHLVL|HOME|LOGNAME|PRINTER|HOSTNAME|_|CC|CXX|EDITOR|SSH_*|DISPLAY|LESS*|LS_COLORS|LS_OPTIONS|TERMINFO|PAGER|MANPATH|VISUAL)
|
|
577 |
;;
|
|
578 |
*)
|
|
579 |
val=`eval echo "\\\$$var"`
|
|
580 |
log "Unsetting $var (=\"$val\")"
|
|
581 |
unset $var
|
|
582 |
;;
|
|
583 |
esac
|
|
584 |
done
|
|
585 |
|
10
|
586 |
tempdir=`mktemp -d /tmp/cbe-install-XXXX`
|
1
|
587 |
tempdirs="$tempdirs:$tempdir"
|
10
|
588 |
if [ ! -d $tempdir ]; then
|
|
589 |
msg_err "Failed to create temporary directory in /tmp"
|
|
590 |
exit 1
|
|
591 |
fi
|
1
|
592 |
|
12
|
593 |
# if binary packages are found in the pkgs-*/ subdir then this is a
|
10
|
594 |
# binary install
|
12
|
595 |
if [ -f $mydir/pkgs-${the_cpu}/CBElibtool/pkginfo ]; then
|
1
|
596 |
binary_install=yes
|
12
|
597 |
pkg_arch=`grep '^ARCH=' $mydir/pkgs-${the_cpu}/CBElibtool/pkginfo | cut -f2 -d=`
|
1
|
598 |
arch=`uname -p`
|
|
599 |
if [ "x$arch" != "x$pkg_arch" ]; then
|
|
600 |
echo "ERROR: wrong architecture"
|
10
|
601 |
echo "ERROR: these Desktop CBE packages must be installed on a $pkg_arch system"
|
1
|
602 |
exit 1
|
|
603 |
fi
|
10
|
604 |
cbe_prefix=/opt/dtbld
|
1
|
605 |
else
|
|
606 |
binary_install=no
|
|
607 |
fi
|
|
608 |
}
|
|
609 |
|
11
|
610 |
is_number () {
|
|
611 |
if [ "x$1" = xOK ]; then
|
|
612 |
return 1
|
|
613 |
fi
|
|
614 |
temp=$(echo "$1" | sed -e 's/[1-9][0-9]*/OK/')
|
|
615 |
if [ "x$temp" == xOK ]; then
|
|
616 |
return 0
|
|
617 |
fi
|
|
618 |
return 1
|
|
619 |
}
|
|
620 |
|
1
|
621 |
# ask "question" variable_name "default answer"
|
|
622 |
#
|
|
623 |
# answer is stored in variable variable_name
|
|
624 |
ask () {
|
|
625 |
echo -n "$1"
|
|
626 |
if [ ! -z $3 ]; then
|
|
627 |
echo -n " [$3]: "
|
|
628 |
else
|
|
629 |
echo -n ": "
|
|
630 |
fi
|
|
631 |
|
|
632 |
read -e val
|
|
633 |
if [ "x$val" = x ]; then
|
|
634 |
eval "$2=\"$3\""
|
|
635 |
else
|
|
636 |
eval "$2=\"$val\""
|
|
637 |
fi
|
|
638 |
}
|
|
639 |
|
|
640 |
# ask_yes_no "question" variable_name "default answer"
|
|
641 |
#
|
|
642 |
# Answer ("yes" or "no") is stored in variable variable_name.
|
|
643 |
# Keep asking the user until the answer is yes or no.
|
|
644 |
ask_yes_no () {
|
|
645 |
yes_no_repeat=yes
|
|
646 |
while [ $yes_no_repeat = yes ]; do
|
|
647 |
yes_no_repeat=no
|
|
648 |
ask "${@}"
|
|
649 |
eval "the_ans=\"\$$2\""
|
|
650 |
case "$the_ans" in
|
|
651 |
[yY]|[yY][eE][sS] )
|
|
652 |
eval "$2=yes"
|
|
653 |
;;
|
|
654 |
[nN]|[nN][oO] )
|
|
655 |
eval "$2=no"
|
|
656 |
;;
|
|
657 |
* )
|
|
658 |
echo "Please answer yes or no"
|
|
659 |
yes_no_repeat=yes
|
|
660 |
esac
|
|
661 |
done
|
|
662 |
}
|
|
663 |
|
|
664 |
# get_dir "question" "answer_var" "default answer" "owner"
|
|
665 |
#
|
|
666 |
# Ask for a directory name and make sure it exists or create it
|
|
667 |
# for the user
|
|
668 |
get_dir () {
|
|
669 |
repeat=yes
|
|
670 |
while [ $repeat = yes ]; do
|
|
671 |
repeat=no
|
|
672 |
ask "$1" new_dir "$3"
|
|
673 |
case "$new_dir" in
|
|
674 |
/* )
|
|
675 |
# absolute path name, nothing to do
|
|
676 |
;;
|
|
677 |
~* )
|
|
678 |
if [ "x$rootdir" != x/ ]; then
|
10
|
679 |
msg "The Desktop CBE is being installed to an alternate root directory."
|
1
|
680 |
msg "You need to specify the full path to directories within the alternate root."
|
|
681 |
repeat=yes
|
|
682 |
continue
|
|
683 |
fi
|
|
684 |
d1=`echo "$new_dir" | cut -f1 -d/`
|
|
685 |
d2=`echo "$new_dir/" | cut -f2- -d/`
|
|
686 |
d1n=$(eval echo "$d1")
|
|
687 |
test -d "$d1n" || {
|
|
688 |
repeat=yes
|
|
689 |
msg "Directory not found: $d1"
|
|
690 |
continue
|
|
691 |
}
|
|
692 |
d1n=$(cd "$d1n" 2>/dev/null && pwd) || {
|
|
693 |
repeat=yes
|
|
694 |
msg "Failed to access directory: $d1"
|
|
695 |
continue
|
|
696 |
}
|
|
697 |
msg "Directory $new_dir expanded to $d1n/$d2"
|
|
698 |
new_dir="$d1n/$d2"
|
|
699 |
;;
|
|
700 |
* )
|
|
701 |
if [ "x$rootdir" != x/ ]; then
|
10
|
702 |
msg "The Desktop CBE is being installed to an alternate root directory."
|
1
|
703 |
msg "You need to specify the full path to directories within the alternate root."
|
|
704 |
repeat=yes
|
|
705 |
continue
|
|
706 |
fi
|
|
707 |
d1=`echo "$new_dir" | cut -f1 -d/`
|
|
708 |
d2=`echo "$new_dir/" | cut -f2- -d/`
|
|
709 |
d1n=$(eval echo "$d1")
|
|
710 |
test -d "$d1n" || {
|
|
711 |
repeat=yes
|
|
712 |
msg "Directory not found: $d1"
|
|
713 |
continue
|
|
714 |
}
|
|
715 |
d1n=$(cd "$d1n" 2>/dev/null && pwd) || {
|
|
716 |
repeat=yes
|
|
717 |
msg "Failed to access directory: $d1"
|
|
718 |
continue
|
|
719 |
}
|
|
720 |
msg "Directory $new_dir expanded to $d1n/$d2"
|
|
721 |
new_dir="$d1n/$d2"
|
|
722 |
;;
|
|
723 |
esac
|
|
724 |
done
|
|
725 |
if [ "x$new_dir" != "x/" ]; then
|
|
726 |
new_dir=`echo "$new_dir" | sed -e 's%/*$%%'`
|
|
727 |
fi
|
|
728 |
eval "$2=\"$new_dir\""
|
|
729 |
}
|
|
730 |
|
|
731 |
# gather info for the installation from the user
|
|
732 |
ask_defaults () {
|
|
733 |
if [ $binary_install != yes ]; then
|
|
734 |
repeat=yes
|
|
735 |
while [ $repeat = yes ]; do
|
|
736 |
repeat=no
|
|
737 |
get_dir "Enter the base directory (prefix) of the cbe" \
|
|
738 |
cbe_prefix $cbe_prefix root
|
|
739 |
if [ "$cbe_prefix" = "/" -o "$cbe_prefix" = "/tmp" ]; then
|
|
740 |
echo "This directory is not allowed."
|
|
741 |
echo "Please choose a different one as the cbe prefix"
|
|
742 |
repeat=yes
|
|
743 |
fi
|
|
744 |
done
|
|
745 |
fi
|
|
746 |
|
|
747 |
if [ ! -f "$HOME/.pkgbuildmacros" -a ! -d "$HOME/packages" ]; then
|
|
748 |
# the user probably hasn't used pkgbuild >= 1.1.0 yet
|
|
749 |
# so let's ask if they want to use a specific topdir
|
|
750 |
# instead of $HOME/packages
|
10
|
751 |
echo "Starting from pkgbuild 1.1.0 (CBE 1.5) there is no system-wide"
|
1
|
752 |
echo "build directory (%_topdir), instead, each user has their own."
|
|
753 |
echo "The default directory is \$HOME/packages."
|
|
754 |
echo "If you wish to use a different build directory, you can define it"
|
|
755 |
echo "in \$HOME/.pkgbuildmacros as follows:"
|
|
756 |
echo
|
|
757 |
echo " %_topdir /path/to/my/build/area"
|
|
758 |
echo
|
|
759 |
if [ "$uid" = 0 ]; then
|
|
760 |
echo
|
|
761 |
echo Press Enter to continue
|
|
762 |
read dummy
|
|
763 |
else
|
|
764 |
ask_yes_no "Would you like to do this now?" \
|
|
765 |
set_topdir no
|
|
766 |
if [ $set_topdir = no ]; then
|
|
767 |
log "the user chose not to change the default topdir"
|
|
768 |
echo "The default topdir ($HOME/packages) will be used"
|
|
769 |
else
|
|
770 |
get_dir "Enter your build directory" default_topdir \
|
|
771 |
"$cbe_prefix/packages" $logname
|
|
772 |
log "the user selected $default_topdir for topdir"
|
|
773 |
echo "%_topdir $default_topdir" > $HOME/.pkgbuildmacros
|
|
774 |
log "created $HOME/.pkgbuildmacros"
|
|
775 |
fi
|
|
776 |
fi
|
|
777 |
else
|
|
778 |
log "the user already has a .pkgbuildmacros file or ~/packages dir"
|
|
779 |
fi
|
|
780 |
|
10
|
781 |
find_compilers
|
11
|
782 |
select_default_compiler
|
1
|
783 |
|
10
|
784 |
if [ x$install_gnome = xno -a x$install_kde = xno \
|
|
785 |
-a x$install_opt = xno -a x$install_sfe = xno ]; then
|
|
786 |
# no components selected using the CLI (--gnome, etc.)
|
1
|
787 |
|
10
|
788 |
echo
|
|
789 |
echo "The Desktop CBE includes tools for building GNOME, KDE and/or SFE packages"
|
|
790 |
echo "It also includes some optional tools. Please select the tools you wish"
|
|
791 |
echo "to install."
|
|
792 |
echo
|
|
793 |
ask_yes_no "Would you like install the tools for GNOME?" install_gnome yes
|
|
794 |
ask_yes_no "Would you like install the tools for KDE?" install_kde yes
|
|
795 |
ask_yes_no "Would you like install the tools for SFE?" install_sfe yes
|
|
796 |
echo
|
12
|
797 |
echo The following tools are optional: $OPT_MODULES
|
10
|
798 |
ask_yes_no "Would you like install the optional tools?" install_opt yes
|
1
|
799 |
fi
|
|
800 |
}
|
|
801 |
|
|
802 |
# create an admin file for pkgadd/pkgrm
|
|
803 |
make_admin_file () {
|
|
804 |
echo "mail=" > $1
|
|
805 |
echo "instance=unique" >> $1
|
|
806 |
echo "conflict=nocheck" >> $1
|
|
807 |
echo "conflict=quit" >> $1
|
|
808 |
echo "setuid=nocheck" >> $1
|
|
809 |
echo "action=nocheck" >> $1
|
|
810 |
echo "partial=quit" >> $1
|
|
811 |
echo "space=quit" >> $1
|
|
812 |
if [ "$2" = "pkgrm" ]; then
|
|
813 |
echo "idepend=nocheck" >> $1
|
|
814 |
echo "rdepend=nocheck" >> $1
|
|
815 |
else
|
|
816 |
echo "idepend=quit" >> $1
|
|
817 |
echo "rdepend=quit" >> $1
|
|
818 |
fi
|
|
819 |
}
|
|
820 |
|
|
821 |
# run a command, redirect the output to a log file and also print it
|
|
822 |
# on stdout
|
|
823 |
logrun () {
|
|
824 |
status_file=/tmp/.command_status.$$
|
|
825 |
/usr/bin/rm -f $status_file
|
|
826 |
log "running $*"
|
|
827 |
log "*** command output follows ***"
|
|
828 |
( "${@}" 2>&1 ; echo $? > $status_file ) | tee -a $LOGFILE
|
|
829 |
log "*** command output ends ***"
|
|
830 |
status=`cat $status_file`
|
|
831 |
/usr/bin/rm -f $status_file
|
|
832 |
return $status
|
|
833 |
}
|
|
834 |
|
10
|
835 |
# run a command, redirect the output to a log file and also print it
|
|
836 |
# on stdout
|
|
837 |
logrun_quiet () {
|
|
838 |
log "running $*"
|
|
839 |
log "*** command output follows ***"
|
|
840 |
"${@}" >>$LOGFILE 2>&1
|
|
841 |
status=$?
|
|
842 |
log "*** command output ends ***"
|
|
843 |
return $status
|
|
844 |
}
|
|
845 |
|
1
|
846 |
# check if a package is installed and if so, offer to uninstall it
|
|
847 |
check_if_installed () {
|
10
|
848 |
for f in $*; do
|
|
849 |
skip_package=no
|
1
|
850 |
|
10
|
851 |
pkginfo -R $rootdir -q "$f"'.*' || return 0
|
1
|
852 |
|
10
|
853 |
if [ x$always_uninstall_existing != xyes -a x$always_skip_existing != xyes ]; then
|
|
854 |
msg "Package $f is already installed."
|
|
855 |
ask_yes_no "Would you like uninstall it?" do_uninstall yes
|
|
856 |
if [ $do_uninstall = yes ]; then
|
|
857 |
if [ x$always_uninstall_existing != xno ]; then
|
|
858 |
ask_yes_no "Always uninstall previously installed packages?" \
|
|
859 |
always_uninstall_existing yes
|
|
860 |
log "always_uninstall_existing = $always_uninstall_existing"
|
|
861 |
fi
|
|
862 |
fi
|
|
863 |
else
|
|
864 |
if [ x$always_skip_existing = xyes ]; then
|
|
865 |
msg "Skipping package $f -- already installed"
|
|
866 |
skip_package=yes
|
|
867 |
return 0
|
|
868 |
else
|
|
869 |
do_uninstall=yes
|
|
870 |
fi
|
|
871 |
fi
|
|
872 |
if [ $do_uninstall = yes ]; then
|
|
873 |
log "User chose to uninstall $f"
|
|
874 |
make_admin_file /tmp/pkgrm.admin.$$ pkgrm || return 1
|
|
875 |
pkgrm_failed=no
|
|
876 |
logrun pfexec /usr/sbin/pkgrm -R $rootdir -n -a /tmp/pkgrm.admin.$$ "$f.*" || pkgrm_failed=yes
|
|
877 |
if [ $pkgrm_failed = yes ]; then
|
|
878 |
ask_yes_no "pkgrm failed. would you like to continue anyway?" pkgrm_cont no
|
|
879 |
if [ $pkgrm_cont = yes ]; then
|
|
880 |
log "User chose to continue anyway"
|
|
881 |
return 0
|
|
882 |
fi
|
|
883 |
return 1
|
|
884 |
fi
|
|
885 |
return 0
|
|
886 |
else
|
|
887 |
log "User chose not to uninstall $f"
|
|
888 |
if [ x$always_skip_existing != xyes ]; then
|
|
889 |
ask_yes_no "Would you like skip to the next package?
|
|
890 |
(\"no\" means the installer will try to build and install a duplicate package)" skip_package yes
|
|
891 |
if [ $skip_package = yes ]; then
|
|
892 |
log "User chose to skip package $f"
|
|
893 |
if [ x$always_skip_existing != xno ]; then
|
|
894 |
ask_yes_no "Always skip packages that are already installed?" always_skip_existing yes
|
|
895 |
log "always_skip_existing = $always_skip_existing"
|
|
896 |
fi
|
|
897 |
return 0
|
|
898 |
fi
|
|
899 |
else
|
|
900 |
skip_package=yes
|
1
|
901 |
return 0
|
|
902 |
fi
|
10
|
903 |
msg "Not uninstalling $f."
|
|
904 |
msg "NOTE that this may cause problems later"
|
|
905 |
ask "Press Enter to continue" dummy ""
|
1
|
906 |
return 0
|
|
907 |
fi
|
10
|
908 |
done
|
1
|
909 |
return 0
|
|
910 |
}
|
|
911 |
|
|
912 |
# install a list of svr4 packages given its directory, altroot and the
|
|
913 |
# names of the packages
|
|
914 |
install_pkgs () {
|
|
915 |
pdir=$1; shift
|
|
916 |
rdir=$1; shift
|
|
917 |
make_admin_file $tempdir/pkgadd.admin.$$ pkgadd
|
|
918 |
|
|
919 |
for pkg in $*; do
|
|
920 |
msg "Installing package $pkg"
|
|
921 |
logrun pfexec /usr/sbin/pkgadd -R "$rdir" -n -a $tempdir/pkgadd.admin.$$ -d "$pdir" $pkg || \
|
|
922 |
return 1
|
|
923 |
done
|
|
924 |
/usr/bin/rm -f $tempdir/pkgadd.admin.$$
|
|
925 |
return 0
|
|
926 |
}
|
|
927 |
|
10
|
928 |
# check if the system is pkg(5) based or SVr4 based
|
|
929 |
# To identify, we check which system was used to install SUNWcs/SUNWcsu
|
|
930 |
# Output: set the PKG_SYSTEM variable with either pkg or svr4
|
|
931 |
check_pkg_system () {
|
|
932 |
if [ -x /usr/bin/pkg -a -d /var/pkg/catalog ]; then
|
|
933 |
pkg -R $rootdir list SUNWcs > /dev/null 2>&1 && {
|
|
934 |
PKG_SYSTEM=pkg
|
|
935 |
return
|
|
936 |
}
|
|
937 |
fi
|
|
938 |
|
|
939 |
pkginfo -R $rootdir -q SUNWcsu && {
|
|
940 |
PKG_SYSTEM=svr4
|
|
941 |
return
|
|
942 |
}
|
|
943 |
|
|
944 |
msg_err "Could not identify the packaging system"
|
|
945 |
exit 1
|
|
946 |
}
|
|
947 |
|
|
948 |
pkg_refreshed=no
|
|
949 |
pkg_refresh () {
|
|
950 |
if [ $pkg_refreshed = no ]; then
|
|
951 |
msg "Refeshing the package catalogs..."
|
|
952 |
logrun_quiet pfexec pkg -R $rootdir refresh
|
|
953 |
pkg_refreshed=yes
|
|
954 |
fi
|
|
955 |
}
|
|
956 |
|
|
957 |
pkg_try_install () {
|
|
958 |
pkg_refresh
|
|
959 |
pfexec pkg -R $rootdir install -q $1 && {
|
|
960 |
msg "$1 installed successfully"
|
|
961 |
return 0
|
|
962 |
} || {
|
|
963 |
msg "Failed to install package $1"
|
|
964 |
msg "Retrying in verbose mode:"
|
|
965 |
pfexec pkg -R $rootdir install -v $1 && {
|
|
966 |
msg "$1 installed successfully"
|
|
967 |
return 0
|
|
968 |
} || {
|
|
969 |
msg "Installation of $1 failed again."
|
|
970 |
ask_yes_no "Would you like to continue? (no means exit)" ans_continue no
|
|
971 |
if [ $ans_continue = no ]; then
|
|
972 |
exit 1
|
|
973 |
fi
|
|
974 |
DEPS_INSTALLED=no
|
|
975 |
return 1
|
|
976 |
}
|
|
977 |
}
|
|
978 |
}
|
|
979 |
|
1
|
980 |
install_all_dependencies=
|
10
|
981 |
skip_all_dependencies=
|
|
982 |
check_cbe_dependencies_pkg () {
|
|
983 |
DEPS_OK=yes
|
|
984 |
DEPS_INSTALLED=no
|
|
985 |
for pkg in $*; do
|
|
986 |
pkg -R $rootdir list $pkg > /dev/null 2>&1 && {
|
|
987 |
log "$pkg is installed"
|
|
988 |
} || {
|
|
989 |
log "$pkg is not installed"
|
|
990 |
DEPS_OK=no
|
|
991 |
if [ x$skip_all_dependencies = xyes ]; then
|
|
992 |
msg " $pkg is not installed (skipping)"
|
|
993 |
elif [ x$install_all_dependencies = xyes ]; then
|
|
994 |
pkg_try_install $pkg
|
|
995 |
elif [ x$install_all_dependencies = x ]; then
|
|
996 |
msg "Package $pkg is not installed"
|
|
997 |
ask_yes_no "Would you like the CBE installer to install this package for you?" ans_install_dep "yes"
|
|
998 |
if [ $ans_install_dep = yes ]; then
|
|
999 |
ask_yes_no "Would you like the CBE installer to install all required packages?" install_all_dependencies yes
|
|
1000 |
pkg_try_install $pkg && {
|
|
1001 |
DEPS_INSTALLED=yes
|
|
1002 |
}
|
|
1003 |
else
|
|
1004 |
# user chose not to install this dep
|
|
1005 |
DEPS_INSTALLED=no
|
|
1006 |
log "The user chose not to install $pkg"
|
|
1007 |
if [ x$skip_all_dependencies = x ]; then
|
|
1008 |
ask_yes_no "Would you like to skip all missing packages?" skip_all_dependencies no
|
|
1009 |
fi
|
|
1010 |
fi
|
|
1011 |
elif [ x$install_all_dependencies = xno ]; then
|
|
1012 |
msg "Package $pkg is not installed"
|
|
1013 |
ask_yes_no "Install this package?" ans_install_dep "yes"
|
|
1014 |
if [ $ans_install_dep = yes ]; then
|
|
1015 |
pkg_try_install $pkg
|
|
1016 |
fi
|
|
1017 |
fi
|
|
1018 |
}
|
|
1019 |
done
|
|
1020 |
}
|
|
1021 |
|
|
1022 |
install_all_dependencies=
|
|
1023 |
skip_all_dependencies=
|
|
1024 |
# check if the pkgs GNOME or KDE requires are installed; if not install them
|
|
1025 |
check_cbe_dependencies_svr4 () {
|
|
1026 |
DEPS_OK=yes
|
|
1027 |
DEPS_INSTALLED=yes
|
1
|
1028 |
# we're going to cp solaris pkgs from the media to this dir
|
|
1029 |
tmp_pkg_dir=`mktemp -d /tmp/cbe-pkgs-XXXX`
|
|
1030 |
# schedule this dir for removal if the installation is aborted
|
|
1031 |
tempdirs="$tempdirs:$tmp_pkg_dir"
|
10
|
1032 |
if [ ! -d $tmp_pkg_dir ]; then
|
|
1033 |
msg_err "Failed to create temporary directory in /tmp"
|
|
1034 |
exit 1
|
|
1035 |
fi
|
|
1036 |
for pkg in $*; do
|
1
|
1037 |
pkginfo -R $rootdir -q "$pkg."'*' && continue
|
10
|
1038 |
DEPS_OK=no
|
|
1039 |
if [ x$skip_all_dependencies = xyes ]; then
|
|
1040 |
msg " $pkg is not installed (skipping)"
|
|
1041 |
continue
|
|
1042 |
elif [ x$install_all_dependencies = x ]; then
|
|
1043 |
msg "Package $pkg is not installed"
|
|
1044 |
ask_yes_no "Would you like the CBE installer to install this package for you?" ans_install_dep "yes"
|
|
1045 |
if [ $ans_install_dep = yes ]; then
|
|
1046 |
ask_yes_no "Would you like the CBE installer to install all required packages?" install_all_dependencies yes
|
1
|
1047 |
while /bin/true; do
|
|
1048 |
ask "Enter the path to the Solaris packages" \
|
|
1049 |
solaris_pkg_dir "$solaris_pkg_dir"
|
|
1050 |
# Copy all packages found in $solaris_pkg_dir to a temporary
|
|
1051 |
# dir so that people installing from CDs don't need to
|
|
1052 |
# swap CDs all the time...
|
10
|
1053 |
for p0 in $CBE_SVR4_DEPENDENCIES; do
|
|
1054 |
# already copied to the tmp dir
|
1
|
1055 |
test -d $tmp_pkg_dir/$p0 && continue
|
10
|
1056 |
# already installed, no need to copy
|
|
1057 |
pkginfo -q $p0 && continue
|
1
|
1058 |
test -d "$solaris_pkg_dir/$p0" && \
|
10
|
1059 |
/bin/cp -pr "$solaris_pkg_dir/$p0" $tmp_pkg_dir && \
|
1
|
1060 |
/bin/chmod -R u+w $tmp_pkg_dir/$p0
|
|
1061 |
done
|
|
1062 |
test -d "$solaris_pkg_dir/$pkg" && break
|
|
1063 |
msg "$solaris_pkg_dir/$pkg not found"
|
|
1064 |
done
|
|
1065 |
else
|
10
|
1066 |
log "The user chose not to install $pkg"
|
|
1067 |
DEPS_INSTALLED=no
|
|
1068 |
if [ x$skip_all_dependencies = x ]; then
|
|
1069 |
ask_yes_no "Would you like to skip all missing packages?" skip_all_dependencies no
|
|
1070 |
fi
|
|
1071 |
continue
|
|
1072 |
fi
|
|
1073 |
elif [ x$install_all_dependencies = xno ]; then
|
|
1074 |
msg "Package $pkg is not installed"
|
|
1075 |
ask_yes_no "Install this package?" ans_install_dep "yes"
|
|
1076 |
if [ $ans_install_dep = no ]; then
|
|
1077 |
DEPS_INSTALLED=no
|
1
|
1078 |
continue
|
|
1079 |
fi
|
|
1080 |
fi
|
|
1081 |
while /bin/true; do
|
|
1082 |
msg "Installing package $pkg"
|
|
1083 |
make_admin_file /tmp/pkgadd.admin.$$ pkgadd
|
|
1084 |
if [ -d $tmp_pkg_dir/$pkg ]; then
|
|
1085 |
logrun pfexec /usr/sbin/pkgadd -R $rootdir -n -a /tmp/pkgadd.admin.$$ -d "$tmp_pkg_dir" $pkg
|
|
1086 |
if [ $? != 0 ]; then
|
|
1087 |
msg "WARNING: failed to install required package $pkg"
|
|
1088 |
ask_yes_no "Would you like to retry?" "do_retry" "yes"
|
10
|
1089 |
if [ $do_retry = no ]; then
|
|
1090 |
DEPS_INSTALLED=no
|
|
1091 |
fi
|
1
|
1092 |
else
|
|
1093 |
do_retry=no_need_to
|
|
1094 |
fi
|
|
1095 |
else
|
|
1096 |
msg "Package $pkg was not found in $solaris_pkg_dir"
|
|
1097 |
do_retry=yes
|
|
1098 |
/bin/true
|
|
1099 |
fi
|
|
1100 |
if [ $do_retry = yes ]; then
|
|
1101 |
while /bin/true; do
|
|
1102 |
ask "Enter the path to the Solaris packages" \
|
|
1103 |
solaris_pkg_dir "$solaris_pkg_dir"
|
|
1104 |
test -d "$solaris_pkg_dir/$pkg" && break
|
|
1105 |
msg "$solaris_pkg_dir/$pkg not found"
|
|
1106 |
done
|
|
1107 |
# Copy all packages found in $solaris_pkg_dir to a temporary
|
|
1108 |
# dir so that people installing from CDs don't need to
|
|
1109 |
# swap CDs all the time...
|
10
|
1110 |
for p0 in $CBE_SVR4_DEPENDENCIES; do
|
1
|
1111 |
test -d "$solaris_pkg_dir/$p0" && \
|
10
|
1112 |
/bin/cp -pr "$solaris_pkg_dir/$p0" $tmp_pkg_dir && \
|
1
|
1113 |
/bin/chmod -R u+w $tmp_pkg_dir/$p0
|
|
1114 |
done
|
|
1115 |
elif [ $do_retry = no ]; then
|
|
1116 |
ask_yes_no "Continue installation anyway?" \
|
|
1117 |
do_continue no
|
|
1118 |
if [ $do_continue = no ]; then
|
|
1119 |
/bin/rm -f /tmp/pkgadd.admin.$$
|
|
1120 |
/bin/rm -rf $tmp_pkg_dir
|
|
1121 |
msg "Installation aborted."
|
|
1122 |
exit 1
|
|
1123 |
else
|
10
|
1124 |
DEPS_INSTALLED=no
|
1
|
1125 |
break
|
|
1126 |
fi
|
|
1127 |
break
|
|
1128 |
else
|
|
1129 |
/bin/rm -rf $tmp_pkg_dir/$pkg
|
|
1130 |
/bin/rm -f /tmp/pkgadd.admin.$$
|
|
1131 |
break
|
|
1132 |
fi
|
|
1133 |
done
|
|
1134 |
done
|
|
1135 |
/bin/rm -rf $tmp_pkg_dir
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
# install pkgbuild from tarball to a temp location and then build a
|
|
1139 |
# pkgbuild pkg using itself
|
|
1140 |
install_pkgbuild () {
|
|
1141 |
check_if_installed SFpkgbuild || {
|
|
1142 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
1143 |
return 1
|
|
1144 |
}
|
|
1145 |
if [ $skip_package = yes ]; then
|
|
1146 |
return 0
|
|
1147 |
fi
|
|
1148 |
export PATH=/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/usr/sfw/bin
|
10
|
1149 |
# we're going to build pkgbuild in this directory
|
|
1150 |
tmp_build_dir=`mktemp -d /tmp/cbe-build-XXXX`
|
|
1151 |
# schedule this dir for removal if the installation is aborted
|
|
1152 |
tempdirs="$tempdirs:$tmp_build_dir"
|
|
1153 |
if [ ! -d $tmp_build_dir ]; then
|
|
1154 |
msg_err "Failed to create temporary directory in /tmp"
|
|
1155 |
exit 1
|
|
1156 |
fi
|
|
1157 |
cd $tmp_build_dir || return 1
|
|
1158 |
logrun mkdir -p src || return 1
|
|
1159 |
cd src || return 1
|
|
1160 |
logrun bash -c "bzcat $tardir/pkgbuild-$PKGBUILD_VERSION.tar.bz2 | tar xf -" || return 1
|
1
|
1161 |
cd pkgbuild-$PKGBUILD_VERSION || return 1
|
10
|
1162 |
msg "Building pkgbuild from source..."
|
|
1163 |
# FIXME: delete this when find_compilers is finisheed
|
|
1164 |
export CC=/usr/sfw/bin/gcc
|
|
1165 |
export CFLAGS='-std=c99'
|
|
1166 |
logrun_quiet ./configure --prefix="$tmp_build_dir" || return 1
|
|
1167 |
logrun_quiet make install || return 1
|
|
1168 |
msg "Now rebuilding pkgbuild using itself..."
|
|
1169 |
logrun mkdir -p $tmp_build_dir/packages/SOURCES || return 1
|
|
1170 |
logrun ln -s $tardir/pkgbuild-$PKGBUILD_VERSION.tar.bz2 $tmp_build_dir/packages/SOURCES/ || return 1
|
|
1171 |
logrun_quiet bash -c "$tmp_build_dir/bin/pkgbuild --define \"pkgbuild_prefix $cbe_prefix\" --define \"_topdir $tmp_build_dir/packages\" -ba $tmp_build_dir/src/pkgbuild-$PKGBUILD_VERSION/pkgbuild.spec" || return 1
|
1
|
1172 |
make_admin_file $tempdir/pkgadd.admin.$$ pkgadd
|
10
|
1173 |
logrun pfexec /usr/sbin/pkgadd -R $rootdir -n -a $tempdir/pkgadd.admin.$$ -d "$tmp_build_dir/packages/PKGS" SFpkgbuild || return 1
|
1
|
1174 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
10
|
1175 |
logrun mkdir -p "$rootdir/$pkgbuild_topdir/PKGS" "$rootdir/$pkgbuild_topdir/SPKGS"
|
|
1176 |
logrun cp -pr "$tmp_build_dir/packages/SPKGS/SFpkgbuild-src" "$rootdir/$pkgbuild_topdir/SPKGS"
|
|
1177 |
logrun cp -pr "$tmp_build_dir/packages/PKGS/SFpkgbuild" "$rootdir/$pkgbuild_topdir/PKGS"
|
1
|
1178 |
cd /tmp || return 1
|
10
|
1179 |
logrun /usr/bin/rm -rf $tmp_build_dir || return 1
|
1
|
1180 |
|
|
1181 |
return 0
|
|
1182 |
}
|
|
1183 |
|
|
1184 |
# build and install a package
|
|
1185 |
build_pkg () {
|
|
1186 |
install_pkgs "$rootdir$pkgbuild_topdir/PKGS" "$rootdir" "$3" || return 1
|
|
1187 |
}
|
|
1188 |
|
10
|
1189 |
# older versions of the JDS CBE included packages that were renamed or
|
|
1190 |
# no longer included. These older JDS CBEs only supported SVr4.
|
1
|
1191 |
uninstall_old_cbe () {
|
|
1192 |
pkg_info=
|
|
1193 |
for pkg in $OLD_PKGS; do
|
|
1194 |
pkginfo -R $rootdir -q "$pkg."'*' && pkg_info="$pkg_info
|
|
1195 |
`pkginfo -R $rootdir $pkg.'*'`"
|
|
1196 |
done
|
|
1197 |
if [ ! -z "$pkg_info" ]; then
|
|
1198 |
echo "The following packages belong to an obsolete version of the JDS CBE."
|
|
1199 |
echo "$pkg_info"
|
|
1200 |
echo
|
|
1201 |
ask_yes_no "Would you like to uninstall them?" do_uninst yes
|
|
1202 |
if [ $do_uninst = yes ]; then
|
|
1203 |
log "User chose to uninstall obsolete CBE pkgs"
|
|
1204 |
make_admin_file $tempdir/pkgrm.admin.$$ pkgrm
|
|
1205 |
pkgrm_failed=no
|
|
1206 |
for pkg in $OLD_PKGS; do
|
|
1207 |
if pkginfo -R $rootdir -q "$pkg."'*'; then
|
|
1208 |
logrun pfexec /usr/sbin/pkgrm -R $rootdir -n -a $tempdir/pkgrm.admin.$$ "$pkg."'*' || \
|
|
1209 |
pkgrm_failed=yes
|
|
1210 |
fi
|
|
1211 |
done
|
|
1212 |
rm -f $tempdir/pkgrm.admin.$$
|
|
1213 |
if [ $pkgrm_failed = yes ]; then
|
|
1214 |
msg "Failed to remove one or more packages"
|
|
1215 |
ask_yes_no "Would you like to continue anyway?" do_cont no
|
|
1216 |
if [ $do_cont = no ]; then
|
|
1217 |
return 1
|
|
1218 |
else
|
|
1219 |
log "User chose to continue anyway"
|
|
1220 |
return 0
|
|
1221 |
fi
|
|
1222 |
fi
|
|
1223 |
fi
|
|
1224 |
fi
|
|
1225 |
return 0
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
main () {
|
|
1229 |
init
|
|
1230 |
uninstall_old_cbe || return 1
|
|
1231 |
ask_defaults
|
10
|
1232 |
pkginfo -q -R $rootdir CBEenv && {
|
|
1233 |
msg "Uninstalling CBEenv"
|
|
1234 |
make_admin_file /tmp/pkgrm.admin.$$ pkgrm || return 1
|
|
1235 |
logrun pfexec /usr/sbin/pkgrm -R $rootdir -n -a /tmp/pkgrm.admin.$$ "CBEenv.*"
|
|
1236 |
rm -f /tmp/pkgrm.admin.$$
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
ALL_MODULES=
|
|
1240 |
if [ $install_gnome = yes ]; then
|
|
1241 |
ALL_MODULES="$ALL_MODULES $GNOME_MODULES"
|
|
1242 |
fi
|
|
1243 |
if [ $install_kde = yes ]; then
|
|
1244 |
ALL_MODULES="$ALL_MODULES $KDE_MODULES"
|
|
1245 |
fi
|
|
1246 |
if [ $install_sfe = yes ]; then
|
|
1247 |
ALL_MODULES="$ALL_MODULES $SFE_MODULES"
|
|
1248 |
fi
|
|
1249 |
if [ $install_opt = yes ]; then
|
|
1250 |
ALL_MODULES="$ALL_MODULES $OPT_MODULES"
|
|
1251 |
fi
|
|
1252 |
ALL_MODULES=$(echo $ALL_MODULES | sed -e 's/ /\
|
|
1253 |
/g' | sort -u)
|
|
1254 |
|
1
|
1255 |
if [ $binary_install = no ]; then
|
|
1256 |
install_pkgbuild || return 1
|
10
|
1257 |
else
|
|
1258 |
check_if_installed SFpkgbuild || return 1
|
|
1259 |
if [ $skip_package != yes ]; then
|
13
|
1260 |
install_pkgs "$mydir/pkgs-${the_cpu}" "$rootdir" SFpkgbuild || return 1
|
10
|
1261 |
fi
|
|
1262 |
fi
|
|
1263 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
1264 |
|
|
1265 |
cd $mydir
|
|
1266 |
|
|
1267 |
# identify the CBE packages to be built/installed
|
|
1268 |
ALL_SPECS=
|
|
1269 |
ALL_CBE_PKGS=
|
|
1270 |
for mod in $ALL_MODULES; do
|
11
|
1271 |
pkgs=$($cbe_prefix/bin/spectool get_packages CBE${mod}.spec 2>/dev/null)
|
10
|
1272 |
check_if_installed $pkgs || return 1
|
|
1273 |
# skip_package is set by check_if_installed
|
|
1274 |
if [ $skip_package = yes ]; then
|
|
1275 |
continue
|
1
|
1276 |
fi
|
10
|
1277 |
# On Nevada and OpenSolaris use alternatives if available
|
|
1278 |
if [ $install_alt = yes -a "x$myos_rel" = x5.11 ]; then
|
|
1279 |
eval ALT=\"$(eval echo \$ALT_$mod)\"
|
|
1280 |
if [ "x$ALT" != x ]; then
|
|
1281 |
if [ $ask_alt = yes ]; then
|
|
1282 |
ask_yes_no "Use $ALT ($mod) instead of CBE $mod?" \
|
|
1283 |
use_alt yes
|
|
1284 |
if [ $use_alt = no ]; then
|
|
1285 |
ALL_CBE_PKGS="$ALL_CBE_PKGS $pkgs"
|
|
1286 |
ALL_SPECS="$ALL_SPECS CBE${mod}.spec"
|
|
1287 |
continue
|
|
1288 |
fi
|
|
1289 |
fi
|
|
1290 |
msg "Looking for package $ALT"
|
|
1291 |
check_cbe_dependencies_$PKG_SYSTEM $(eval echo $ALT)
|
|
1292 |
if [ $DEPS_OK = yes ]; then
|
|
1293 |
msg " ... already installed"
|
|
1294 |
continue
|
|
1295 |
elif [ $DEPS_INSTALLED = yes ]; then
|
|
1296 |
msg "Successfully installed $ALT"
|
|
1297 |
continue
|
|
1298 |
else
|
|
1299 |
msg "Using the CBE version of $mod"
|
|
1300 |
ALL_SPECS="$ALL_SPECS CBE${mod}.spec"
|
|
1301 |
ALL_CBE_PKGS="$ALL_CBE_PKGS $pkgs"
|
|
1302 |
fi
|
11
|
1303 |
else
|
|
1304 |
# no alternative exists
|
|
1305 |
ALL_SPECS="$ALL_SPECS CBE${mod}.spec"
|
|
1306 |
ALL_CBE_PKGS="$ALL_CBE_PKGS $pkgs"
|
10
|
1307 |
fi
|
|
1308 |
else
|
|
1309 |
# alternatives should not be used
|
|
1310 |
ALL_SPECS="$ALL_SPECS CBE${mod}.spec"
|
|
1311 |
ALL_CBE_PKGS="$ALL_CBE_PKGS $pkgs"
|
|
1312 |
fi
|
|
1313 |
done
|
|
1314 |
|
|
1315 |
if [ $binary_install = no ]; then
|
|
1316 |
export "PATH=$rootdir$cbe_prefix/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/usr/sfw/bin"
|
|
1317 |
if [ "x$rootdir" != x/ ]; then
|
|
1318 |
export AC_MACRODIR="$rootdir$cbe_prefix/share/autoconf"
|
|
1319 |
sed -e "s%--prepend-include %--prepend-include $rootdir%" "$rootdir$cbe_prefix/share/autoconf/autom4te.cfg" > $tempdir/autom4te.cfg
|
|
1320 |
export AUTOM4TE_CFG="$tempdir/autom4te.cfg"
|
|
1321 |
export autom4te_perllibdir="$rootdir$cbe_prefix/share/autoconf"
|
|
1322 |
export AUTOM4TE="$rootdir$cbe_prefix/bin/autom4te"
|
|
1323 |
fi
|
11
|
1324 |
|
10
|
1325 |
ALL_SPECS=$($cbe_prefix/bin/pkgtool -q build-order $ALL_SPECS)
|
|
1326 |
for spec in $ALL_SPECS; do
|
11
|
1327 |
pkgs=$($cbe_prefix/bin/spectool get_packages $spec 2>/dev/null)
|
12
|
1328 |
if [ $need_tarballs = yes ]; then
|
|
1329 |
msg "Downloading source tarball for $pkgs"
|
|
1330 |
$cbe_prefix/bin/pkgtool download --download-to $tardir $spec || return 1
|
|
1331 |
fi
|
10
|
1332 |
|
|
1333 |
# build the package
|
15
|
1334 |
logrun $cbe_prefix/bin/pkgtool --download --download-to "$tardir" --define "cbe_prefix $cbe_prefix" --define "cbe_version $CBE_VERSION" build-only $spec || return 1
|
10
|
1335 |
for pkg in $pkgs; do
|
|
1336 |
install_pkgs "$rootdir$pkgbuild_topdir/PKGS" "$rootdir" "$pkg" || return 1
|
|
1337 |
done
|
|
1338 |
done
|
1
|
1339 |
else
|
10
|
1340 |
# binary install
|
12
|
1341 |
for pkg in $ALL_CBE_PKGS; do
|
|
1342 |
if [ -d "$mydir/pkgs-${the_cpu}/${myos_rel}/$pkg" ]; then
|
|
1343 |
install_pkgs "$mydir/pkgs-${the_cpu}/${myos_rel}" \
|
|
1344 |
"$rootdir" $pkg || return 1
|
|
1345 |
else
|
|
1346 |
install_pkgs "$mydir/pkgs-${the_cpu}" \
|
|
1347 |
"$rootdir" $pkg || return 1
|
|
1348 |
fi
|
|
1349 |
done
|
1
|
1350 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
1351 |
fi
|
|
1352 |
log "Creating env.sh"
|
|
1353 |
logrun mkdir -p $rootdir$pkgbuild_topdir/SOURCES || return 1
|
|
1354 |
build_info="built on `date +%Y-%m-%d` by ${logname}@`hostname`"
|
10
|
1355 |
logrun_quiet bash -c "sed -e \"s%@CBE_PREFIX@%$cbe_prefix%\" \
|
1
|
1356 |
-e \"s%@JDS_PREFIX@%$JDS_PREFIX%\" \
|
|
1357 |
-e \"s%@CC32@%$cc32dir/$cc_name%\" \
|
|
1358 |
-e \"s%@CXX32@%$cc32dir/$cxx_name%\" \
|
|
1359 |
-e \"s%@CC64@%$cc64dir/$cc_name%\" \
|
|
1360 |
-e \"s%@CXX64@%$cc64dir/$cxx_name%\" \
|
|
1361 |
-e \"s%@CBE_VERSION@%$CBE_VERSION%\" \
|
|
1362 |
-e \"s%@BUILD_INFO@%$build_info%\" \
|
10
|
1363 |
$mydir/ext-sources/env.sh > $rootdir$pkgbuild_topdir/SOURCES/env.sh" || \
|
1
|
1364 |
return 1
|
|
1365 |
log "Creating env.csh"
|
10
|
1366 |
logrun_quiet bash -c "sed -e \"s%@CBE_PREFIX@%$cbe_prefix%\" \
|
1
|
1367 |
-e \"s%@JDS_PREFIX@%$JDS_PREFIX%\" \
|
|
1368 |
-e \"s%@CC32@%$cc32dir/$cc_name%\" \
|
|
1369 |
-e \"s%@CXX32@%$cc32dir/$cxx_name%\" \
|
|
1370 |
-e \"s%@CC64@%$cc64dir/$cc_name%\" \
|
|
1371 |
-e \"s%@CXX64@%$cc64dir/$cxx_name%\" \
|
|
1372 |
-e \"s%@CBE_VERSION@%$CBE_VERSION%\" \
|
|
1373 |
-e \"s%@BUILD_INFO@%$build_info%\" \
|
10
|
1374 |
$mydir/ext-sources/env.csh > $rootdir$pkgbuild_topdir/SOURCES/env.csh" || \
|
1
|
1375 |
return 1
|
21
|
1376 |
log "Copying ld-wrapper, gendiff"
|
10
|
1377 |
logrun bash -c "cp $mydir/ext-sources/ld-wrapper $rootdir$pkgbuild_topdir/SOURCES" || \
|
1
|
1378 |
return 1
|
21
|
1379 |
logrun bash -c "cp $mydir/ext-sources/gendiff $rootdir$pkgbuild_topdir/SOURCES" || \
|
|
1380 |
return 1
|
19
|
1381 |
logrun bash -c "mkdir -p $rootdir$pkgbuild_topdir/SPECS" || \
|
|
1382 |
return 1
|
|
1383 |
logrun bash -c "cp $mydir/include/CBE.inc $rootdir$pkgbuild_topdir/SPECS/" || \
|
|
1384 |
return 1
|
11
|
1385 |
logrun_quiet $cbe_prefix/bin/pkgbuild --define "cbe_prefix $cbe_prefix" --define "cbe_version $CBE_VERSION" --define "build_user $logname" -ba CBEenv.spec || return 1
|
|
1386 |
logrun $cbe_prefix/bin/pkgtool install-pkgs --define "build_user $logname" CBEenv.spec || return 1
|
|
1387 |
logrun cp ${envdir}/* $cbe_prefix/lib/cbe-env/
|
|
1388 |
def_env_name=$(basename $default_env)
|
|
1389 |
cd $cbe_prefix/lib/cbe-env; ln -s $def_env_name default
|
|
1390 |
cd $mydir
|
1
|
1391 |
msg "CBE setup complete"
|
|
1392 |
echo "Run"
|
11
|
1393 |
echo " . $cbe_prefix/bin/env.sh [environment]"
|
1
|
1394 |
echo "or"
|
11
|
1395 |
echo " source $cbe_prefix/bin/env.csh [environment]"
|
1
|
1396 |
echo "depending on your shell, to use this build environment."
|
11
|
1397 |
echo "You can also run $cbe_prefix/bin/env.sh [environment] to start subshell."
|
1
|
1398 |
}
|
|
1399 |
|
|
1400 |
process_cl "${@}"
|
|
1401 |
main || msg "CBE setup FAILED"
|
|
1402 |
echo "Installation log saved in $LOGFILE"
|