Blame | Last modification | View Log | RSS feed
#!/bin/bash### BEGIN INIT INFO# Provides: firstboot# Default-Start: 3 5# Default-Stop: 0 1 2 4 6# Required-Start:# Should-Start: $network# Short-Description: Starts the firstboot configuration program# Description: Firstboot runs the first time a machine is booted after# installation. It checks for the existance of an# /etc/sysconfig/firstboot file. If the file exists and# contains RUN_FIRSTBOOT=NO, firstboot will not run. Otherwise# firstboot will be run. If /etc/reconfigSys exists or if# "reconfig" is provided in the kernel boot arguments,# firstboot will run in reconfiguration mode.### END INIT INFO## firstboot: Starts the firstboot druid if it hasn't been run before## chkconfig: 35 99 95## description: Firstboot is a druid style program that runs on the first \# time a machine is booted after install. It checks for \# the existence of an /etc/sysconfig/firstboot file. If \# the file exists and contains RUN_FIRSTBOOT=NO, firstboot \# will not run. Otherwise, firstboot will be run. \# If /etc/reconfigSys exists or if "reconfig" is provided \# in the kernel boot arguments, firstboot will run in \# reconfiguration mode.## Source function library.. /etc/init.d/functionsFILENAME=/etc/sysconfig/firstboot[ -z "$HOME" ] && export HOME=/usage() {echo $"Usage: $0 {start|stop}"}case "$1" instart)if [ `/usr/bin/id -u` -ne 0 ]; thenecho $"ERROR: Only root can run firstboot"exit 4fiif [ ! -f /usr/sbin/firstboot ]; thenecho $"ERROR: Program /usr/sbin/firstboot is not installed"exit 5fiargs=""if [ -f $FILENAME ] && [ ! -z "$(grep 'RUN_FIRSTBOOT=NO' $FILENAME)" ]; thenexit 0fiif grep -i "reconfig" /proc/cmdline >/dev/null || [ -f /etc/reconfigSys ]; thenargs="--reconfig"fi. /etc/profile.d/lang.sh/usr/bin/plymouth --hide-splash/usr/sbin/firstboot $argsRETVAL=$?/usr/bin/plymouth --show-splash# If firstboot succeeded, chkconfig it off so we don't see the message# every time about starting up firstboot.if [ "$RETVAL" -eq 0 ]; thenaction "" /bin/true/sbin/chkconfig firstboot offelseaction "" /bin/falsefiexit $RETVAL;;stop)exit 0;;status)/sbin/chkconfig --list firstboot | grep on >/dev/nullRETVAL=$?if [ "$RETVAL" -eq 0 ]; thenif [ ! -f $FILENAME ] || [ -z "$(grep 'RUN_FIRSTBOOT=NO' $FILENAME)" ]; thenecho $"firstboot is scheduled to run"elseecho $"firstboot is not scheduled to run"fielseecho $"firstboot is not scheduled to run"fiexit 0;;restart | reload | force-reload | condrestart | try-restart)usageexit 3;;*)usageexit 2;;esac