Add pancyrillic font
[platform/upstream/kbd.git] / src / cad
1 #!/bin/sh
2
3 trap "" 0 1 2 15
4
5 tput clear
6
7 # Find the non-local logins, probably on ttyp etc. Or on pts/N.
8 # grep -E is equivalent to egrep but does not exist everywhere
9 LOG="`w -s | egrep -v 'tty[0-9]' | tail +2`"
10 count=`echo "$LOG" | wc -l`
11
12 dont_panic() {
13  dialog --infobox "
14
15                THE SYSTEM IS SHUTTING DOWN
16
17                    !!!!!!!WAIT!!!!!!
18
19             !!!!DON'T POWER DOWN YET!!!!!!!!
20
21              wait for this message to clear.
22              $*
23
24  " 15 60 &
25 }
26
27 if [ $count -lt 2 ]; then
28  dont_panic "
29               The system is shutting down"
30  /sbin/shutdown -r now "sistema esta en shutdown"
31 else
32  dialog --yesno "
33 There are the following users in
34 the machine:
35
36 `echo "$LOG"`
37
38 Shutdown will be delayed by 2 minutes
39 in order to warn the users.
40
41 Do you still want to start the shutdown?
42
43 " `expr 14 + $count` 70
44
45
46 if [ $? = 0 ];then
47   dont_panic "
48                Shutting down in 2 minutes"
49   /sbin/shutdown -r +2 "sistema esta en shutdown"
50 else 
51   sleep 1
52   dialog --infobox "
53
54         The shutdown has been aborted
55
56   " 7 50 &
57  sleep 5
58  tput clear
59 fi
60 fi