summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/netctl.profile.5.txt14
-rwxr-xr-xsrc/lib/auto.action27
-rw-r--r--src/lib/globals2
3 files changed, 16 insertions, 27 deletions
diff --git a/docs/netctl.profile.5.txt b/docs/netctl.profile.5.txt
index ec36f47..b1ccde1 100644
--- a/docs/netctl.profile.5.txt
+++ b/docs/netctl.profile.5.txt
@@ -20,13 +20,13 @@ much quoting as possible. For a few WPA-related variables, special
quoting rules (see below) apply.
The name of the profile is the name of the file. Profile names must not
-contain newlines and should not end in '.service' or '.conf'. Whenever a
-profile is read, all executable scripts in '/etc/netctl/hooks/' and any
-executable script in '/etc/netctl/interfaces/' with the name of the
-interface for the profile are sourced. Declarations in an interface
-script override declarations in a profile, which override declarations
-in hooks. For each connection type, there are example profile files in
-'/etc/netctl/examples/'.
+contain newlines and should not end in '.action', '.conf', or
+'.service'. Whenever a profile is read, all executable scripts in
+'/etc/netctl/hooks/' and any executable script in
+'/etc/netctl/interfaces/' with the name of the interface for the profile
+are sourced. Declarations in an interface script override declarations
+in a profile, which override declarations in hooks. For each connection
+type, there are example profile files in '/etc/netctl/examples/'.
AVAILABLE CONNECTION TYPES
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