#!/bin/sh

export PATH="/bin:/sbin:/usr/bin:/usr/sbin:"

echo "Shutting down"

[ -e /dev/rtc0 ] && hwclock -u -w 

sv down /var/service/* 

killall5 -15
sleep 3
killall5 -9

dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null

rm -f /etc/mtab
swapoff -a

echo "Unmounting filesystems"
umount -a -r -t noproc

echo "Remounting / as read-only" 
mount -o remount,ro /

sync
sleep 1
wait

echo "Powered down!"
