I would like to see an eselect module that simplifies creating and deleting init scripts for network interfaces, /etc/init.d/net.*. Actually, creating/deleting these symlinks is simple enough, but (like rc.eselect, kernel.eselect and others) an eselect module coould show additional info and have some extra safeguards, for example to never delete /etc/init.d/net.lo and to ensure all created symlinks use a relative path.
I have attached my attempt at writing this module (this is my first eselect module, so beware). I'm not sure if "net" is a good name for this module, it might be too generic - other suggestions are welcome (perhaps it could even be merged into the rc module). There also is an ebuild for app-admin/eselect-net in case this doesn't end up in the base app-admin/eselect.
These are the features of the attached module:
- "add <interface>" action: adds a symlink from /etc/init.d/net.<interface> to net.lo.
- "delete <interface>" action: deletes /etc/init.d/net.<interface> if it is a symlink to net.lo. Prints a warning message if the init script is still in at least one runlevel.
- "list" action: shows a list of /etc/init.d/net.* init scripts and their respective runlevels.
- The parameter for "add" and "delete" can be optionally prefixed with "net.", so "add eth1" and "add net.eth1" do the same thing. "delete" also accepts numeric arguments that refer to the items printed by "list".
- If a parameter is lo, net.lo or its numeric equivalent, the scripts bails out with an error message ("add net.lo" actually checks if net.lo is a executable regular file and prints a different error message if this is not the case).
Created attachment 280785 [details]
eselect module suggestion, install to /usr/share/eselect/modules/net.eselect
Created attachment 280787 [details]
Ebuild for separate installation