diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/lib/auto.action | 27 | ||||
-rw-r--r-- | src/lib/globals | 2 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/lib/auto.action b/src/lib/auto.action index feebd77..3ea1373 100755 --- a/src/lib/auto.action +++ b/src/lib/auto.action @@ -3,37 +3,26 @@ . /usr/lib/network/globals . "$SUBR_DIR/ip" -interface="$1" -ssid="$2" -profile="$3" -action="$4" +export INTERFACE="$1" +export SSID="$2" +# Expose the profile name similar to ordinary netctl usage +Profile="$3" +export ACTION="$4" -# Is it possible that we don't get a profile?! -[[ "$profile" ]] && load_profile "$profile" +load_profile "$Profile" -case $action in +case $ACTION in CONNECT) - if [[ -z $profile ]]; then - if [[ -x "$PROFILE_DIR/interfaces/$interface" ]]; then - source "$PROFILE_DIR/interfaces/$interface" - fi - dhcpcd -qL -t "${TimeoutDHCP:-10}" $DhcpcdOptions -K "$interface" - exit $? - fi DhcpcdOptions+=" -K" ip_set || exit 1 # JP: sandbox the eval if ! ( eval $ExecUpPost ); then # Failing ExecUpPost will take the connection down - netctl-auto stop "$interface" + netctl-auto stop "$INTERFACE" exit 1 fi ;; DISCONNECT) - if [[ -z $profile ]]; then - dhcpcd -k "$interface" - exit $? - fi # JP: sandbox the eval if ! ( eval $ExecDownPre ); then exit 1 diff --git a/src/lib/globals b/src/lib/globals index ee45f52..5926472 100644 --- a/src/lib/globals +++ b/src/lib/globals @@ -93,7 +93,7 @@ timeout_wait() { list_profiles() { # JP: follow aliases with -L, also skip profiles that end with '.conf' (so # profile.conf can be the wpa.conf file for profile) - find -L "$PROFILE_DIR/" -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name '*.conf' -not -name '*.service' -printf "%f\n" + find -L "$PROFILE_DIR/" -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name '*.action' -not -name '*.conf' -not -name '*.service' -printf "%f\n" } ## Sources all hooks, a profile and any interface hook |