Changeset 8453 in vbox for trunk/src/VBox
- Timestamp:
- Apr 29, 2008 11:27:43 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 30315
- Location:
- trunk/src/VBox/Installer/linux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/linux/VBoxAddIF.sh
r8172 r8453 38 38 appdel="VBoxDeleteIF" 39 39 40 iffile=/etc/vbox/interfaces 41 varfile=/var/run/VirtualBox/vboxnet 42 40 43 echo "VirtualBox host networking interface creation utility, version _VERSION_" 41 44 echo "(C) 2005-2007 Sun Microsystems, Inc." … … 100 103 # Make sure that the configuration file is accessible and that the interface 101 104 # is not already registered. 102 if [ -f /etc/vbox/interfaces]105 if [ -f "$iffile" ] 103 106 then 104 107 # 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" ] 106 109 then 107 110 echo 1>&2 "" 108 111 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" 110 113 echo 1>&2 "do this." 111 114 exit 1 … … 116 119 oldbridge="" 117 120 foundif="" 118 tempfile= /etc/vbox/interfaces.tmp121 tempfile="$iffile.tmp" 119 122 rm -f "$tempfile" 120 if [ -f /etc/vbox/interfaces]123 if [ -f "$iffile" ] 121 124 then 122 125 while read line … … 134 137 then 135 138 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." 137 140 # If the interface to be created is already registered in the file, then 138 141 # remove it and remember the fact … … 148 151 fi 149 152 fi # The line was not a comment 150 done < /etc/vbox/interfaces153 done < "$iffile" 151 154 else 152 # Create the file /etc/vbox/interfacesand add some explanations as comments155 # Create the file $iffile and add some explanations as comments 153 156 echo "# This file is for registering VirtualBox permanent host networking interfaces" > "$tempfile" 154 157 echo "# and optionally adding them to network bridges on the host." >> "$tempfile" … … 156 159 echo "" >> "$tempfile" 157 160 fi 158 mv -f "$tempfile" /etc/vbox/interfaces161 mv -f "$tempfile" "$iffile" 159 162 160 163 # Add the new interface line to the file if so requested 161 164 if [ "$appname" = "$appadd" ] 162 165 then 163 echo "$interface" "$user" "$bridge" >> /etc/vbox/interfaces166 echo "$interface" "$user" "$bridge" >> "$iffile" 164 167 echo "" 165 168 if [ -n "$group" ]; then … … 232 235 echo 1>&2 "Make sure that the bridge exists and that you currently have sufficient" 233 236 echo 1>&2 "permissions to do this." 237 echo $interface $user >> $varfile 2>/dev/null 234 238 exit 1 235 239 fi 236 240 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 237 243 fi # $appname = $appadd 238 244 fi # VBoxTunctl -d succeeded -
trunk/src/VBox/Installer/linux/vboxnet.sh.in
r8172 r8453 203 203 if [ -n "$3" ]; then 204 204 if brctl addif "$3" "$1" 2> /dev/null; then 205 echo "$1 $2 $3" > "$VARFILE"205 echo "$1 $2 $3" >> "$VARFILE" 206 206 else 207 echo "$1 $2" > "$VARFILE"207 echo "$1 $2" >> "$VARFILE" 208 208 echo "Warning - failed to add interface $1 to the bridge $3" 209 209 fi 210 210 else 211 echo "$1 $2" > $VARFILE211 echo "$1 $2" >> "$VARFILE" 212 212 fi 213 213 i=20 … … 279 279 fi 280 280 done < "$VARFILE" 281 failure "Removing of interface '$3' failed"282 281 fi 283 282 done < "$VARFILE"
Note:
See TracChangeset
for help on using the changeset viewer.