VirtualBox

Ignore:
Timestamp:
Apr 4, 2017 7:57:09 PM (8 years ago)
Author:
vboxsync
Message:

bugref:7498: create guest additions in rpm format for Oracle Linux
Re-arrange the vboxadd.sh/rcvboxadd script to make it easier for the kernel module rpm package to run the kernel parts (essentially, vboxadd.sh udev) and the non-kernel part to do the rest, by setting INSTALL_NO_MODULE_BUILDS=1 in /var/lib/VBoxGuestAdditions/config. Remove the separate udevsetup and cleanup commands again and make them part of the normal INSTALL_NO_MODULE_BUILDS=1 setup and cleanup. In addition, fix start and stop not to try to load and unload the modules with INSTALL_NO_MODULE_BUILDS=1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r66413 r66423  
    3333
    3434# Testing:
    35 # * Should fail if the configuration file is missing or missing INSTALL_[DIR|VER].
    36 # * vboxadd user and vboxsf groups should be created if they do not exist.
    37 # * udev rule should be successfully created.
     35# * Should fail if the configuration file is missing or missing INSTALL_DIR or
     36#   INSTALL_VER entries.
     37# * vboxadd user and vboxsf groups should be created if they do not exist - test
     38#   by removing them before installing.
    3839# * Shared folders can be mounted and auto-mounts accessible to vboxsf group,
    3940#   including on recent Fedoras with SELinux.
    40 # * Setting INSTALL_NO_MODULE_BUILDS inhibits modules, users, udev in setup and
    41 #   cleanup but not the shared folder group creation.
    42 # * rcvboxadd udev[cleanup] sets up udev and creates the user but skips modules,
    43 #   shared folders and group creation.
     41# * Setting INSTALL_NO_MODULE_BUILDS inhibits modules and module automatic
     42#   rebuild script creation; otherwise modules, user, group, rebuild script,
     43#   udev rule and shared folder mount helper should be created/set up.
     44# * Setting INSTALL_NO_MODULE_BUILDS inhibits module load and unload on start
     45#   and stop.
    4446# * Uninstalling the Additions and re-installing them does not trigger warnings.
    4547
     
    204206    # If we got this far assume that the slow set-up has been done.
    205207    QUICKSETUP=yes
    206     uname -r | grep -q -E '^2\.6|^3|^4' 2>/dev/null &&
    207         ps -A -o comm | grep -q '/*udevd$' 2>/dev/null ||
    208         no_udev=1
    209     running_vboxguest || {
    210         rm -f $dev || {
    211             fail "Cannot remove $dev"
     208    if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
     209        uname -r | grep -q -E '^2\.6|^3|^4' 2>/dev/null &&
     210            ps -A -o comm | grep -q '/*udevd$' 2>/dev/null ||
     211            no_udev=1
     212        running_vboxguest || {
     213            rm -f $dev || {
     214                fail "Cannot remove $dev"
     215            }
     216
     217            rm -f $userdev || {
     218                fail "Cannot remove $userdev"
     219            }
     220
     221            $MODPROBE vboxguest >/dev/null 2>&1 || {
     222                setup
     223                $MODPROBE vboxguest >/dev/null 2>&1 || {
     224                    "${INSTALL_DIR}/init/vboxadd-x11" cleanup 2>> "${LOG}"
     225                    fail "modprobe vboxguest failed"
     226                }
     227            }
     228            case "$no_udev" in 1)
     229                sleep .5;;
     230            esac
    212231        }
    213 
    214         rm -f $userdev || {
    215             fail "Cannot remove $userdev"
    216         }
    217 
    218         $MODPROBE vboxguest >/dev/null 2>&1 || {
    219             setup
    220             $MODPROBE vboxguest >/dev/null 2>&1 || {
    221                 "${INSTALL_DIR}/init/vboxadd-x11" cleanup 2>> "${LOG}"
    222                 fail "modprobe vboxguest failed"
     232        case "$no_udev" in 1)
     233            do_vboxguest_non_udev;;
     234        esac
     235
     236        running_vboxsf || {
     237            $MODPROBE vboxsf > /dev/null 2>&1 || {
     238                if dmesg | grep "VbglR0SfConnect failed" > /dev/null 2>&1; then
     239                    info "Unable to start shared folders support.  Make sure that your VirtualBox build supports this feature."
     240                else
     241                    info "modprobe vboxsf failed"
     242                fi
    223243            }
    224244        }
    225         case "$no_udev" in 1)
    226             sleep .5;;
    227         esac
    228     }
    229     case "$no_udev" in 1)
    230         do_vboxguest_non_udev;;
    231     esac
    232 
    233     running_vboxsf || {
    234         $MODPROBE vboxsf > /dev/null 2>&1 || {
    235             if dmesg | grep "VbglR0SfConnect failed" > /dev/null 2>&1; then
    236                 info "Unable to start shared folders support.  Make sure that your VirtualBox build supports this feature."
    237             else
    238                 info "modprobe vboxsf failed"
    239             fi
    240         }
    241     }
     245    fi  # INSTALL_NO_MODULE_BUILDS
    242246
    243247    # Put the X.Org driver in place.  This is harmless if it is not needed.
     
    283287        fail "Cannot unmount vboxsf folders"
    284288    fi
     289    test -n "${INSTALL_NO_MODULE_BUILDS}" && return 0
    285290    modprobe -q -r -a vboxvideo vboxsf vboxguest
    286291    if egrep -q 'vboxguest|vboxsf|vboxvideo' /proc/modules; then
     
    452457    chcon -t bin_t "$BUILDINTMP" > /dev/null 2>&1
    453458
    454     setup_modules
     459    test -z "${INSTALL_NO_MODULE_BUILDS}" && setup_modules
    455460    create_vbox_user
    456461    create_udev_rule
    457     create_module_rebuild_script
     462    test -z "${INSTALL_NO_MODULE_BUILDS}" && create_module_rebuild_script
    458463    test -n "${QUICKSETUP}" && return 0
    459464    shared_folder_setup
     
    467472cleanup()
    468473{
    469     # Delete old versions of VBox modules.
    470     cleanup_modules
    471     depmod
    472 
    473     # Remove old module sources
    474     for i in $OLDMODULES; do
    475       rm -rf /usr/src/$i-*
    476     done
     474    if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
     475        # Delete old versions of VBox modules.
     476        cleanup_modules
     477        depmod
     478
     479        # Remove old module sources
     480        for i in $OLDMODULES; do
     481          rm -rf /usr/src/$i-*
     482        done
     483    fi
    477484
    478485    # Clean-up X11-related bits
     
    481488    # Remove other files
    482489    rm /sbin/mount.vboxsf 2>/dev/null
    483     rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
    484     rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null
     490    if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
     491        rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
     492        rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null
     493    fi
    485494    rm /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null
    486495}
     
    509518    ;;
    510519setup)
    511     if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
    512         setup
    513     else
    514         shared_folder_setup
    515     fi
     520    setup
    516521    start
    517522    ;;
     
    521526    ;;
    522527cleanup)
    523     if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
    524         cleanup
    525     else
    526         rm /sbin/mount.vboxsf 2>/dev/null
    527     fi
    528     ;;
    529 udevsetup)
    530     create_vbox_user
    531     create_udev_rule
    532     ;;
    533 udevcleanup)
    534     rm /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null
     528    cleanup
    535529    ;;
    536530status)
     
    538532    ;;
    539533*)
    540     echo "Usage: $0 {start|stop|restart|status|setup|quicksetup|cleanup|udevsetup|udevcleanup} [quiet]"
     534    echo "Usage: $0 {start|stop|restart|status|setup|quicksetup|cleanup} [quiet]"
    541535    exit 1
    542536esac
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette