VirtualBox

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


Ignore:
Timestamp:
Sep 29, 2015 1:21:14 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102914
Message:

Installers/linux: clean up the .run installer; remove legacy script; remove duplicate checks.

Location:
trunk/src/VBox/Installer/linux
Files:
4 edited

Legend:

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

    r57876 r57940  
    130130create_log $LOG
    131131
    132 # Now stop the autostart service otherwise it will keep VBoxSVC running
    133 stop_init_script vboxautostart-service
    134 
    135 # Now stop the ballon control service otherwise it will keep VBoxSVC running
    136 stop_init_script vboxballoonctrl-service
    137 
    138 # Now stop the web service otherwise it will keep VBoxSVC running
    139 stop_init_script vboxweb-service
    140 
    141 # Now check if no VBoxSVC daemon is running
    142 check_running
    143 
    144132log "VirtualBox $VERSION r$SVNREV installer, built $BUILD."
    145133log ""
     
    162150fi
    163151
    164 # Check that the system is setup correctly for the installation
    165 have_bzip2="`check_bzip2; echo $?`"     # Do we have bzip2?
    166 have_gmake="`check_gmake; echo $?`"     # Do we have GNU make?
    167 have_ksource="`check_ksource; echo $?`" # Can we find the kernel source?
    168 have_gcc="`check_gcc; echo $?`"         # Is GCC installed?
    169 
    170 if [ $have_bzip2 -eq 1 -o $have_gmake -eq 1 -o $have_ksource -eq 1 \
    171      -o $have_gcc -eq 1 ]; then
    172     info "Problems were found which would prevent VirtualBox from installing."
    173     info "Please correct these problems and try again."
    174     log "Giving up due to the problems mentioned above."
    175     exit 1
    176 else
    177     log "System setup appears correct."
    178     log ""
    179 fi
    180 
    181152# Sensible default actions
    182153ACTION="install"
     
    221192
    222193    # Find previous installation
    223     if [ ! -r $CONFIG_DIR/$CONFIG ]; then
    224         mkdir -p -m 755 $CONFIG_DIR
    225         touch $CONFIG_DIR/$CONFIG
    226     else
     194    if test -r "$CONFIG_DIR/$CONFIG"; then
    227195        . $CONFIG_DIR/$CONFIG
    228196        PREV_INSTALLATION=$INSTALL_DIR
     
    247215    fi
    248216
    249     # Terminate Server and VBoxNetDHCP if running
    250     terminate_proc VBoxSVC
    251     terminate_proc VBoxNetDHCP
    252     terminate_proc VBoxNetNAT
    253 
    254217    # Remove previous installation
    255     if [ -n "$PREV_INSTALLATION" -a -z "$FORCE_UPGRADE" -a ! "$VERSION" = "$INSTALL_VER" ] &&
    256       expr "$INSTALL_VER" "<" "1.6.0" > /dev/null 2>&1
    257     then
    258         info
    259         info "If you are upgrading from VirtualBox 1.5 or older and if some of your virtual"
    260         info "machines have saved states, then the saved state information will be lost"
    261         info "after the upgrade and will have to be discarded.  If you do not want this then"
    262         info "you can cancel the upgrade now."
    263         info
    264         info "Do you wish to continue? [yes or no]"
    265         read reply dummy
    266         if ! expr "$reply" : [yY] && ! expr "$reply" : [yY][eE][sS]
    267         then
    268             info
    269             info "Cancelling upgrade."
    270             log "User requested cancellation of the installation"
    271             exit 1
    272         fi
    273     fi
    274 
    275218    if [ ! "$VERSION" = "$INSTALL_VER" -a ! "$BUILD_MODULE" = "true" -a -n "$DKMS" ]
    276219    then
     
    279222        BUILD_MODULE=true
    280223    fi
     224    test "${BUILD_MODULE}" = true || VBOX_DONT_REMOVE_OLD_MODULES=1
    281225
    282226    if [ -n "$PREV_INSTALLATION" ]; then
     
    286230        log ""
    287231
    288         stop_init_script vboxnet >/dev/null 2>&1  # Do we need this?
    289         delrunlevel vboxnet > /dev/null 2>&1
    290         if [ "$BUILD_MODULE" = "true" ]; then
    291             stop_init_script vboxdrv
    292             if [ -n "$DKMS" ]
    293             then
    294                 $DKMS remove -m vboxhost -v $INSTALL_VER --all > /dev/null 2>&1
    295                 $DKMS remove -m vboxdrv -v $INSTALL_VER --all > /dev/null 2>&1
    296                 $DKMS remove -m vboxnetflt -v $INSTALL_VER --all > /dev/null 2>&1
    297                 $DKMS remove -m vboxnetadp -v $INSTALL_VER --all > /dev/null 2>&1
    298             fi
    299             # OSE doesn't always have the initscript
    300             rmmod vboxpci > /dev/null 2>&1
    301             rmmod vboxnetadp > /dev/null 2>&1
    302             rmmod vboxnetflt > /dev/null 2>&1
    303             rmmod vboxdrv > /dev/null 2>&1
    304 
    305             module_loaded && {
    306                 info "Warning: could not stop VirtualBox kernel module."
    307                 info "Please restart your system to apply changes."
    308                 log "Unable to remove the old VirtualBox kernel module."
    309                 log "  An old version of VirtualBox may be running."
    310             }
    311         else
    312             VBOX_DONT_REMOVE_OLD_MODULES=1
    313         fi
    314 
    315232        VBOX_NO_UNINSTALL_MESSAGE=1
     233        # This also checks $BUILD_MODULE and $VBOX_DONT_REMOVE_OLD_MODULES
    316234        . ./uninstall.sh
    317 
    318     fi
     235    fi
     236
     237    mkdir -p -m 755 $CONFIG_DIR
     238    touch $CONFIG_DIR/$CONFIG
    319239
    320240    info "Installing VirtualBox to $INSTALLATION_DIR"
     
    324244    # Verify the archive
    325245    mkdir -p -m 755 $INSTALLATION_DIR
    326     bzip2 -d -c VirtualBox.tar.bz2 | tar -tf - > $CONFIG_DIR/$CONFIG_FILES
    327     RETVAL=$?
    328     if [ $RETVAL != 0 ]; then
     246    bzip2 -d -c VirtualBox.tar.bz2 > VirtualBox.tar
     247    if ! tar -tf VirtualBox.tar > $CONFIG_DIR/$CONFIG_FILES; then
    329248        rmdir $INSTALLATION_DIR 2> /dev/null
    330249        rm -f $CONFIG_DIR/$CONFIG 2> /dev/null
    331250        rm -f $CONFIG_DIR/$CONFIG_FILES 2> /dev/null
    332         log 'Error running "bzip2 -d -c VirtualBox.tar.bz2 | tar -tf - > '"$CONFIG_DIR/$CONFIG_FILES"'".'
     251        log 'Error running "bzip2 -d -c VirtualBox.tar.bz2" or "tar -tf VirtualBox.tar".'
    333252        abort "Error installing VirtualBox.  Installation aborted"
    334253    fi
    335254
    336255    # Create installation directory and install
    337     bzip2 -d -c VirtualBox.tar.bz2 | tar -xf - -C $INSTALLATION_DIR
    338     RETVAL=$?
    339     if [ $RETVAL != 0 ]; then
     256    if ! tar -xf VirtualBox.tar -C $INSTALLATION_DIR; then
    340257        cwd=`pwd`
    341258        cd $INSTALLATION_DIR
     
    344261        rmdir $INSTALLATION_DIR 2> /dev/null
    345262        rm -f $CONFIG_DIR/$CONFIG 2> /dev/null
    346         log 'Error running "bzip2 -d -c VirtualBox.tar.bz2 | tar -xf - -C '"$INSTALLATION_DIR"'".'
     263        log 'Error running "tar -xf VirtualBox.tar -C '"$INSTALLATION_DIR"'".'
    347264        abort "Error installing VirtualBox.  Installation aborted"
    348265    fi
     
    461378        cur=`pwd`
    462379        log ""
    463         ./vboxdrv.sh setup
    464380        # Start VirtualBox kernel module
    465         if [ $RETVAL -eq 0 ] && ! ./vboxdrv.sh start; then
     381        if ! ./vboxdrv.sh setup || ! ./vboxdrv.sh start; then
    466382            info "Failed to load the kernel module."
    467383            MODULE_FAILED="true"
  • trunk/src/VBox/Installer/linux/routines.sh

    r57876 r57940  
    107107        fi
    108108    fi
    109 }
    110 
    111 ## Do we have bzip2?
    112 check_bzip2()
    113 {
    114     if ! ls /bin/bzip2 /usr/bin/bzip2 /usr/local/bin/bzip2 2> /dev/null | grep bzip2 > /dev/null; then
    115         echo 1>&2 "Please install the bzip2 utility."
    116         log "Please install bzip2."
    117         return 1
    118     fi
    119     return 0
    120 }
    121 
    122 ## Do we have GNU make?
    123 check_gmake()
    124 {
    125 make --version 2>&1 | grep GNU > /dev/null
    126     if [ ! $? = 0 ]; then
    127         echo 1>&2 "Please install GNU make."
    128         log "Please install GNU make."
    129         return 1
    130     fi
    131     return 0
    132 }
    133 
    134 ## Can we find the kernel source?
    135 check_ksource()
    136 {
    137     ro_KBUILD_DIR=/lib/modules/`uname -r`/build
    138     if [ ! -d $ro_KBUILD_DIR/include ]; then
    139         ro_KBUILD_DIR=/usr/src/linux
    140         if [ ! -d $ro_KBUILD_DIR/include ]; then
    141             echo 1>&2 "Please install the build and header files for your current Linux kernel."
    142             echo 1>&2 "The current kernel version is `uname -r`"
    143             ro_KBUILD_DIR=""
    144             log "Could not find the Linux kernel header files - the directories"
    145             log "  /lib/modules/`uname -r`/build/include and /usr/src/linux/include"
    146             log "  do not exist."
    147             return 1
    148         fi
    149     fi
    150     return 0
    151 }
    152 
    153 ## Is GCC installed?
    154 check_gcc()
    155 {
    156     ro_gcc_version=`gcc --version 2> /dev/null | head -n 1`
    157     if [ "$ro_gcc_version" = "" ]; then
    158         echo 1>&2 "Please install the GNU compiler."
    159         log "Please install the GNU compiler."
    160         return 1
    161     fi # GCC installed
    162     return 0
    163 }
    164 
    165 ## Is bash installed?  You never know...
    166 check_bash()
    167 {
    168     if [ ! -x /bin/bash ]; then
    169         echo 1>&2 "Please install GNU bash."
    170         log "Please install GNU bash."
    171         return 1
    172     fi
    173     return 0
    174 }
    175 
    176 ## Is perl installed?
    177 check_perl()
    178 {
    179     if [ ! `perl -e 'print "test"' 2> /dev/null` = "test" ]; then
    180         echo 1>&2 "Please install perl."
    181         echo "Please install perl."
    182         return 1
    183     fi
    184     return 0
    185109}
    186110
  • trunk/src/VBox/Installer/linux/run-inst.sh

    r56887 r57940  
    177177
    178178info "$PACKAGE_NAME installer"
    179 
    180 check_bzip2
    181179
    182180# Check architecture
  • trunk/src/VBox/Installer/linux/uninstall.sh

    r57711 r57940  
    5050# Do pre-removal common to all installer types, currently service script
    5151# clean-up.
    52 ./prerm-common.sh
     52test "${BUILD_MODULE}" = true && DO_DKMS="--dkms ${INSTALL_VER}"
     53`dirname $0`/prerm-common.sh ${DO_DKMS} || exit 1  # Arguments intentionally not quoted.
    5354
    5455# Remove kernel module installed
Note: See TracChangeset for help on using the changeset viewer.

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