VirtualBox

Changeset 8453 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 29, 2008 11:27:43 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
30315
Message:

Installer/linux: fixes to the network scripts

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

Legend:

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

    r8172 r8453  
    3838appdel="VBoxDeleteIF"
    3939
     40iffile=/etc/vbox/interfaces
     41varfile=/var/run/VirtualBox/vboxnet
     42
    4043echo "VirtualBox host networking interface creation utility, version _VERSION_"
    4144echo "(C) 2005-2007 Sun Microsystems, Inc."
     
    100103# Make sure that the configuration file is accessible and that the interface
    101104# is not already registered.
    102 if [ -f /etc/vbox/interfaces ]
     105if [ -f "$iffile" ]
    103106then
    104107  # Make sure that the configuration file is read and writable
    105   if [ ! -r /etc/vbox/interfaces -o ! -w /etc/vbox/interfaces ]
     108  if [ ! -r "$iffile" -o ! -w "$iffile" ]
    106109  then
    107110    echo 1>&2 ""
    108111    echo 1>&2 "This utility must be able to read from and write to the file"
    109     echo 1>&2 "/etc/vbox/interfaces.  Please make sure that you have enough permissions to"
     112    echo 1>&2 "$iffile.  Please make sure that you have enough permissions to"
    110113    echo 1>&2 "do this."
    111114    exit 1
     
    116119oldbridge=""
    117120foundif=""
    118 tempfile=/etc/vbox/interfaces.tmp
     121tempfile="$iffile.tmp"
    119122rm -f "$tempfile"
    120 if [ -f /etc/vbox/interfaces ]
     123if [ -f "$iffile" ]
    121124then
    122125  while read line
     
    134137      then
    135138        echo 1>&2 ""
    136         echo 1>&2 "Removing badly formed line $line in /etc/vbox/interfaces."
     139        echo 1>&2 "Removing badly formed line $line in $iffile."
    137140      # If the interface to be created is already registered in the file, then
    138141      # remove it and remember the fact
     
    148151      fi
    149152    fi # The line was not a comment
    150   done < /etc/vbox/interfaces
     153  done < "$iffile"
    151154else
    152   # Create the file /etc/vbox/interfaces and add some explanations as comments
     155  # Create the file $iffile and add some explanations as comments
    153156  echo "# This file is for registering VirtualBox permanent host networking interfaces" > "$tempfile"
    154157  echo "# and optionally adding them to network bridges on the host." >> "$tempfile"
     
    156159  echo "" >> "$tempfile"
    157160fi
    158 mv -f "$tempfile" /etc/vbox/interfaces
     161mv -f "$tempfile" "$iffile"
    159162
    160163# Add the new interface line to the file if so requested
    161164if [ "$appname" = "$appadd" ]
    162165then
    163   echo "$interface" "$user" "$bridge" >> /etc/vbox/interfaces
     166  echo "$interface" "$user" "$bridge" >> "$iffile"
    164167  echo ""
    165168  if [ -n "$group" ]; then
     
    232235        echo 1>&2 "Make sure that the bridge exists and that you currently have sufficient"
    233236        echo 1>&2 "permissions to do this."
     237        echo $interface $user >> $varfile 2>/dev/null
    234238        exit 1
    235239      fi
    236240    fi
     241    # We may end up with duplicate entries here, but this does no great harm.
     242    echo $interface $user $bridge >> $varfile 2>/dev/null
    237243  fi # $appname = $appadd
    238244fi # VBoxTunctl -d succeeded
  • trunk/src/VBox/Installer/linux/vboxnet.sh.in

    r8172 r8453  
    203203                if [ -n "$3" ]; then
    204204                  if brctl addif "$3" "$1" 2> /dev/null; then
    205                     echo "$1 $2 $3" > "$VARFILE"
     205                    echo "$1 $2 $3" >> "$VARFILE"
    206206                  else
    207                     echo "$1 $2" > "$VARFILE"
     207                    echo "$1 $2" >> "$VARFILE"
    208208                    echo "Warning - failed to add interface $1 to the bridge $3"
    209209                  fi
    210210                else
    211                   echo "$1 $2" > $VARFILE
     211                  echo "$1 $2" >> "$VARFILE"
    212212                fi
    213213                i=20
     
    279279          fi
    280280        done < "$VARFILE"
    281         failure "Removing of interface '$3' failed"
    282281      fi
    283282    done < "$VARFILE"
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