#!/bin/bash . /etc/rc.conf . /etc/rc.d/functions case "$1" in start) if ! ck_daemon net-profiles; then echo "Network Profiles are already running. Try '/etc/rc.d/net-profiles restart'" exit fi # 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 # $NET env var is passed from the kernel boot line [ ! "$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-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 /usr/bin/netcfg2 -c $prof fi done fi add_daemon net-profiles ;; stop) # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf) /usr/bin/netcfg2 -a rm_daemon net-profiles ;; restart) $0 stop; sleep 1; $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac # vim: set ts=2 noet: