summaryrefslogtreecommitdiffstats
path: root/initrd/distro-specs/suse/files-default/etc/init.d/halt
blob: 65e5b0adc285f0a3a40cb925fc55744f001cac73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/sh
#
# Description:	Modificated /etc/init.d/halt for use with Diskless 
#		X Stations (v4.0)
#		-> replaces /etc/init.d/halt
#
# Author(s):	Dirk von Suchodoletz <dirk@goe.net>, 13-12-2005
# Copyright: 	(c) 2003, 2005 - RZ Universitaet Freiburg
# 
# Version:	0.0.3a
# 
# Some parts taken from /etc/init.d/halt by
#
# Copyright (c) 1996-2004 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.

. /etc/rc.status
. /etc/sysconfig/clock
. /etc/sysconfig/suseconfig

#
# Avoid being interrupted by child or keyboard
trap "echo" SIGINT SIGSEGV SIGQUIT SIGTERM
set +e

rc_reset
case "$0" in
	*halt)
		message="The system is halted."
		command="halt"
		modprobe -q apm &>/dev/null
		if test -e /proc/apm -o -e /proc/acpi -o -e /proc/sys/acpi ; then
			command="halt -p"
		else
			read cmdline < /proc/cmdline
			case "$cmdline" in
				*apm=smp-power-off*|*apm=power-off*)
				command="halt -p" ;;
			esac
                fi
		;;
	*reboot)
		message="Please stand by while rebooting the system..."
		command="reboot"
		;;
	*)
		echo "$0: call me as \"halt\" or \"reboot\" please!"
		exit 1
		;;
esac

# Write to wtmp file before unmounting /var (only needed with 
# persistent mounted filesystem)
# $command -w 

rc_reset
echo "Turning off swap"
sync ; sync
swapoff -a || rc_failed
rc_status

UMOUNT_FAILED=false
rc_reset
echo "Unmounting file systems and devices"
for unmount in /media/* ; do
	umount -fnt $unmount &>/dev/null
done
umount -fnt /tmp/scratch &>/dev/null
eject /dev/zip &>/dev/null &
rc_status -v1

umount -anft noproc,nonfs &>/dev/null

rc_reset
# maybe we use multiple devices
if test -f /etc/mdtab -a -x /sbin/mdadd ; then
    echo -n "Disable Multiple Devices"
    /sbin/mdstop -a || rc_failed
    rc_status -v1
fi

sync

# show "the system is down" message
if test "$SPLASH" = yes ; then
        /sbin/splash -q -p 65535 -t "isdown"
fi

echo $message
exec $command -d -f