diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/network b/src/network index ccf0893..07fb86c 100644 --- a/src/network +++ b/src/network @@ -88,16 +88,21 @@ profile_up() report_try "$1 up" - if check_iface $INTERFACE; then - if checkyesno $CHECK; then - err_append "Interface $INTERFACE already in use" - report_fail && exit 1 - else - interface_down $INTERFACE || exit 1 - load_profile $1 - fi - fi - + case $(check_iface $INTERFACE) in + up) + if checkyesno $CHECK; then + report_fail "Interface $INTERFACE already in use" + exit 1 + else + interface_down $INTERFACE || exit 1 + load_profile $1 + fi + ;; + external) + report_fail "Interface $INTERFACE externally controlled" + exit 1 + ;; + esac eval $PRE_UP || exit 1 @@ -132,8 +137,7 @@ profile_down() report_try "$1 down" if [[ "$(get_iface_prof $INTERFACE)" == "external" ]]; then - err_append "$interface was connected by another application" - report_fail + report_fail "$interface was connected by another application" exit 1 fi @@ -187,8 +191,18 @@ interface_down() # Return 1 if interface down # check_iface() { - [[ -f $STATE_DIR/interfaces/$1 ]] && return 0 - return 1 + if [[ -f $STATE_DIR/interfaces/$1 ]]; then ( + . $STATE_DIR/interfaces/$1 + if [[ $PROFILE -eq external ]]; then + echo "external" + else + echo "up" + fi + return 0 + ) + else + return 1 + fi } # get_iface_prof interface |