#! /bin/sh
#
# reboot	The commands in this script are executed as the last
#		step in runlevel 6, ie reboot.
#
# Version:	@(#)reboot  1.8  23-Jun-1996  miquels@cistron.nl
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Kill all processes.
echo -n "Sending all processes the TERM signal... "
killall5 -15
echo "done."
sleep 5
echo -n "Sending all processes the KILL signal... "
killall5 -9
echo "done."

# Write a reboot record to /var/log/wtmp.
halt -w

# Carry a random seed from shut-down to start-up;
# see documentation in linux/drivers/char/random.c
if [ -c /dev/urandom ]
then
	# Save 512 bytes, which is the size of the entropy pool
	dd if=/dev/urandom of=/var/run/random-seed count=1 >/dev/null 2>&1 
fi

echo -n "Deactivating swap... "
swapoff -a
echo "done."

echo -n "Unmounting file systems... "
umount -a
echo "done."

mount -n -o remount,ro /

echo -n "Rebooting... "
reboot -d -f
