Add atngw100 target
[buildroot.git] / target / device / Atmel / atngw100 / target_skeleton / etc / init.d / S02hostname
1 #!/bin/sh
2
3 PROGRAM=/bin/hostname
4
5 echo -n "Setting hostname:"
6 [ -x ${PROGRAM} ] || (echo " missing"; exit 0)
7
8 if [ -f /etc/hostname ]; then
9 HOST="$(cat /etc/hostname)"
10 else
11 HOST="localhost.localdomain"
12 fi
13
14 start() {
15 if ${PROGRAM} "${HOST}" > /dev/null 2> /dev/null; then
16 echo " '${HOST}'"
17 else
18 echo " failed"
19 exit 1
20 fi
21 }
22
23 stop() {
24 return 0
25 }
26
27 restart() {
28 stop
29 start
30 }
31
32 case "$1" in
33 start)
34 start
35 ;;
36 stop)
37 stop
38 ;;
39 restart|reload)
40 restart
41 ;;
42 *)
43 echo $"Usage: $0 {start|stop|restart}"
44 exit 1
45 esac
46
47 exit $?