Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 21019 | Differences between
and this patch

Collapse All | Expand All

(-)sbin/functions.sh (-42 / +56 lines)
Lines 206-212 Link Here
206
	pb_scripts=0
206
	pb_scripts=0
207
	pb_rate=0
207
	pb_rate=0
208
208
209
	[ ! -e /proc/splash -o ! -e /sbin/splash ] && return 0
209
	if [ ! -x /sbin/splash ] || \
210
	   [ -e /proc/version -a ! -e /proc/splash ]
211
	then
212
		return 0
213
	fi
210
	
214
	
211
	if [ -f /etc/conf.d/bootsplash.conf ]
215
	if [ -f /etc/conf.d/bootsplash.conf ]
212
	then
216
	then
Lines 227-262 Link Here
227
	export pb_init pb_count pb_scripts pb_rate
231
	export pb_init pb_count pb_scripts pb_rate
228
}
232
}
229
#
233
#
230
# void splash_calc (char *argv1, char *svcdir)
234
# void splash_calc (void)
231
#
235
#
232
splash_calc() {
236
splash_calc() {
233
	pb_runs=(/etc/runlevels/$1/*)
237
	pb_runs=($(dolisting "/etc/runlevels/${SOFTLEVEL}/"))
234
	pb_runb=(/etc/runlevels/boot/*)
238
	pb_runb=($(dolisting "/etc/runlevels/${BOOTLEVEL}/"))
235
	pb_scripts=${#pb_runs[*]}
239
	pb_scripts=${#pb_runs[*]}
236
	pb_boot=${#pb_runb[*]}
240
	pb_boot=${#pb_runb[*]}
237
241
238
	[ ! -e /proc/splash -o ! -e /sbin/splash ] && return 0
242
	[ ! -e /proc/splash -o ! -x /sbin/splash ] && return 0
239
243
240
    if [ -f /etc/conf.d/bootsplash.conf ]
244
	if [ -f /etc/conf.d/bootsplash.conf ]
241
	then
245
	then
242
        . /etc/conf.d/bootsplash.conf
246
		. /etc/conf.d/bootsplash.conf
243
247
244
		if [ -n "${PROGRESS_SYSINIT_RATE}" ]
248
		if [ -n "${PROGRESS_SYSINIT_RATE}" ]
245
		then
249
		then
246
			init_rate=$((65535*${PROGRESS_SYSINIT_RATE}/100))
250
			init_rate=$((65535*${PROGRESS_SYSINIT_RATE}/100))
247
		fi
251
		fi
248
		
252
		
249
        if [ -n "${PROGRESS_BOOT_RATE}" ]
253
		if [ -n "${PROGRESS_BOOT_RATE}" ]
250
		then
254
		then
251
            boot_rate=$((65535*${PROGRESS_BOOT_RATE}/100))
255
			boot_rate=$((65535*${PROGRESS_BOOT_RATE}/100))
252
        fi
256
		fi
253
	fi
257
	fi
254
258
255
	# In runlevel boot we have 5 already started scripts
259
	# In runlevel boot we have 5 already started scripts
256
	#
260
	#
257
	if [ "${RUNLEVEL}" = "S" -a "${1}" = "boot" ]
261
	if [ "${RUNLEVEL}" = "S" -a "${SOFTLEVEL}" = "boot" ]
258
	then
262
	then
259
		pb_started=($(dolisting "${2}/started/"))
263
		pb_started=($(dolisting "${svcdir}/started/"))
260
		pb_scripts=$((${pb_boot} - ${#pb_started[*]}))
264
		pb_scripts=$((${pb_boot} - ${#pb_started[*]}))
261
		pb_init=16383
265
		pb_init=16383
262
		pb_rate=26213
266
		pb_rate=26213
Lines 266-274 Link Here
266
			pb_init="${init_rate}"
270
			pb_init="${init_rate}"
267
			pb_rate=$((${init_rate} + ${boot_rate}))
271
			pb_rate=$((${init_rate} + ${boot_rate}))
268
		fi
272
		fi
269
	elif [ "${RUNLEVEL}" = "0" -o "${RUNLEVEL}" = "6" ]
273
	elif [ "${SOFTLEVEL}" = "reboot" -o "${SOFTLEVEL}" = "shutdown" ]
270
	then
274
	then
271
		pb_started=($(dolisting "${2}/started/"))
275
		pb_started=($(dolisting "${svcdir}/started/"))
272
		pb_scripts=${#pb_started[*]}
276
		pb_scripts=${#pb_started[*]}
273
		pb_rate=65534
277
		pb_rate=65534
274
	else
278
	else
Lines 280-352 Link Here
280
		fi
284
		fi
281
	fi
285
	fi
282
	
286
	
283
	echo "pb_init=${pb_init}" > "${2}/progress"
287
	echo "pb_init=${pb_init}" > "${svcdir}/progress"
284
	echo "pb_rate=${pb_rate}" >> "${2}/progress"
288
	echo "pb_rate=${pb_rate}" >> "${svcdir}/progress"
285
	echo "pb_count=${pb_count}" >> "${2}/progress"
289
	echo "pb_count=${pb_count}" >> "${svcdir}/progress"
286
	echo "pb_scripts=${pb_scripts}" >> "${2}/progress"
290
	echo "pb_scripts=${pb_scripts}" >> "${svcdir}/progress"
287
}
291
}
288
#
292
#
289
# void splash_update (char *svcdir, char *myscript, char *action)
293
# void splash_update (char *fsstate, char *myscript, char *action)
290
#
294
#
291
splash_update() {
295
splash_update() {
292
	[ ! -e /proc/splash -o ! -e /sbin/splash ] && return 0
296
	local fsstate="$1"
297
	local myscript="$2"
298
	local action="$3"
299
	
300
	[ ! -e /proc/splash -o ! -x /sbin/splash ] && return 0
293
	
301
	
294
	if [ "${1}" = "inline" ]
302
	if [ "${fsstate}" = "inline" ]
295
	then
303
	then
296
		/sbin/splash "$2" "$3"
304
		/sbin/splash "${myscript}" "${action}"
297
		pb_count=$((${pb_count} + 1))
305
		pb_count=$((${pb_count} + 1))
298
306
299
		# Only needed for splash_debug() 
307
		# Only needed for splash_debug() 
300
		pb_execed="${pb_execed} ${2:-inline}"
308
		pb_execed="${pb_execed} ${myscript:-inline}"
301
	else
309
	else
302
		# Update only runlevel scripts, no dependancies (only true for startup)
310
		# Update only runlevel scripts, no dependancies (only true for startup)
303
		if [ -z "$(ls -1 \"${1}/softscripts/\" 2> /dev/null | grep \"${2}\")" ]
311
		if [ ! -L "${svcdir}/softscripts/${myscript}" ]
304
		then
312
		then
305
			[ "${RUNLEVEL}" != "0" -a "${RUNLEVEL}" != "6" ] && return
313
			[ "${SOFTLEVEL}" != "reboot" -a \
314
			  "${SOFTLEVEL}" != "shutdown" ] && return
306
		fi
315
		fi
307
		# Source the current progress bar state
316
		# Source the current progress bar state
308
		test -f "${1}/progress" && source "${1}/progress"
317
		[ -f "${svcdir}/progress" ] && source "${svcdir}/progress"
309
318
310
		# Do not update an already executed script
319
		# Do not update an already executed script
311
		for x in ${pb_execed}
320
		for x in ${pb_execed}
312
		do
321
		do
313
			[ "${x}" = "${2}" ] && return
322
			[ "${x}" = "${myscript}" ] && return
314
		done	
323
		done	
315
		
324
		
316
		/sbin/splash "$2" "$3"
325
		/sbin/splash "${myscript}" "${action}"
317
		pb_count=$((${pb_count} + 1))
326
		pb_count=$((${pb_count} + 1))
318
		
327
		
319
		echo "pb_init=${pb_init}" > "${1}/progress"
328
		echo "pb_init=${pb_init}" > "${svcdir}/progress"
320
		echo "pb_rate=${pb_rate}" >> "${1}/progress"
329
		echo "pb_rate=${pb_rate}" >> "${svcdir}/progress"
321
		echo "pb_count=${pb_count}" >> "${1}/progress"
330
		echo "pb_count=${pb_count}" >> "${svcdir}/progress"
322
		echo "pb_scripts=${pb_scripts}" >> "${1}/progress"
331
		echo "pb_scripts=${pb_scripts}" >> "${svcdir}/progress"
323
		echo "pb_execed=\"${pb_execed} ${2}\"" >> "${1}/progress"
332
		echo "pb_execed=\"${pb_execed} ${myscript}\"" >> "${svcdir}/progress"
324
	fi
333
	fi
325
}
334
}
326
#
335
#
327
# void splash_debug (char *argv1)
336
# void splash_debug (char *softlevel)
328
#
337
#
329
splash_debug() {
338
splash_debug() {
339
	local softlevel="$1"
340
341
	[ ! -e /proc/splash -o ! -x /sbin/splash ] && return 0
342
	
330
	if [ -f /etc/conf.d/bootsplash.conf ]
343
	if [ -f /etc/conf.d/bootsplash.conf ]
331
	then
344
	then
332
		source /etc/conf.d/bootsplash.conf
345
		source /etc/conf.d/bootsplash.conf
333
346
334
		[ "${BOOTSPLASH_DEBUG}" = "yes" -a -n "${1}" ] || return
347
		[ "${BOOTSPLASH_DEBUG}" = "yes" -a -n "${softlevel}" ] || return
335
		
348
		
336
		if [ -f "${svcdir}/progress" ]
349
		if [ -f "${svcdir}/progress" ]
337
		then
350
		then
338
			cat "${svcdir}/progress" > "/var/log/bootsplash.${1}"
351
			cat "${svcdir}/progress" > "/var/log/bootsplash.${softlevel}"
339
		else
352
		else
340
			echo "pb_init=${pb_init}" > "/var/log/bootsplash.${1}"
353
			echo "pb_init=${pb_init}" > "/var/log/bootsplash.${softlevel}"
341
			echo "pb_rate=${pb_rate}" >> "/var/log/bootsplash.${1}"
354
			echo "pb_rate=${pb_rate}" >> "/var/log/bootsplash.${softlevel}"
342
			echo "pb_count=${pb_count}" >> "/var/log/bootsplash.${1}"
355
			echo "pb_count=${pb_count}" >> "/var/log/bootsplash.${softlevel}"
343
			echo "pb_scripts=${pb_scripts}" >> "/var/log/bootsplash.${1}"
356
			echo "pb_scripts=${pb_scripts}" >> "/var/log/bootsplash.${softlevel}"
344
			echo "pb_execed=\"${pb_execed}\"" >> "/var/log/bootsplash.${1}"
357
			echo "pb_execed=\"${pb_execed}\"" >> "/var/log/bootsplash.${softlevel}"
345
		fi	
358
		fi	
346
	fi
359
	fi
347
}
360
}
348
361
349
if [ -e /proc/splash -a -e /sbin/splash ]
362
if [ -x /sbin/splash ] && \
363
   [ -e /proc/version -a -e /proc/splash ]
350
then
364
then
351
	rc_splash() {
365
	rc_splash() {
352
		/sbin/splash $*
366
		/sbin/splash $*
(-)sbin/rc (-4 / +5 lines)
Lines 421-427 Link Here
421
fi
421
fi
422
422
423
# Progressbar begin
423
# Progressbar begin
424
splash_calc "${argv1}" "${svcdir}"
424
splash_calc
425
# Progressbar end
425
# Progressbar end
426
426
427
# For keeping a list of services that fails during boot/halt
427
# For keeping a list of services that fails during boot/halt
Lines 616-622 Link Here
616
	source /sbin/functions.sh
616
	source /sbin/functions.sh
617
	
617
	
618
	# Progressbar begin
618
	# Progressbar begin
619
	splash_debug "${argv1}"
619
	splash_debug "${SOFTLEVEL}"
620
	# Progressbar end
620
	# Progressbar end
621
621
622
	# Make sure that our $svcdir are clean for next reboot ...
622
	# Make sure that our $svcdir are clean for next reboot ...
Lines 672-678 Link Here
672
# Start scripts
672
# Start scripts
673
for i in ${EXTRA_SOFTSCRIPTS} $(dolisting "${svcdir}/softscripts/")
673
for i in ${EXTRA_SOFTSCRIPTS} $(dolisting "${svcdir}/softscripts/")
674
do
674
do
675
	dep_start "${i}"
675
	dep_start "${i##*/}"
676
done
676
done
677
677
678
# Wait for any services that may still be running ...
678
# Wait for any services that may still be running ...
Lines 705-711 Link Here
705
[ -n "${BOOT}" ] && unset BOOT
705
[ -n "${BOOT}" ] && unset BOOT
706
706
707
# Progressbar begin
707
# Progressbar begin
708
splash_debug "${argv1}"
708
splash_debug "${SOFTLEVEL}"
709
# Progressbar end
709
# Progressbar end
710
710
711
711
# vim:ts=4
712
# vim:ts=4
(-)sbin/runscript.sh (-2 / +2 lines)
Lines 447-457 Link Here
447
	case "${arg}" in
447
	case "${arg}" in
448
	stop)
448
	stop)
449
		svc_stop
449
		svc_stop
450
		splash_update "${svcdir}" "$myservice" "stop"
450
		splash_update "live" "$myservice" "stop"
451
		;;
451
		;;
452
	start)
452
	start)
453
		svc_start
453
		svc_start
454
		splash_update "${svcdir}" "$myservice" "start"
454
		splash_update "live" "$myservice" "start"
455
		;;
455
		;;
456
	needsme|ineed|usesme|iuse|broken)
456
	needsme|ineed|usesme|iuse|broken)
457
		list_depend_trace "${arg}"
457
		list_depend_trace "${arg}"

Return to bug 21019