summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2008-05-30 15:39:13 +0200
committerJames Rayner <james@archlinux.org>2008-05-30 15:39:13 +0200
commit7de6c1179b895aac1f26b81173e64bff421d8b5f (patch)
tree546aa86568e22e648f23d95b9a07c00c853e1a41 /contrib
parenta57607373a96ef93f82f98e7da4cbe2c8b55caed (diff)
downloadnetctl-7de6c1179b895aac1f26b81173e64bff421d8b5f.tar.gz
netctl-7de6c1179b895aac1f26b81173e64bff421d8b5f.tar.xz
separate automagic from netcfg proper
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/net-auto43
1 files changed, 43 insertions, 0 deletions
diff --git a/contrib/net-auto b/contrib/net-auto
new file mode 100755
index 0000000..add6711
--- /dev/null
+++ b/contrib/net-auto
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ # Ensure any device renaming has occurred as intended
+ for daemon in "${DAEMONS[@]}"; do
+ if [ "$daemon" = "${daemon#!}" -a "$daemon" = "net-rename" ]; then
+ if ck_daemon net-rename; then
+ /etc/rc.d/net-rename start
+ fi
+ fi
+ done
+
+ for network in ${AUTO_NETWORKS[@]}; do
+ case $network in
+ auto-*) # Automatic configuration, store type and get interface next
+ auto=$network
+ ;;
+ *) # Either interface or profile
+ if [[ "$auto" ]]; then # Auto set, so interface
+ /usr/bin/netcfg-$auto $network
+ unset auto
+ fi
+ esac
+ done
+
+ add_daemon net-auto
+ ;;
+ stop)
+ /usr/bin/netcfg2 -a
+ rm_daemon net-auto
+ ;;
+ restart)
+ $0 stop; sleep 1; $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+# vim: set ts=4 et sw=4: