Files
initscripts/SRC/initscripts/init.d/hostname
Jay Larson 17afdf7765 The following changes were made:
* removed quotes around chroot command in usher
  * removed hwclock from Required-Start in checkfs
  * removed $local_fs from Required-Start in hostname
  * updated mountvirtfs to create /run/utmp
  * added 2 conditionals to readsvcs() in update-rc
2017-05-20 09:18:03 -05:00

35 lines
818 B
Bash
Executable File

#!/bin/sh
### BEGIN INIT INFO
# Provides: hostname
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop
# Default-Start: S
# Default-Stop:
# Short-Description: Set hostname to value in /etc/hostname
# Description: Set hostname to value in /etc/hostname if
# present, otherwise set hostname to localhost
# X-Required: true
### END INIT INFO
. /lib/lsb/init-functions
[ -r /etc/hostname ] && HOSTNAME=`cat /etc/hostname`
[ -z "$HOSTNAME" ] && HOSTNAME='localhost'
case "$1" in
start|restart)
log_init_msg "Setting hostname to $HOSTNAME"
hostname $HOSTNAME && log_success_msg || log_failure_msg
;;
status)
echo "Current hostname: $(hostname)"
;;
*)
echo "Usage: $0 [start|restart|status]"
exit 1
;;
esac
exit 0