Modified init scripts for inclusion in Fedora
[ovirt-node/TEMP.git] / scripts / ovirt-firstboot
blob335bdaa265a7817cfd1e1bf062ad06ee8a52381e
1 #!/bin/bash
3 # ovirt-firstboot Puts the node into configuration mode.
5 # chkconfig: 2345 99 01
6 # description: ovirt-firstboot node configuration script
8 # Copyright (C) 2008 Red Hat, Inc.
9 # Written by Darryl L. Pierce <dpierce@redhat.com>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; version 2 of the License.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 # MA 02110-1301, USA. A copy of the GNU General Public License is
24 # also available at http://www.gnu.org/copyleft/gpl.html.
26 ## Source functions library
27 . /etc/init.d/functions
28 . /etc/init.d/ovirt-functions
30 prog=ovirt-firstboot
31 lockfile=/var/lock/subsys/$prog
33 trap '__st=$?; stop_log; exit $__st' 0
34 trap 'exit $?' 1 2 13 15
36 start ()
38 if ! is_firstboot && ! is_auto_install; then
39 return
42 touch $lockfile
44 # by default in standalone, disable collectd until server is configured
45 service collectd stop > /dev/null 2>&1
46 chkconfig collectd off
48 if is_auto_install; then
49 ovirt-config-storage AUTO
50 ovirt-config-hostname AUTO
51 ovirt-config-networking AUTO
52 ovirt-config-logging AUTO
53 ovirt-config-collectd AUTO
54 ovirt-config-password AUTO
55 if [ "$OVIRT_LOCAL_BOOT" = 1 ]; then
56 mount_live
57 ovirt-config-boot /live "$OVIRT_BOOTPARAMS" no
58 disable_firstboot
59 reboot
61 elif is_firstboot; then
62 plymouth --hide-splash
64 ovirt-config-setup -x < /dev/console
66 plymouth --show-splash
68 disable_firstboot
70 ovirt_store_firstboot_config >> $OVIRT_LOGFILE 2>&1
72 rm -f $lockfile
75 case "$1" in
76 start)
77 if is_managed; then
78 exit 0
81 printf "Starting ovirt-firstboot: "
83 start
85 test $? == 0 && success || failure
86 echo
88 status)
89 status $prog
91 reload)
92 stop
93 start
95 stop)
96 stop
99 echo "Usage: ovirt-firstboot {start}"
100 exit 2
101 esac