Commit c1f1528f authored by Jondy Zhao's avatar Jondy Zhao

Don't report error when add an existed ip address

parent 5a82707c
......@@ -463,17 +463,6 @@ elif [[ $object == "addr" ]] ; then
exit 1
fi
if [[ "$opt_family" == "ipv4" || "$opt_family" == "" ]] ; then
ipcmd="netsh interface ip $command address"
address="$address $mask"
elif [[ "$opt_family" == "ipv6" ]] ; then
ipcmd="netsh interface ipv6 $command address"
else
echo $orig_cmd
echo "Error: unsupported family \"$opt_family\""
exit 1
fi
while [[ "$1" != "" ]] ; do
case $1 in
dev)
......@@ -486,6 +475,26 @@ elif [[ $object == "addr" ]] ; then
shift
done
if [[ "$opt_family" == "ipv4" || "$opt_family" == "" ]] ; then
if [[ "$command" == "add" ]] ; then
netsh interface ip show address \"$dev\" | grep -q -F $address && exit 0
fi
ipcmd="netsh interface ip $command address"
address="$address $mask"
elif [[ "$opt_family" == "ipv6" ]] ; then
if [[ "$command" == "add" ]] ; then
netsh interface ipv6 show address \"$dev\" level=normal | \
grep -q -F $address && exit 0
fi
ipcmd="netsh interface ipv6 $command address"
else
echo $orig_cmd
echo "Error: unsupported family \"$opt_family\""
exit 1
fi
ipcmd="$ipcmd \"$dev\" $address"
elif [[ $object == "addrlabel" ]] ; then
......@@ -513,6 +522,7 @@ elif [[ $object == "addrlabel" ]] ; then
fi
if [[ $command == "add" ]] ; then
netsh interface ipv6 show prefixpolicies | grep -q -F $prefix && exit 0
ipcmd="$ipcmd $command prefixpolicy $prefix $precedence $label"
else
ipcmd="$ipcmd $command prefixpolicy $prefix"
......
......@@ -53,10 +53,9 @@ echo Checking Windows OEM Codepage ...
_charset=$(ipwin codepage) || _charset=""
echo Windows OEM Codepage is ${_charset}
_filename="~/.minttyrc"
_filename=".minttyrc"
echo Checking ${_filename} ...
if [[ ! -f ${_filename} ]] ; then
echo Creating ${_filename}
cat <<EOF > ${_filename}
BoldAsFont=no
Font=Courier New
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment