#!/bin/sh
#
# livecd-auto-hostname
# Try to autoconfigure hostname
#
# chkconfig: 345 13 95
# description: aimed at livecd use
### BEGIN INIT INFO
# Required-Start: $network network_manager
# Should-Start:
# Required-Stop:
# Short-Description: Setup hostname
# Description: Setup hostname
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
### END INIT INFO

# Source function library.
. /etc/init.d/functions

LOCKFILE=/run/lock/subsys/livecd-auto-hostname
RETVAL=0

start()
{
	echo -n "Configuring hostname: "
	/usr/libexec/livecd-auto-hostname || return 1
	return 0
}

# See how we were called.
case "$1" in
	start|restart|reload)
		start || RETVAL=1
		;;
	stop)
		;;
	condstop)
		;;
	condrestart|condreload)
		if [ -e "$LOCKFILE" ]; then
			start || RETVAL=1
		fi
		;;
	status)
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
