Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
### BEGIN INIT INFO
3
# Provides: firstboot
4
# Default-Start: 3 5
5
# Default-Stop: 0 1 2 4 6
6
# Required-Start:
7
# Should-Start: $network
8
# Short-Description: Starts the firstboot configuration program
9
# Description: Firstboot runs the first time a machine is booted after
10
#              installation.  It checks for the existance of an
11
#              /etc/sysconfig/firstboot file.  If the file exists and
12
#              contains RUN_FIRSTBOOT=NO, firstboot will not run.  Otherwise
13
#              firstboot will be run.  If /etc/reconfigSys exists or if
14
#              "reconfig" is provided in the kernel boot arguments,
15
#              firstboot will run in reconfiguration mode.
16
### END INIT INFO
17
 
18
#
19
# firstboot: Starts the firstboot druid if it hasn't been run before
20
#
21
# chkconfig: 35 99 95
22
#
23
# description: Firstboot is a druid style program that runs on the first \
24
#              time a machine is booted after install.  It checks for \
25
#              the existence of an /etc/sysconfig/firstboot file.  If \
26
#              the file exists and contains RUN_FIRSTBOOT=NO, firstboot \
27
#              will not run.  Otherwise, firstboot will be run.  \
28
#              If /etc/reconfigSys exists or if "reconfig" is provided \
29
#              in the kernel boot arguments, firstboot will run in \
30
#              reconfiguration mode.
31
#
32
 
33
# Source function library.
34
. /etc/init.d/functions
35
 
36
FILENAME=/etc/sysconfig/firstboot
37
 
38
[ -z "$HOME" ] && export HOME=/
39
 
40
usage() {
41
    echo $"Usage: $0 {start|stop}"
42
}
43
 
44
case "$1" in
45
    start)
46
        if [ `/usr/bin/id -u` -ne 0 ]; then
47
            echo $"ERROR: Only root can run firstboot"
48
            exit 4
49
        fi
50
 
51
        if [ ! -f /usr/sbin/firstboot ]; then
52
            echo $"ERROR: Program /usr/sbin/firstboot is not installed"
53
            exit 5
54
        fi
55
 
56
        args=""
57
 
58
        if [ -f $FILENAME ] && [ ! -z "$(grep 'RUN_FIRSTBOOT=NO' $FILENAME)" ]; then
59
            exit 0
60
        fi
61
 
62
        if grep -i "reconfig" /proc/cmdline >/dev/null || [ -f /etc/reconfigSys ]; then
63
            args="--reconfig"
64
        fi
65
 
66
        . /etc/profile.d/lang.sh
67
 
68
        /usr/bin/plymouth --hide-splash
69
 
70
        /usr/sbin/firstboot $args
71
        RETVAL=$?
72
 
73
        /usr/bin/plymouth --show-splash
74
 
75
        # If firstboot succeeded, chkconfig it off so we don't see the message
76
        # every time about starting up firstboot.
77
        if [ "$RETVAL" -eq 0 ]; then
78
            action "" /bin/true
79
            /sbin/chkconfig firstboot off
80
        else
81
            action "" /bin/false
82
        fi
83
 
84
        exit $RETVAL
85
        ;;
86
 
87
    stop)
88
        exit 0
89
        ;;
90
 
91
    status)
92
        /sbin/chkconfig --list firstboot | grep on >/dev/null
93
        RETVAL=$?
94
 
95
        if [ "$RETVAL" -eq 0 ]; then
96
            if [ ! -f $FILENAME ] || [ -z "$(grep 'RUN_FIRSTBOOT=NO' $FILENAME)" ]; then
97
                echo $"firstboot is scheduled to run"
98
            else
99
                echo $"firstboot is not scheduled to run"
100
            fi
101
        else
102
            echo $"firstboot is not scheduled to run"
103
        fi
104
 
105
        exit 0
106
        ;;
107
 
108
    restart | reload | force-reload | condrestart | try-restart)
109
        usage
110
        exit 3
111
        ;;
112
 
113
    *)
114
        usage
115
        exit 2
116
        ;;
117
esac