Changeset 63870 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Sep 16, 2016 5:42:56 PM (8 years ago)
- Location:
- trunk/src/VBox/Additions/linux/installer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh
r60933 r63870 33 33 CONFIG_DIR="/var/lib/VBoxGuestAdditions" 34 34 CONFIG="config" 35 SCRIPTNAME=vboxadd-x11.sh36 35 MODPROBE=/sbin/modprobe 37 36 … … 80 79 fi 81 80 82 begin()83 {84 test -n "${2}" && echo "${SCRIPTNAME}: ${1}."85 logger -t "${SCRIPTNAME}" "${1}."86 }87 88 succ_msg()89 {90 logger -t "${SCRIPTNAME}" "${1}."91 }92 93 fail_msg()94 {95 echo "${SCRIPTNAME}: ${1}." >&296 logger -t "${SCRIPTNAME}" "${1}."97 }98 99 81 dev=/dev/vboxguest 100 82 userdev=/dev/vboxuser … … 104 86 fail() 105 87 { 106 echo "${SCRIPTNAME}: failed: ${1}." >&2 107 logger "${SCRIPTNAME}: ${1}." 88 echo "${1}" >&2 108 89 exit 1 109 90 } … … 120 101 service_name=$3 121 102 alt_command=$4 122 test -r "$app_src" || 123 { echo >> $LOG "$self: no script given"; return 1; } 124 test -r "$desktop_src" || 125 { echo >> $LOG "$self: no desktop file given"; return 1; } 126 test -n "$service_name" || 127 { echo >> $LOG "$self: no service given"; return 1; } 128 test -n "$alt_command" || 129 { echo >> $LOG "$self: no service given"; return 1; } 103 test -r "$app_src" || fail "$self: no script given" 104 test -r "$desktop_src" || fail "$self: no desktop file given" 105 test -n "$service_name" || fail "$self: no service given" 106 test -n "$alt_command" || fail "$self: no service given" 130 107 app_dest=`basename $app_src sh` 131 108 app_dest_sh=`basename $app_src sh`.sh … … 165 142 return 0 166 143 fi 167 cat > > $LOG<< EOF144 cat >&2 << EOF 168 145 Could not set up the $service_name desktop service. 169 146 To start it at log-in for a given user, add the command $alt_command … … 193 170 setup() 194 171 { 195 echo "VirtualBox Guest Additions installation, Window System and desktop setup" > $LOG196 begin "Installing the Window System drivers"197 172 lib_dir="$LIB/VBoxGuestAdditions" 198 173 share_dir="/usr/share/VBoxGuestAdditions" 199 174 test -x "$lib_dir" -a -x "$share_dir" || 200 fail "Invalid Guest Additions configuration found "175 fail "Invalid Guest Additions configuration found." 201 176 # By default we want to configure X 202 177 dox11config="true" … … 244 219 test -z "$x_version" -o -z "$modules_dir" && 245 220 { 246 echo 247 echo "Could not find the X.Org or XFree86 Window System, skipping." 221 echo "Could not find the X.Org or XFree86 Window System, skipping." >&2 248 222 exit 0 249 223 } 250 224 251 echo252 225 # openSUSE 10.3 shipped X.Org 7.2 with X.Org Server 1.3, but didn't 253 226 # advertise the fact. … … 259 232 case $x_version in 260 233 1.*.99.* ) 261 echo "Warning: unsupported pre-release version of X.Org Server installed. Not" 262 echo "installing the X.Org drivers." 234 echo "Warning: unsupported pre-release version of X.Org Server installed. Not installing the X.Org drivers." >&2 263 235 dox11config="" 264 236 ;; … … 363 335 test -f "${lib_dir}/${vboxvideo_src}" || 364 336 { 365 echo "Warning: unknown version of the X Window System installed. Not installing" 366 echo "X Window System drivers." 337 echo "Warning: unknown version of the X Window System installed. Not installing X Window System drivers." >&2 367 338 dox11config="" 368 339 vboxvideo_src="" … … 386 357 esac 387 358 test -n "${dox11config}" && 388 begin "Installing $xserver_version modules"359 echo "Installing $xserver_version modules" >&2 389 360 case "$vboxvideo_src" in 390 361 ?*) … … 401 372 rm "$modules_dir/input/vboxmouse_drv$driver_ext" 2>/dev/null 402 373 esac 403 succ_msg "$xserver_version modules installed"404 374 405 375 if test -n "$dox11config"; then 406 begin "Setting up the Window System to use the Guest Additions"407 376 # Certain Ubuntu/Debian versions use a special PCI-id file to identify 408 377 # video drivers. Some versions have the directory and don't use it. … … 442 411 fi 443 412 fi 444 succ_msg "Window System set up to use the Guest Additions"445 413 test -n "$generated" && 446 cat << EOF414 cat >&2 << EOF 447 415 The following X.Org/XFree86 configuration files were originally generated by 448 416 the VirtualBox Guest Additions and were not modified: … … 451 419 452 420 EOF 453 cat << EOF421 tty >/dev/null && cat << EOF 454 422 You may need to restart the the Window System (or just restart the guest system) 455 423 to enable the Guest Additions. … … 458 426 fi 459 427 460 begin "Installing graphics libraries and desktop services components"461 428 case "$redhat_release" in 462 429 # Install selinux policy for Fedora 7 and 8 to allow the X server to … … 489 456 fail "See the log file $LOG for more information." 490 457 ln -s "$lib_dir/98vboxadd-xclient" /usr/bin/VBoxClient-all 2>/dev/null 491 succ_msg "Window system drivers installed"492 458 } 493 459 … … 531 497 done 532 498 fi 533 test -n "$newer" && cat << EOF499 test -n "$newer" && cat >&2 << EOF 534 500 535 501 The following X.Org/XFree86 configuration files were not restored, as they may … … 541 507 542 508 EOF 543 test -n "$failed" && cat << EOF509 test -n "$failed" && cat >&2 << EOF 544 510 545 511 The following X.Org/XFree86 configuration files were restored, but still -
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r63738 r63870 34 34 PATH=$PATH:/bin:/sbin:/usr/sbin 35 35 PACKAGE=VBoxGuestAdditions 36 LOG="/var/log/vboxadd- install.log"36 LOG="/var/log/vboxadd-setup.log" 37 37 MODPROBE=/sbin/modprobe 38 38 OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo" 39 S CRIPTNAME=vboxadd.sh39 SERVICE="VirtualBox Guest Additions" 40 40 QUICKSETUP= 41 ## systemd logs information about service status, otherwise do that ourselves. 42 QUIET= 43 44 # Rotate log files 45 mv "${LOG}.3" "${LOG}.4" 2>/dev/null 46 mv "${LOG}.2" "${LOG}.3" 2>/dev/null 47 mv "${LOG}.1" "${LOG}.2" 2>/dev/null 48 mv "${LOG}" "${LOG}.1" 2>/dev/null 41 49 42 50 if $MODPROBE -c 2>/dev/null | grep -q '^allow_unsupported_modules *0'; then … … 72 80 begin() 73 81 { 74 test -n "${2}" && echo "${SCRIPTNAME}: ${1}." 75 logger -t "${SCRIPTNAME}" "${1}." 76 } 77 78 succ_msg() 79 { 80 logger -t "${SCRIPTNAME}" "${1}." 81 } 82 83 show_error() 84 { 85 echo "${SCRIPTNAME}: failed: ${1}." >&2 86 logger -t "${SCRIPTNAME}" "${1}." 82 test -z "${QUIET}" && echo "${SERVICE}: ${1}" 83 } 84 85 info() 86 { 87 if test -z "${QUIET}"; then 88 echo "${SERVICE}: $1" 89 else 90 echo "$1" 91 fi 87 92 } 88 93 89 94 fail() 90 95 { 91 show_error "$1" 96 log "${1}" 97 echo "$1" >&2 98 echo "The log file $LOG may contain further information." >&2 92 99 exit 1 100 } 101 102 log() 103 { 104 echo "${1}" >> "${LOG}" 93 105 } 94 106 … … 169 181 start() 170 182 { 171 begin "Starting the VirtualBox Guest Additions" console;183 begin "Starting." 172 184 # If we got this far assume that the slow set-up has been done. 173 185 QUICKSETUP=yes … … 194 206 setup 195 207 $MODPROBE vboxguest >/dev/null 2>&1 || { 196 /sbin/rcvboxadd-x11 cleanup208 "$lib_path/$PACKAGE/vboxadd-x11" cleanup 2>> "${LOG}" 197 209 fail "modprobe vboxguest failed" 198 210 } … … 209 221 $MODPROBE vboxsf > /dev/null 2>&1 || { 210 222 if dmesg | grep "VbglR0SfConnect failed" > /dev/null 2>&1; then 211 show_error "Unable to start shared folders support. Make sure that your VirtualBox build" 212 show_error "supports this feature." 223 info "Unable to start shared folders support. Make sure that your VirtualBox build supports this feature." 213 224 else 214 show_error"modprobe vboxsf failed"225 info "modprobe vboxsf failed" 215 226 fi 216 227 } … … 218 229 219 230 # Put the X.Org driver in place. This is harmless if it is not needed. 220 /sbin/rcvboxadd-x11 setup231 "$lib_path/$PACKAGE/vboxadd-x11" setup 2>> "${LOG}" 221 232 # Install the guest OpenGL drivers. For now we don't support 222 233 # multi-architecture installations … … 246 257 # mount -a -t vboxsf 247 258 248 succ_msg249 259 return 0 250 260 } … … 252 262 stop() 253 263 { 254 begin "Stopping VirtualBox Additions" console;264 begin "Stopping." 255 265 if test -r /etc/ld.so.conf.d/00vboxvideo.conf; then 256 266 rm /etc/ld.so.conf.d/00vboxvideo.conf … … 262 272 modprobe -q -r -a vboxvideo vboxsf vboxguest 263 273 egrep -q 'vboxguest|vboxsf|vboxvideo' /proc/modules && 264 echo "You may need to restart your guest system to finish removing the guest drivers."274 info "You may need to restart your guest system to finish removing the guest drivers." 265 275 rm -f $userdev || fail "Cannot unlink $userdev" 266 276 rm -f $dev || fail "Cannot unlink $dev" 267 succ_msg268 277 return 0 269 278 } … … 279 288 cleanup_modules() 280 289 { 281 begin "Removing existing VirtualBox kernel modules"290 log "Removing existing VirtualBox kernel modules." 282 291 for i in ${OLDMODULES}; do 283 292 # We no longer support DKMS, remove any leftovers. … … 291 300 done 292 301 rm -f /etc/depmod.d/vboxvideo-upstream.conf 293 succ_msg294 302 } 295 303 … … 301 309 # This does not work for 2.4 series kernels. How sad. 302 310 test -n "${QUICKSETUP}" && test -f "${MODULE_DIR}/vboxguest.ko" && return 0 303 begin "Building the VirtualBox Guest Additions kernel modules"304 305 begin "Building the main Guest Additions module"311 info "Building the VirtualBox Guest Additions kernel modules." 312 313 log "Building the main Guest Additions module." 306 314 if ! $BUILDINTMP \ 307 315 --save-module-symvers /tmp/vboxguest-Module.symvers \ 308 316 --module-source $MODULE_SRC/vboxguest \ 309 317 --no-print-directory install >> $LOG 2>&1; then 310 show_error"Look at $LOG to find out what went wrong"318 info "Look at $LOG to find out what went wrong" 311 319 return 1 312 320 fi 313 succ_msg 314 begin "Building the shared folder support module" 321 log "Building the shared folder support module" 315 322 if ! $BUILDINTMP \ 316 323 --use-module-symvers /tmp/vboxguest-Module.symvers \ 317 324 --module-source $MODULE_SRC/vboxsf \ 318 325 --no-print-directory install >> $LOG 2>&1; then 319 show_error"Look at $LOG to find out what went wrong"326 info "Look at $LOG to find out what went wrong" 320 327 return 1 321 328 fi 322 succ_msg 323 begin "Building the graphics driver module" 329 log "Building the graphics driver module" 324 330 if ! $BUILDINTMP \ 325 331 --use-module-symvers /tmp/vboxguest-Module.symvers \ 326 332 --module-source $MODULE_SRC/vboxvideo \ 327 333 --no-print-directory install >> $LOG 2>&1; then 328 show_error "Look at $LOG to find out what went wrong" 329 fi 330 succ_msg 334 info "Look at $LOG to find out what went wrong" 335 fi 331 336 echo "override vboxvideo * misc" > /etc/depmod.d/vboxvideo-upstream.conf 332 337 depmod … … 338 343 extra_setup() 339 344 { 340 begin "Doing non-kernel setup of the Guest Additions" 341 echo "Creating user for the Guest Additions." >> $LOG 345 log "Creating user for the Guest Additions." 342 346 # This is the LSB version of useradd and should work on recent 343 347 # distributions … … 353 357 # Create udev description file 354 358 if [ -d /etc/udev/rules.d ]; then 355 echo "Creating udev rule for the Guest Additions kernel module." >> $LOG359 log "Creating udev rule for the Guest Additions kernel module." 356 360 udev_call="" 357 361 udev_app=`which udevadm 2> /dev/null` … … 381 385 # And an rc file to re-build the kernel modules and re-set-up the X server. 382 386 ln -sf "$lib_path/$PACKAGE/vboxadd" /sbin/rcvboxadd 383 ln -sf "$lib_path/$PACKAGE/vboxadd-x11" /sbin/rcvboxadd-x11384 387 # And a post-installation script for rebuilding modules when a new kernel 385 388 # is installed. … … 408 411 chcon -t mount_exec_t "$lib_path/$PACKAGE/mount.vboxsf" 409 412 fi 410 succ_msg411 413 } 412 414 … … 414 416 setup() 415 417 { 416 begin "Building Guest Additions kernel modules" console418 rm -f $LOG 417 419 if test -r $config; then 418 420 . $config … … 425 427 export USERNAME 426 428 427 rm -f $LOG428 429 MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER" 429 430 BUILDINTMP="$MODULE_SRC/build_in_tmp" … … 434 435 else 435 436 mod_succ=1 436 show_error"Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed."437 info "Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed." 437 438 fi 438 439 test -n "${QUICKSETUP}" && return "${mod_succ}" … … 440 441 if [ "$mod_succ" -eq "0" ]; then 441 442 if running_vboxguest || running_vboxadd; then 442 begin "You should restart your guest to make sure the new modules are actually used" console443 info "You should restart your guest to make sure the new modules are actually used" 443 444 fi 444 445 fi … … 467 468 468 469 # Clean-up X11-related bits 469 /sbin/rcvboxadd-x11 cleanup470 "$lib_path/$PACKAGE/vboxadd-x11" cleanup 2>> "${LOG}" 470 471 471 472 # Remove other files 472 473 rm /sbin/mount.vboxsf 2>/dev/null 473 474 rm /sbin/rcvboxadd 2>/dev/null 474 rm /sbin/rcvboxadd-x11 2>/dev/null475 475 rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd 476 476 rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null … … 487 487 } 488 488 489 case "$2" in quiet) 490 QUIET=yes;; 491 esac 489 492 case "$1" in 490 493 start) … … 511 514 ;; 512 515 *) 513 echo "Usage: $0 {start|stop|restart|status|setup|quicksetup|cleanup} "516 echo "Usage: $0 {start|stop|restart|status|setup|quicksetup|cleanup} [quiet]" 514 517 exit 1 515 518 esac
Note:
See TracChangeset
for help on using the changeset viewer.