VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/scripts/check_module_dependencies.sh@ 44344

Last change on this file since 44344 was 43941, checked in by vboxsync, 12 years ago

Installer/linux: moved kernel module build dependency checking script.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 21.0 KB
Line 
1#!/bin/sh
2#
3# Oracle VM VirtualBox
4# VirtualBox linux installation script
5
6#
7# Copyright (C) 2007-2011 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
18# This script tests whether a Linux system is set up to build kernel modules,
19# and if not attempts to discover and optionally perform the necessary steps to
20# set up the system correctly, based on knowledge of popular Linux
21# distributions. It is written for use with the VirtualBox and the VirtualBox
22# Guest Additions kernel modules but should be useful for any package which
23# needs to build kernel modules on an unknown target system. While patches to
24# extend the range of distributions supported are welcome, please bear in mind
25# that we try to keep distribution-specific parts as small as possible, and to
26# cover as many distributions as possible in single "families". Any
27# distribution which requires specific code to support should be sufficiently
28# widely used to justify the addition.
29
30PATH=$PATH:/bin:/sbin:/usr/sbin
31
32## @todo include routines.sh once it has been cleaned up
33
34## Set all commands used in the script to their normal values. These are the
35# script's interface to the outside world and should be overridden for self
36# testing.
37set_up_helpers()
38{
39 exit=exit
40 get_kernel_version="uname -r"
41 file_exists="test -f"
42 string_in_file="grep -q -s"
43 do_type=type
44 find_rpm_for_file="rpm -q --whatprovides"
45 find_deb_for_file="dpkg -S"
46}
47
48
49## uname -r stand-in for self testing
50test_get_kernel_version()
51{
52 echo "$test_uname_r";
53}
54
55
56## test -f $1 or grep $1 $2 stand-in for self testing
57test_file_exists()
58{
59 test '(' -z "$2" -a "$test_test_f" = "$1" ')' -o \
60 '(' "$test_grep_string" = "$1" -a "$test_grep_file" = "$2" ')';
61}
62
63
64## rpm -q --whatprovides stand-in for self testing
65test_find_rpm_for_file()
66{
67 echo "$test_rpm_q";
68}
69
70
71## exit stand-in for self testing
72test_exit()
73{
74 test_exit_return="$1";
75}
76
77
78## dpkg -S stand-in for self testing
79test_find_deb_for_file()
80{
81 echo "$test_dpkg_s";
82}
83
84
85## type stand-in for self testing
86test_type()
87{
88 test "$1" = "$test_type_binary" && echo "$test_type_binary";
89}
90
91
92## Evaluate a line describing the results of a self test. Outputs a line of
93# text describing each failure.
94eval_test_line()
95{
96 ## @param test_line The test description line to evaluate in the
97 # format:
98 # "<line num>: <variable to set>=<value> ...=><variable to check>=<expected value>..."
99 # All output variables will be nulled first. Unused
100 # "variables to set" should be explicitly set to
101 # null in the list. Spaces in variable names are
102 # not allowed, in values they can be escaped with
103 # backslash, and "=>" can be embedded as "=\>".
104 test_line="$1"
105 ## @param test_function The function to call after setting the variables
106 # from the test line
107 test_function="$2"
108
109 line_num=${test_line%%:*=>*}
110 env_all=${test_line#*:}
111 env_in=${env_all%%=>*}
112 env_out=${env_all#*=>}
113 # Blank out output variables first.
114 eval set $env_out # Trick for dealing with escaped embedded spaces.
115 for j in "$@"; do
116 var_name="${j%%=*}"
117 eval $var_name=
118 done
119 # Set input variables.
120 eval set $env_in
121 for j in "$@"; do
122 var_name=${j%%=*}
123 var_value="${j#*=}"
124 eval $var_name=\"$var_value\" # More tricks
125 done
126 eval $test_function
127 eval set $env_out
128 for j in "$@"; do
129 var_name=${j%%=*}
130 var_value="$(eval echo \$$var_name)"
131 var_expected="${j#*=}"
132 case $var_value in
133 $var_expected) ;;
134 *)
135 echo "$test_function: failure: $var_name=$var_value in line $line_num"
136 ;;
137 esac
138 done
139}
140
141
142## List of tests to be executed in a test run
143self_tests=
144
145
146## Aborts the script and prints a printf-type error message to stderr.
147abort()
148{
149 ## Message to print to stderr before aborting.
150 message="$1"
151
152 echo 1>&2 "$message"
153 echo 1>&2 "Unable to continue."
154 $exit 1
155}
156
157
158## Abort if we are not running as root
159check_root() {
160 case $(id -u) in 0) ;; *)
161 abort "This program must be run with administrator privileges."
162 esac
163}
164
165
166## Get information about the kernel running on the system (version and path
167# information).
168# @param KERN_VER [out] Full kernel version (e.g. 3.0.0-15-generic).
169# @param KERN_VER_BASE [out] Base kernel version (e.g. 3.0.0).
170# @param KERN_VER_SHORT [out] Kernel major and minor version (e.g. 3.0).
171# @param KERN_VER_EXTRA [out] Kernel version "extra" information (e.g.
172# -15-generic).
173# @param KERN_DIR [out] The directory where kernel modules and headers
174# live (e.g. /lib/modules/3.0.0-15-generic)
175get_kernel_information()
176{
177 KERN_VER=$($get_kernel_version 2>/dev/null || abort "'uname' tool not found.")
178 kern_ver_rest=${KERN_VER#*.*.}
179 kern_ver_micro=${kern_ver_rest%%[!0-9]*}
180 KERN_VER_EXTRA=${kern_ver_rest#$kern_ver_micro}
181 KERN_VER_BASE=${KERN_VER%$KERN_VER_EXTRA}
182 KERN_VER_SHORT=${KERN_VER_BASE%.*}
183 KERN_DIR="/lib/modules/$KERN_VER"
184}
185
186
187## Self test for the "get_kernel_information" function. Outputs a line of
188# text describing each failure.
189test_get_kernel_information()
190{
191 get_kernel_version=test_get_kernel_version
192 for i in \
193 "1: test_uname_r=3.0.0-15-generic=>KERN_VER=3.0.0-15-generic KERN_VER_BASE=3.0.0 KERN_VER_SHORT=3.0 KERN_VER_EXTRA=-15-generic KERN_DIR=/lib/modules/3.0.0-15-generic" \
194 "2: test_uname_r=2.4.21-50.EL=>KERN_VER=2.4.21-50.EL KERN_VER_BASE=2.4.21 KERN_VER_SHORT=2.4 KERN_VER_EXTRA=-50.EL KERN_DIR=/lib/modules/2.4.21-50.EL"
195 do eval_test_line "$i" get_kernel_information; done
196}
197
198self_tests="$self_tests test_get_kernel_information"
199
200
201## Test whether a three-digit kernel version number is less than a second one.
202kernel_version_lt()
203{
204 major1=${1%.*.*}
205 major2=${2%.*.*}
206 short1=${1%.*}
207 short2=${2%.*}
208 minor1=${short1#*.}
209 minor2=${short2#*.}
210 micro1=${1#*.*.}
211 micro2=${2#*.*.}
212 test $major1 -lt $major2 -o \
213 '(' $major1 -eq $major2 -a $minor1 -lt $minor2 ')' -o \
214 '(' $major1 -eq $major2 -a $minor1 -eq $minor2 -a $micro1 -lt $micro2 ')'
215}
216
217
218## Self test for the "kernel_version_lt" function. Outputs a line of
219# text describing each failure.
220test_kernel_version_lt()
221{
222 for i in \
223 "1: ver1=2.4.6 ver2=3.4.6 =>lt=true" \
224 "2: ver1=3.4.6 ver2=3.4.6 =>lt=" \
225 "3: ver1=2.4.6 ver2=2.4.7 =>lt=true" \
226 "4: ver1=2.4.60 ver2=2.4.7 =>lt=" \
227 "5: ver1=2.31.7 ver2=2.4.7 =>lt="
228 do eval_test_line "$i" "kernel_version_lt \$ver1 \$ver2 && lt=true"; done
229}
230
231self_tests="$self_tests test_kernel_version_lt"
232
233
234# Some SUSE systems match three packages to the kernel directory. Selecting
235# the first is not quite right, but doesn't matter on those systems.
236FIND_KERNEL_RPM='rpm_q_out=$(echo $($find_rpm_for_file "$KERN_DIR/kernel")); KERN_PACKAGE=${rpm_q_out%%\ *}'
237FIND_KERNEL_DEB='dpkg_s_out=$($find_deb_for_file "$KERN_DIR/kernel"); KERN_PACKAGE=${dpkg_s_out%\: $KERN_DIR/kernel}'
238
239
240## Determine the command patterns needed to install gcc, make and the kernel
241# headers on the current distribution.
242# @note We want to support the distributions we do with the least possible
243# special logic, so please do not add new code if existing code can
244# catch a new distribution (e.g. it is similar to another).
245# @note This function is very long, but contains nearly all the distribution-
246# specific logic in the file.
247# @param KERN_VER_BASE The three-point kernel version.
248# @param GET_KERN_PACKAGE [out] Command to find the kernel package name
249# given the path $KERN_DIR.
250# @param PATTERN_GCC_MAKE [out] A pattern to be resolved to get the
251# command to install gcc and make.
252# @param PATTERN_HEADERS [out] A pattern to be resolved to get the
253# command to install the kernel headers for
254# the currently running kernel.
255# @param PATTERN_HEADERS_META [out] A pattern to be resolved to get the
256# command to install a dependency on the
257# current kernel headers. May be empty.
258# @note These patterns may all depend on $KERN_VER (uname -r output),
259# $KERN_PACKAGE_BASE (distribution kernel package name without any
260# version information at all), $KERN_DEBIAN_SUFFIX (the Debian-style
261# "-generic", "-586" etc kernel name suffix) and $KERN_RPM_SUFFIX
262# (the kernel-version-plus-rpm-version for the current kernel RPM).
263get_system_information()
264{
265 # SUSE and Man*/Mageia must come before Redhat.
266 if $file_exists /etc/SuSE-release; then # SUSE-based, before Red Hat
267 GET_KERN_PACKAGE="$FIND_KERNEL_RPM"
268 PATTERN_GCC_MAKE='zypper\ install\ gcc\ make'
269 if kernel_version_lt "$KERN_VER_BASE" '2.6.30'; then
270 PATTERN_HEADERS='zypper\ install\ kernel-source-$KERN_RPM_SUFFIX\ kernel-syms-$KERN_RPM_SUFFIX'
271 PATTERN_HEADERS_META='zypper\ install\ kernel-source\ kernel-syms'
272 else
273 PATTERN_HEADERS='zypper\ install\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX'
274 PATTERN_HEADERS_META='zypper\ install\ ${KERN_PACKAGE_BASE}devel'
275 fi
276 elif $file_exists /etc/pclinuxos-release; then # PCLinuxOS - before Mandrake
277 GET_KERN_PACKAGE=
278 PATTERN_GCC_MAKE=
279 PATTERN_HEADERS=
280 PATTERN_HEADERS_META=
281 elif $file_exists /etc/mandrake-release; then # Mandrake family
282 GET_KERN_PACKAGE="$FIND_KERNEL_RPM"
283 PATTERN_GCC_MAKE='urpmi\ gcc\ make'
284 if kernel_version_lt "$KERN_VER_BASE" '2.6.0'; then
285 PATTERN_HEADERS='urpmi\ kernel-source-$KERN_VER'
286 PATTERN_HEADERS_META='urpmi\ kernel-source'
287 elif kernel_version_lt "$KERN_VER_BASE" '2.6.8'; then
288 PATTERN_HEADERS='urpmi\ kernel-source-stripped-$KERN_VER'
289 PATTERN_HEADERS_META='urpmi\ kernel-source-stripped'
290 # Mandrake/Mandriva had a funny naming scheme for a few kernel versions
291 elif kernel_version_lt "$KERN_VER_BASE" '2.6.17'; then
292 PATTERN_HEADERS='urpmi\ kernel-source-stripped-2.6-${KERN_VER%-*}'
293 PATTERN_HEADERS_META='urpmi\ kernel-source-stripped-2.6'
294 elif kernel_version_lt "$KERN_VER_BASE" '2.6.22'; then
295 PATTERN_HEADERS='urpmi\ kernel-source-stripped-$KERN_RPM_SUFFIX'
296 PATTERN_HEADERS_META='urpmi\ kernel-source-stripped-latest'
297 else
298 PATTERN_HEADERS='urpmi\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX'
299 PATTERN_HEADERS_META='urpmi\ ${KERN_PACKAGE_BASE}devel-latest'
300 fi
301 elif $file_exists /etc/redhat-release; then # Red Hat family
302 GET_KERN_PACKAGE="$FIND_KERNEL_RPM"
303 if $do_type yum >/dev/null 2>&1; then
304 PACKAGE_INSTALLER="yum install"
305 else
306 PACKAGE_INSTALLER=up2date
307 fi
308 PATTERN_GCC_MAKE='$PACKAGE_INSTALLER\ gcc\ make'
309 if kernel_version_lt "$KERN_VER_BASE" '2.6.9'; then
310 PATTERN_HEADERS='$PACKAGE_INSTALLER\ kernel-source-$KERN_RPM_SUFFIX'
311 PATTERN_HEADERS_META='$PACKAGE_INSTALLER\ kernel-source'
312 else
313 PATTERN_HEADERS='$PACKAGE_INSTALLER\ ${KERN_PACKAGE_BASE}devel-$KERN_RPM_SUFFIX'
314 PATTERN_HEADERS_META='$PACKAGE_INSTALLER\ ${KERN_PACKAGE_BASE}devel'
315 fi
316 # Ubuntu must come before Debian.
317 elif $string_in_file Ubuntu /etc/lsb-release; then # Ubuntu before Debian
318 GET_KERN_PACKAGE="$FIND_KERNEL_DEB"
319 PATTERN_GCC_MAKE='apt-get\ install\ gcc\ make'
320 if kernel_version_lt "$KERN_VER_BASE" '2.6.9'; then
321 PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_VER'
322 PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_DEBIAN_SUFFIX'
323 else
324 PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER'
325 PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers$KERN_DEBIAN_SUFFIX'
326 fi
327 elif $file_exists /etc/debian_version; then # Debian family
328 GET_KERN_PACKAGE="$FIND_KERNEL_DEB"
329 PATTERN_GCC_MAKE='apt-get\ install\ gcc\ make'
330 if kernel_version_lt "$KERN_VER_BASE" '2.4.17'; then
331 PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER'
332 PATTERN_HEADERS_META=
333 elif kernel_version_lt "$KERN_VER_BASE" '3.0.0'; then
334 PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER'
335 PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER_SHORT$KERN_DEBIAN_SUFFIX'
336 else
337 PATTERN_HEADERS='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers-$KERN_VER'
338 PATTERN_HEADERS_META='apt-get\ install\ ${KERN_PACKAGE_BASE%-image*}-headers$KERN_DEBIAN_SUFFIX'
339 fi
340 elif $file_exists /etc/gentoo-release; then # Gentoo
341 GET_KERN_PACKAGE=
342 PATTERN_GCC_MAKE=
343 PATTERN_HEADERS=
344 PATTERN_HEADERS_META=
345 elif $file_exists /etc/lfs-release -a -d /etc/rc.d/init.d; then # LFS
346 GET_KERN_PACKAGE=
347 PATTERN_GCC_MAKE=
348 PATTERN_HEADERS=
349 PATTERN_HEADERS_META=
350 elif $file_exists /etc/pardus-release; then # Pardus
351 GET_KERN_PACKAGE=
352 PATTERN_GCC_MAKE=
353 PATTERN_HEADERS=
354 PATTERN_HEADERS_META=
355 elif $file_exists /etc/slackware-version; then # Slackware
356 GET_KERN_PACKAGE=
357 PATTERN_GCC_MAKE=
358 PATTERN_HEADERS=
359 PATTERN_HEADERS_META=
360 elif $file_exists /etc/arch-release; then # Arch Linux
361 GET_KERN_PACKAGE=
362 PATTERN_GCC_MAKE=
363 PATTERN_HEADERS=
364 PATTERN_HEADERS_META=
365 else abort "Linux distribution base type not recognised."
366 fi
367}
368
369
370## Determine the commands needed to install gcc, make and the kernel headers on
371# the current system.
372# @param INSTALL_GCC_MAKE [out] Command to install gcc and make.
373# @param INSTALL_HEADERS [out] Command to install gcc and make.
374# @param INSTALL_HEADERS_META [out] Command to install a dependency on the
375# current kernel headers. May be empty.
376generate_install_commands()
377{
378 get_kernel_information
379 get_system_information
380 case "$GET_KERN_PACKAGE" in
381 ?*)
382 eval $GET_KERN_PACKAGE ;;
383 "")
384 abort "Unable to determine the software packaging system in use." ;;
385 esac
386 # Needed for many installers
387 KERN_PACKAGE_BASE="${KERN_PACKAGE%%$KERN_VER_BASE*}"
388 KERN_RPM_SUFFIX="${KERN_PACKAGE#"$KERN_PACKAGE_BASE"}"
389 KERN_DEBIAN_SUFFIX="$(expr "$KERN_VER_EXTRA" : '-[0-9]*\(.*\)')"
390 INSTALL_GCC_MAKE=$(eval echo "$PATTERN_GCC_MAKE")
391 INSTALL_HEADERS=$(eval echo "$PATTERN_HEADERS")
392 INSTALL_HEADERS_META=$(eval echo "$PATTERN_HEADERS_META")
393}
394
395
396test_generate_install_commands()
397{
398 get_kernel_version=test_get_kernel_version
399 file_exists=test_file_exists
400 string_in_file=test_file_exists
401 exit=test_exit
402 do_type=test_type
403 find_rpm_for_file=test_find_rpm_for_file
404 find_deb_for_file=test_find_deb_for_file
405 for i in \
406 "1: test_uname_r=2.4.21-50.EL test_test_f=/etc/redhat-release test_type_binary=yum test_rpm_q=kernel-2.4.21-50.EL test_dpkg_s= =>INSTALL_GCC_MAKE=yum\ install\ gcc\ make INSTALL_HEADERS=yum\ install\ kernel-source-2.4.21-50.EL INSTALL_HEADERS_META=yum\ install\ kernel-source" \
407 "2: test_uname_r=2.6.34-12-default test_test_f=/etc/SuSE-release test_rpm_q=kernel-default-2.6.34-12.3 =>INSTALL_GCC_MAKE=zypper\ install\ gcc\ make INSTALL_HEADERS=zypper\ install\ kernel-default-devel-2.6.34-12.3 INSTALL_HEADERS_META=zypper\ install\ kernel-default-devel" \
408 "3: test_uname_r=2.6.8.1-12mdkenterprise test_test_f=/etc/mandrake-release test_rpm_q=kernel-enterprise-2.6.8.1.12mdk-1-1mdk test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-source-stripped-2.6-2.6.8.1 INSTALL_HEADERS_META=urpmi\ kernel-source-stripped-2.6" \
409 "4: test_uname_r=2.6.26-2-686 test_test_f=/etc/debian_version test_rpm_q= test_dpkg_s=linux-image-2.6.26-2-686:\ /lib/modules/2.6.26-2-686/kernel =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ linux-headers-2.6.26-2-686 INSTALL_HEADERS_META=apt-get\ install\ linux-headers-2.6-686" \
410 "5: test_uname_r=3.0.0-15-generic test_string_grep=Ubuntu test_string_file=/etc/lsb-release test_rpm_q= test_dpkg_s=linux-image-3.0.0-15-generic:\ /lib/modules/3.0.0-15-generic/kernel =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ linux-headers-3.0.0-15-generic INSTALL_HEADERS_META=apt-get\ install\ linux-headers-generic" \
411 "6: test_uname_r=2.4.16-686-smp test_test_f=/etc/debian_version test_rpm_q= test_dpkg_s=kernel-image-2.4.16-686-smp =>INSTALL_GCC_MAKE=apt-get\ install\ gcc\ make INSTALL_HEADERS=apt-get\ install\ kernel-headers-2.4.16-686-smp INSTALL_HEADERS_META=" \
412 "7: test_uname_r=2.6.38.8-desktop-9.mga test_test_f=/etc/mandrake-release test_rpm_q=kernel-desktop-2.6.38.8-9.mga-1-1.mga1 test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-desktop-devel-2.6.38.8-9.mga-1-1.mga1 INSTALL_HEADERS_META=urpmi\ kernel-desktop-devel-latest" \
413 "8: test_uname_r=2.6.17-13mdv test_test_f=/etc/mandrake-release test_rpm_q=kernel-2.6.17.13mdv-1-1mdv2007.1 test_dpkg_s= =>INSTALL_GCC_MAKE=urpmi\ gcc\ make INSTALL_HEADERS=urpmi\ kernel-source-stripped-2.6.17.13mdv-1-1mdv2007.1 INSTALL_HEADERS_META=urpmi\ kernel-source-stripped-latest" \
414 "9: test_uname_r=2.6.27.7-9-default test_test_f=/etc/SuSE-release test_rpm_q=kernel-default-base-2.6.27.7-9.1\ kernel-default-2.6.27.7-9.1\ kernel-default-extra-2.6.27.7-9.1 test_dpkg_s= =>INSTALL_GCC_MAKE=zypper\ install\ gcc\ make INSTALL_HEADERS=zypper\ install\ kernel-source-2.6.27.7-9.1\ kernel-syms-2.6.27.7-9.1 INSTALL_HEADERS_META=zypper\ install\ kernel-source\ kernel-syms" \
415 "10: test_exit_return= test_test_f=/etc/Windows-release =>test_exit_return=1"
416 do eval_test_line "$i" "generate_install_commands 2> /dev/null"; done
417}
418
419self_tests="$self_tests test_generate_install_commands"
420
421
422## Check whether gcc, make and the kernel headers are installed on the system.
423# @param MISSING_GCC [out] non-empty if make needs to be installed.
424# @todo Should we check the version of gcc?
425# @param MISSING_MAKE [out] non-empty if make needs to be installed.
426# @param MISSING_HEADERS [out] non-empty if kernel headers need to be
427# installed.
428check_missing_packages()
429{
430 if $do_type gcc >/dev/null 2>&1; then
431 MISSING_GCC=
432 else
433 MISSING_GCC=gcc
434 fi
435 if $do_type make >/dev/null 2>&1; then
436 MISSING_MAKE=
437 else
438 MISSING_MAKE=make
439 fi
440 # The following test looks valid on all distributions I have checked so
441 # far.
442 MISSING_HEADERS=$($file_exists "$KERN_DIR"/build/Makefile || echo headers)
443}
444
445
446case "$1" in livetest) LIVE_TEST=true ;; *) LIVE_TEST= ;; esac
447case "$1" in
448test)
449 for i in $self_tests; do $i; done ;;
450*)
451 set_up_helpers
452 get_kernel_information
453 check_missing_packages
454 case "$MISSING_GCC$MISSING_MAKE$MISSING_HEADERS$LIVE_TEST" in "")
455 exit 0
456 esac
457 generate_install_commands
458 case "$1" in install)
459 check_root
460 $INSTALL_GCC_MAKE || abort "Unable to install tools for building kernel modules."
461 case "$INSTALL_HEADERS_META" in
462 "")
463 $INSTALL_HEADERS || abort "Unable to install files needed to build modules for the current kernel." ;;
464 *)
465 $INSTALL_HEADERS || printf >&2 "Unable to install files needed to build modules for the current kernel.\nYou may need to restart your system to complete the installation."
466 $INSTALL_HEADERS_META || abort "Unable to install files needed to build kernel modules."
467 esac
468 ;;
469 *)
470 echo "This system is not currently set up to build kernel modules (system extensions)."
471 echo "Running the following commands should set the system up correctly:"
472 echo
473 case "$MISSING_GCC$MISSING_MAKE$LIVE_TEST" in ?*)
474 echo " $INSTALL_GCC_MAKE" ;;
475 esac
476 case "$MISSING_HEADERS$LIVE_TEST" in ?*)
477 echo " $INSTALL_HEADERS"
478 echo "(The last command may fail if your system is not fully updated.)"
479 case "$INSTALL_HEADERS_META" in ?*)
480 echo " $INSTALL_HEADERS_META" ;;
481 esac
482 ;;
483 esac
484 exit 1
485 ;;
486 esac
487 ;;
488esac
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