Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$action in /etc/netctl/hooks/* #62

Closed
graywolf opened this issue Oct 22, 2013 · 6 comments
Closed

$action in /etc/netctl/hooks/* #62

graywolf opened this issue Oct 22, 2013 · 6 comments

Comments

@graywolf
Copy link

Ok, I see there is $action variable in netctl-auto, but it would be nic to have $action variable also in hooks called via

netctl start $profile

I want to enable chrony after connect and disable after disconnet for all profiles, so POST* hook is not very practical for me.

@joukewitteveen
Copy link
Owner

The profile and hooks are sourced at each action. When this happens, you'll find the following environment variables set: INTERFACE, SSID, ACTION. Also, the Profile variable is set.

@graywolf
Copy link
Author

I don't agree with you sir.

I have executable script /etc/netctl/hooks/test , which IS executed. Content of this file is:

#!/bin/bash
echo $ACTION > /tmp/test
echo $INTERFACE >> /tmp/test
echo $SSID >> /tmp/test
echo $PROFILE >> /tmp/test

It creates file /tmp/test, but this file only contains for blank lines.

Action which executes the hook is:

netctl stop wlp4s0-orchiprg

So this may be a bug? Or am I doing something wrong?

@joukewitteveen
Copy link
Owner

The variables are only set when the connection actually changes. This means that netctl-auto hands-off the connection to wpa_supplicant, which does its magic (including setting the variables mentioned) whenever the connection changes. Hence the initial starting and stopping are not part of this scheme. You could complement your setup with ExecUpPost and ExecDownPre.

@graywolf
Copy link
Author

So if I got it right I need to add this two hooks into EVERY profile I have? Don't take me wrong, netctl is pretty good thing, but this is just stupid.

@joukewitteveen
Copy link
Owner

You could also specify them in a hook file or an interface file, effectively making it the default for every profile or every profile for a specific interface.

@graywolf
Copy link
Author

Hey, that's great ^_^ thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants