VirtualBox

Changeset 58323 in vbox for trunk/src/VBox/Installer/linux


Ignore:
Timestamp:
Oct 20, 2015 8:37:30 AM (9 years ago)
Author:
vboxsync
Message:

Installer/linux: for non-package installations, VBox.sh can find the installation path from the link target.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/VBox.sh

    r58090 r58323  
    1717
    1818PATH="/usr/bin:/bin:/usr/sbin:/sbin"
    19 CONFIG="/etc/vbox/vbox.cfg"
    2019
    21 test -r "${CONFIG}" &&
    22     . "${CONFIG}"
    23 test -z "${INSTALL_DIR}" &&
    24     if test -f /usr/lib/virtualbox/VirtualBox &&
    25         test -x /usr/lib/virtualbox/VirtualBox; then
    26         INSTALL_DIR=/usr/lib/virtualbox
    27     else
    28         echo "Could not find VirtualBox installation. Please reinstall."
    29         exit 1
    30     fi
     20# The below is GNU-specific.  See slightly further down for a version which
     21# works on Solaris and OS X.
     22TARGET=`readlink -e -- "${0}"` || exit 1
     23MY_DIR="${TARGET%/[!/]*}"
     24
     25# (
     26#     path="${0}"
     27#     while test -n "${path}"; do
     28#         # Make sure we have at least one slash and no leading dash.
     29#         expr "${path}" : / > /dev/null || path="./${path}"
     30#         # Filter out bad characters in the path name.
     31#         expr "${path}" : ".*[*?<>\\]" > /dev/null && exit 1
     32#         # Catch embedded new-lines and non-existing (or path-relative) files.
     33#         # $0 should always be absolute when scripts are invoked through "#!".
     34#         test "`ls -l -d "${path}" 2> /dev/null | wc -l`" -eq 1 || exit 1
     35#         # Change to the folder containing the file to resolve relative links.
     36#         folder=`expr "${path}" : "\(.*/\)[^/][^/]*/*$"` || exit 1
     37#         path=`expr "x\`ls -l -d "${path}"\`" : "[^>]* -> \(.*\)"`
     38#         cd "${folder}"
     39#         # If the last path was not a link then we are in the target folder.
     40#         test -n "${path}" || pwd
     41#     done
     42# )
     43
     44if test -f /usr/lib/virtualbox/VirtualBox &&
     45    test -x /usr/lib/virtualbox/VirtualBox; then
     46    INSTALL_DIR=/usr/lib/virtualbox
     47elif test -f "${MY_DIR}/VirtualBox" && test -x "${MY_DIR}/VirtualBox"; then
     48    INSTALL_DIR="${MY_DIR}"
     49else
     50    echo "Could not find VirtualBox installation. Please reinstall."
     51    exit 1
     52fi
    3153
    3254# Note: This script must not fail if the module was not successfully installed
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