VirtualBox

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


Ignore:
Timestamp:
Jun 18, 2008 2:42:23 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32157
Message:

Installer/linux: fixed a bug in the creation of tap host interfaces belonging to groups and cleaned up that code slightly

File:
1 edited

Legend:

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

    r9108 r9789  
    180180        if ((! expr match "$2" "#" > /dev/null) &&
    181181            (test -z "$4" || expr match "$4" "#" > /dev/null)); then
     182          # Name our parameters, to make this script slightly less unreadable
     183          interface=$1
     184          user=$2
     185          bridge=$3
    182186          # As the very first thing, try delete the interface. Might already
    183187          # exist with different configuration. Ignore errors.
    184           VBoxTunctl -d $1 > /dev/null 2>&1
     188          VBoxTunctl -d $interface > /dev/null 2>&1
    185189          case $user in
    186190            +*)
    187                 group=`echo $2 | cut -c2-`
    188                 cmd="VBoxTunctl -t $1 -g $group"
     191                group=`echo $user | cut -c2-`
     192                cmd="VBoxTunctl -t $interface -g $group"
    189193                ;;
    190194            *)
    191                 cmd="VBoxTunctl -t $1 -u $2"
     195                cmd="VBoxTunctl -t $interface -u $user"
    192196                ;;
    193197          esac
     
    198202            i=1
    199203            while [ $i -le 10 ]; do
    200               ifconfig "$1" up 2> /dev/null
    201               if ifconfig | grep "$1" > /dev/null; then
     204              ifconfig "$interface" up 2> /dev/null
     205              if ifconfig | grep "$interface" > /dev/null; then
    202206                # Add the interface to a bridge if one was specified
    203                 if [ -n "$3" ]; then
    204                   if brctl addif "$3" "$1" 2> /dev/null; then
    205                     echo "$1 $2 $3" >> "$VARFILE"
     207                if [ -n "$bridge" ]; then
     208                  if brctl addif "$bridge" "$interface" 2> /dev/null; then
     209                    echo "$interface $user $bridge" >> "$VARFILE"
    206210                  else
    207                     echo "$1 $2" >> "$VARFILE"
    208                     echo "Warning - failed to add interface $1 to the bridge $3"
     211                    echo "$interface $user" >> "$VARFILE"
     212                    echo "Warning - failed to add interface $interface to the bridge $bridge"
    209213                  fi
    210214                else
    211                   echo "$1 $2" >> "$VARFILE"
     215                  echo "$interface $user" >> "$VARFILE"
    212216                fi
    213217                i=20
     
    218222            done
    219223            if [ $i -ne 20 ]; then
    220               echo "Warning - failed to bring up the interface $1"
     224              echo "Warning - failed to bring up the interface $interface"
    221225            fi
    222226          else
    223             echo "Warning - failed to create the interface $1 for the user $2"
     227            echo "Warning - failed to create the interface $interface for the user $user"
    224228          fi
    225229        else
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