#!/bin/sh -e

# Prompt for root password if needed
# su won't ask for pw if run as root
if [ $(id -un) != root ]; then
    printf "Root "
fi

# Security: Use absolute path names whenever running something under su
# to prevent running malicious programs as root.
case $(auto-ostype) in
FreeBSD)
    su -m root -c '/usr/sbin/service netif restart && service routing restart'
    ;;

NetBSD)
    su -m root -c '/usr/sbin/service network restart'
    ;;

OpenBSD)
    # FIXME: Anything else?
    sh /etc/netstart
    ;;
    
RHEL)
    # FIXME: Anything else?
    su -m root -c '/usr/sbin/service network restart'
    ;;

*)
    auto-unsupported-os $0
    exit 1
    ;;

esac
