#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          fliwi-network-config
# Required-Start:    $local_fs
# Required-Stop:
# Should-Start:      udev
# Should-Stop:
# X-Start-Before:    $network ifrename procps
# Default-Start:     S
# Default-Stop:
# Short-Description: Updates the local network config
# Description:       This is a init-wrapper around fliwi-update-network-config
#                    to rewrite the local network configuration.
### END INIT INFO

NAME=fliwi-network-config
YMCUPDATENETWORKCONFIG=/usr/sbin/fliwi-update-network-config

. /lib/lsb/init-functions

test -x $YMCUPDATENETWORKCONFIG || exit 0

do_start()
{
  $YMCUPDATENETWORKCONFIG --auto --allow-network-disruption && return 0 || return 1
}


case "$1" in
  start)
    log_begin_msg "Setting up network configuration"
    do_start
    log_end_msg $?
  ;;

  reload|force-reload|restart|force-stop|status)
    echo "Error: argument '$1' not supported" >&2
    exit 3
  ;;

  stop)
  ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop}"
    exit 3
  ;;
esac

exit 0
