diff options
author | James Rayner <james@archlinux.org> | 2007-12-29 13:47:17 +0100 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2007-12-29 13:47:17 +0100 |
commit | dc101daef771eaab94ed00f87a69612e60c73c11 (patch) | |
tree | c9cc874a18f67707d79c4ce384ad44c7cba76ce1 /src | |
parent | 2fc0a5d9baae63773cf7675b60459a85063279d5 (diff) | |
download | netctl-dc101daef771eaab94ed00f87a69612e60c73c11.tar.gz netctl-dc101daef771eaab94ed00f87a69612e60c73c11.tar.xz |
Small new features & tidying
* Tidied: auto-wireless support
* Added: Explicitly specify menu default via NETWORKS_MENU_DEFAULT
* Added: Explicitly set menu timeout with NETWORKS_MENU_TIMEOUT
* Added: Recording of last profile as $PROFILE_DIR/last
* Tidied: /etc/rc.d/net-profiles
Diffstat (limited to 'src')
-rwxr-xr-x | src/net-profiles | 26 | ||||
-rwxr-xr-x | src/netcfg-menu | 3 | ||||
-rw-r--r-- | src/network.subr | 6 |
3 files changed, 19 insertions, 16 deletions
diff --git a/src/net-profiles b/src/net-profiles index 9967b6e..f9c2875 100755 --- a/src/net-profiles +++ b/src/net-profiles @@ -20,14 +20,16 @@ case "$1" in done # $NET env var is passed from the kernel boot line - if [ "$NET" = "menu" -o "$NETWORKS" = "menu" ]; then - /usr/bin/netcfg-menu 5 + [ ! "$NETWORKS_MENU_TIMEOUT" ] && NETWORKS_MENU_TIMEOUT=5 + + if [ "$NET" = "menu" -o "$NETWORKS" = "menu" ]; then + /usr/bin/netcfg-menu $NETWORKS_MENU_TIMEOUT elif [ "$NET" ]; then /usr/bin/netcfg2 $NET - elif [ "${NETWORKS[0]}" = "auto" ]; then - if [ "${NETWORKS[1]}" ]; then - /usr/bin/netcfg-wireless-auto ${NETWORKS[1]} - fi + elif [ "${NETWORKS[0]}" = "auto-wireless" ]; then + if [ "${NETWORKS[1]}" ]; then + /usr/bin/netcfg-auto-wireless ${NETWORKS[1]} + fi elif [ "$NETWORKS" ]; then for prof in ${NETWORKS[@]}; do if [ "$prof" = "${prof#!}" ]; then @@ -37,25 +39,17 @@ case "$1" in fi add_daemon net-profiles - ;; stop) # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf) - status "Stopping Network Profiles" /usr/bin/netcfg2 -a + /usr/bin/netcfg2 -a rm_daemon net-profiles ;; restart) - $0 stop - /bin/sleep 1 - $0 start - ;; - hotplug_ifup|ifup|ifdown|iflist|rtup|rtdown|rtlist) - $1 $2 + $0 stop; sleep 1; $0 start ;; *) echo "usage: $0 {start|stop|restart}" - echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}" esac # vim: set ts=2 noet: -# vim: set ts=4 et sw=4: diff --git a/src/netcfg-menu b/src/netcfg-menu index 0970a01..4da1291 100755 --- a/src/netcfg-menu +++ b/src/netcfg-menu @@ -4,6 +4,7 @@ . /etc/rc.d/functions . /usr/lib/network/network.subr + # Scan all profiles i=0 for prof in `find -L $PROFILE_DIR -maxdepth 1 -type f -printf "%f\n"`; do @@ -23,6 +24,8 @@ if [ ${#profiles} -eq 0 ]; then fi # if no default yet, use the first entry +[ "$NETWORKS_MENU_DEFAULT" ] && DEFAULT="$NETWORKS_MENU_DEFAULT" + [ "$DEFAULT" = "" ] && DEFAULT=${profiles[0]} ANSWER=$(mktemp) || exit 1 diff --git a/src/network.subr b/src/network.subr index d571e3d..1a86886 100644 --- a/src/network.subr +++ b/src/network.subr @@ -112,6 +112,8 @@ profile_up() set_profile up $1 ${CONNECTION}_clean_scope + + add_daemon net-profiles stat_done } @@ -204,6 +206,10 @@ set_profile() { . $PROFILE_DIR/$2 cp $PROFILE_DIR/$2 $STATE_DIR/profiles/ set_iface up $INTERFACE $2 + + rm $PROFILE_DIR/last 2> /dev/null + ln -s $PROFILE_DIR/$2 $PROFILE_DIR/last + elif [[ "$1" == "down" ]]; then . $STATE_DIR/profiles/$2 rm $STATE_DIR/profiles/$2 |