VirtualBox

Changeset 92628 in vbox


Ignore:
Timestamp:
Nov 29, 2021 3:56:02 PM (3 years ago)
Author:
vboxsync
Message:

Installer/linux: Coding style improvement to uninstall.sh.

File:
1 edited

Legend:

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

    r91857 r92628  
    3939
    4040# Find previous installation
    41 if [ -r $CONFIG_DIR/$CONFIG ]; then
    42     . $CONFIG_DIR/$CONFIG
    43     PREV_INSTALLATION=$INSTALL_DIR
     41if [ -r "$CONFIG_DIR/$CONFIG" ]; then
     42    . "$CONFIG_DIR/$CONFIG"
     43    PREV_INSTALLATION="$INSTALL_DIR"
    4444fi
    4545
     
    5656# Remove kernel module installed
    5757if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
    58     rm -f /usr/src/vboxhost-$INSTALL_VER 2> /dev/null
    59     rm -f /usr/src/vboxdrv-$INSTALL_VER 2> /dev/null
    60     rm -f /usr/src/vboxnetflt-$INSTALL_VER 2> /dev/null
    61     rm -f /usr/src/vboxnetadp-$INSTALL_VER 2> /dev/null
    62     rm -f /usr/src/vboxpci-$INSTALL_VER 2> /dev/null
     58    rm -f "/usr/src/vboxhost-$INSTALL_VER" 2> /dev/null
     59    rm -f "/usr/src/vboxdrv-$INSTALL_VER" 2> /dev/null
     60    rm -f "/usr/src/vboxnetflt-$INSTALL_VER" 2> /dev/null
     61    rm -f "/usr/src/vboxnetadp-$INSTALL_VER" 2> /dev/null
     62    rm -f "/usr/src/vboxpci-$INSTALL_VER" 2> /dev/null
    6363fi
    6464
     
    9999  /usr/bin/vboxaudiotest \
    100100  /usr/bin/vboxbugreport \
    101   $PREV_INSTALLATION/components/VBoxVMM.so \
    102   $PREV_INSTALLATION/components/VBoxREM.so \
    103   $PREV_INSTALLATION/components/VBoxRT.so \
    104   $PREV_INSTALLATION/components/VBoxDDU.so \
    105   $PREV_INSTALLATION/components/VBoxXPCOM.so \
    106   $PREV_INSTALLATION/VBoxREM.so \
    107   $PREV_INSTALLATION/VBoxVRDP \
    108   $PREV_INSTALLATION/VBoxVRDP.so \
     101  "$PREV_INSTALLATION/components/VBoxVMM.so" \
     102  "$PREV_INSTALLATION/components/VBoxREM.so" \
     103  "$PREV_INSTALLATION/components/VBoxRT.so" \
     104  "$PREV_INSTALLATION/components/VBoxDDU.so" \
     105  "$PREV_INSTALLATION/components/VBoxXPCOM.so" \
     106  "$PREV_INSTALLATION/VBoxREM.so" \
     107  "$PREV_INSTALLATION/VBoxVRDP" \
     108  "$PREV_INSTALLATION/VBoxVRDP.so" \
    109109  2> /dev/null
    110110
    111111cwd=`pwd`
    112 if [ -f $PREV_INSTALLATION/src/Makefile ]; then
    113     cd $PREV_INSTALLATION/src
     112if [ -f "$PREV_INSTALLATION/src/Makefile" ]; then
     113    cd "$PREV_INSTALLATION/src"
    114114    make clean > /dev/null 2>&1
    115115fi
    116 if [ -f $PREV_INSTALLATION/src/vboxdrv/Makefile ]; then
    117     cd $PREV_INSTALLATION/src/vboxdrv
     116if [ -f "$PREV_INSTALLATION/src/vboxdrv/Makefile" ]; then
     117    cd "$PREV_INSTALLATION/src/vboxdrv"
    118118    make clean > /dev/null 2>&1
    119119fi
    120 if [ -f $PREV_INSTALLATION/src/vboxnetflt/Makefile ]; then
    121     cd $PREV_INSTALLATION/src/vboxnetflt
     120if [ -f "$PREV_INSTALLATION/src/vboxnetflt/Makefile" ]; then
     121    cd "$PREV_INSTALLATION/src/vboxnetflt"
    122122    make clean > /dev/null 2>&1
    123123fi
    124 if [ -f $PREV_INSTALLATION/src/vboxnetadp/Makefile ]; then
    125     cd $PREV_INSTALLATION/src/vboxnetadp
     124if [ -f "$PREV_INSTALLATION/src/vboxnetadp/Makefile" ]; then
     125    cd "$PREV_INSTALLATION/src/vboxnetadp"
    126126    make clean > /dev/null 2>&1
    127127fi
    128 if [ -f $PREV_INSTALLATION/src/vboxpci/Makefile ]; then
    129     cd $PREV_INSTALLATION/src/vboxpci
     128if [ -f "$PREV_INSTALLATION/src/vboxpci/Makefile" ]; then
     129    cd "$PREV_INSTALLATION/src/vboxpci"
    130130    make clean > /dev/null 2>&1
    131131fi
    132 cd $PREV_INSTALLATION
    133 if [ -r $CONFIG_DIR/$CONFIG_FILES ]; then
    134     rm -f `cat $CONFIG_DIR/$CONFIG_FILES` 2> /dev/null
     132cd "$PREV_INSTALLATION"
     133if [ -r "$CONFIG_DIR/$CONFIG_FILES" ]; then
     134    rm -f `cat "$CONFIG_DIR/$CONFIG_FILES"` 2> /dev/null
    135135elif [ -n "$DEFAULT_FILES" -a -r "$DEFAULT_FILES" ]; then
    136136    DEFAULT_FILE_NAMES=""
    137     . $DEFAULT_FILES
    138     for i in "$DEFAULT_FILE_NAMES"; do
    139         rm -f $i 2> /dev/null
    140     done
     137    . "$DEFAULT_FILES"
     138    rm -f $DEFAULT_FILE_NAMES 2> /dev/null
    141139fi
    142 for file in `find $PREV_INSTALLATION 2> /dev/null`; do
    143     rmdir -p $file 2> /dev/null
     140for file in `find "$PREV_INSTALLATION" 2> /dev/null`; do
     141    rmdir -p "$file" 2> /dev/null
    144142done
    145 cd $cwd
    146 mkdir -p $PREV_INSTALLATION 2> /dev/null # The above actually removes the current directory and parents!
    147 rmdir $PREV_INSTALLATION 2> /dev/null
    148 rm -r $CONFIG_DIR/$CONFIG 2> /dev/null
     143cd "$cwd"
     144mkdir -p "$PREV_INSTALLATION" 2> /dev/null # The above actually removes the current directory and parents!
     145rmdir "$PREV_INSTALLATION" 2> /dev/null
     146rm -f "$CONFIG_DIR/$CONFIG" 2> /dev/null
     147rm -f "$CONFIG_DIR/$CONFIG_FILES" 2> /dev/null
     148rmdir "$CONFIG_DIR" 2> /dev/null
     149
     150update-mime-database /usr/share/mime >/dev/null 2>&1
    149151
    150152if [ -z "$VBOX_NO_UNINSTALL_MESSAGE" ]; then
    151     rm -r $CONFIG_DIR/$CONFIG_FILES 2> /dev/null
    152     rmdir $CONFIG_DIR 2> /dev/null
    153153    [ -n "$INSTALL_REV" ] && INSTALL_REV=" r$INSTALL_REV"
    154154    info "VirtualBox $INSTALL_VER$INSTALL_REV has been removed successfully."
    155155    log "Successfully $INSTALL_VER$INSTALL_REV removed VirtualBox."
    156156fi
    157 update-mime-database /usr/share/mime >/dev/null 2>&1
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