Lines 8-16
Link Here
|
8 |
|
8 |
|
9 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
9 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
10 |
# Only try and update if we are root |
10 |
# Only try and update if we are root |
11 |
if [[ ${EUID} == "0" ]] && ! /sbin/depscan.sh ; then |
11 |
if [[ ${EUID} == "0" ]] && ! @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh ; then |
12 |
echo |
12 |
echo |
13 |
eerror "Error running '/sbin/depscan.sh'!" |
13 |
eerror "Error running '@GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh'!" |
14 |
eerror "Please correct any problems above." |
14 |
eerror "Please correct any problems above." |
15 |
exit 1 |
15 |
exit 1 |
16 |
fi |
16 |
fi |
Lines 19-25
Link Here
|
19 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
19 |
if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then |
20 |
echo |
20 |
echo |
21 |
eerror "Dependency info is missing! Please run" |
21 |
eerror "Dependency info is missing! Please run" |
22 |
eerror " # /sbin/depscan.sh" |
22 |
eerror " # @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh" |
23 |
eerror "to fix this." |
23 |
eerror "to fix this." |
24 |
exit 1 |
24 |
exit 1 |
25 |
fi |
25 |
fi |
Lines 134-140
Link Here
|
134 |
if ! get_dep_info "${myservice}" >/dev/null ; then |
134 |
if ! get_dep_info "${myservice}" >/dev/null ; then |
135 |
eerror "Could not get dependency info for ${myservice}!" > /dev/stderr |
135 |
eerror "Could not get dependency info for ${myservice}!" > /dev/stderr |
136 |
eerror "Please run:" > /dev/stderr |
136 |
eerror "Please run:" > /dev/stderr |
137 |
eerror " # /sbin/depscan.sh" > /dev/stderr |
137 |
eerror " # @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh" > /dev/stderr |
138 |
eerror "to try and fix this." > /dev/stderr |
138 |
eerror "to try and fix this." > /dev/stderr |
139 |
return 1 |
139 |
return 1 |
140 |
fi |
140 |
fi |
Lines 212-222
Link Here
|
212 |
|
212 |
|
213 |
[[ -z $1 || -z $2 ]] && return 1 |
213 |
[[ -z $1 || -z $2 ]] && return 1 |
214 |
|
214 |
|
215 |
[[ $2 != "${BOOTLEVEL}" && -e /etc/runlevels/"${BOOTLEVEL}"/.fake ]] && \ |
215 |
[[ $2 != "${BOOTLEVEL}" && -e @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"${BOOTLEVEL}"/.fake ]] && \ |
216 |
fake_services="$( < /etc/runlevels/"${BOOTLEVEL}"/.fake )" |
216 |
fake_services="$( < @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"${BOOTLEVEL}"/.fake )" |
217 |
|
217 |
|
218 |
[[ -e /etc/runlevels/"$2"/.fake ]] && \ |
218 |
[[ -e @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"$2"/.fake ]] && \ |
219 |
fake_services="${fake_services} $( < /etc/runlevels/"$2"/.fake )" |
219 |
fake_services="${fake_services} $( < @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"$2"/.fake )" |
220 |
|
220 |
|
221 |
for x in ${fake_services} ; do |
221 |
for x in ${fake_services} ; do |
222 |
[[ $1 == "${x##*/}" ]] && return 0 |
222 |
[[ $1 == "${x##*/}" ]] && return 0 |
Lines 232-238
Link Here
|
232 |
in_runlevel() { |
232 |
in_runlevel() { |
233 |
[[ -z $1 || -z $2 ]] && return 1 |
233 |
[[ -z $1 || -z $2 ]] && return 1 |
234 |
|
234 |
|
235 |
[[ -L "/etc/runlevels/$2/$1" ]] && return 0 |
235 |
[[ -L "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/$2/$1" ]] && return 0 |
236 |
|
236 |
|
237 |
return 1 |
237 |
return 1 |
238 |
} |
238 |
} |
Lines 385-391
Link Here
|
385 |
local service="$1" |
385 |
local service="$1" |
386 |
[[ -z ${service} ]] && return 1 |
386 |
[[ -z ${service} ]] && return 1 |
387 |
|
387 |
|
388 |
if [[ ! -e "/etc/init.d/${service}" ]] ; then |
388 |
if [[ ! -e "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" ]] ; then |
389 |
mark_service_stopped "${service}" |
389 |
mark_service_stopped "${service}" |
390 |
return 1 |
390 |
return 1 |
391 |
fi |
391 |
fi |
Lines 408-415
Link Here
|
408 |
# if we can not start the services in parallel |
408 |
# if we can not start the services in parallel |
409 |
# then just start it and return the exit status |
409 |
# then just start it and return the exit status |
410 |
( |
410 |
( |
411 |
profiling name "/etc/init.d/${service} start" |
411 |
profiling name "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service} start" |
412 |
"/etc/init.d/${service}" start |
412 |
"@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" start |
413 |
) |
413 |
) |
414 |
|
414 |
|
415 |
service_started "${service}" || service_inactive "${service}" \ |
415 |
service_started "${service}" || service_inactive "${service}" \ |
Lines 423-430
Link Here
|
423 |
else |
423 |
else |
424 |
# if parallel startup is allowed, start it in background |
424 |
# if parallel startup is allowed, start it in background |
425 |
( |
425 |
( |
426 |
profiling name "/etc/init.d/${service} start" |
426 |
profiling name "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service} start" |
427 |
"/etc/init.d/${service}" start |
427 |
"@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" start |
428 |
|
428 |
|
429 |
service_started "${service}" || service_inactive "${service}" \ |
429 |
service_started "${service}" || service_inactive "${service}" \ |
430 |
|| service_scheduled "${service}" |
430 |
|| service_scheduled "${service}" |
Lines 445-451
Link Here
|
445 |
local service="$1" |
445 |
local service="$1" |
446 |
[[ -z ${service} ]] && return 1 |
446 |
[[ -z ${service} ]] && return 1 |
447 |
|
447 |
|
448 |
if [[ ! -e "/etc/init.d/${service}" ]] ; then |
448 |
if [[ ! -e "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" ]] ; then |
449 |
mark_service_stopped "${service}" |
449 |
mark_service_stopped "${service}" |
450 |
return 0 |
450 |
return 0 |
451 |
fi |
451 |
fi |
Lines 470-476
Link Here
|
470 |
${STOP_CRITICAL} == "yes" ]] ; then |
470 |
${STOP_CRITICAL} == "yes" ]] ; then |
471 |
# if we can not start the services in parallel |
471 |
# if we can not start the services in parallel |
472 |
# then just start it and return the exit status |
472 |
# then just start it and return the exit status |
473 |
( "/etc/init.d/${service}" stop ) |
473 |
( "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" stop ) |
474 |
service_stopped "${service}" |
474 |
service_stopped "${service}" |
475 |
retval=$? |
475 |
retval=$? |
476 |
end_service "${service}" "${retval}" |
476 |
end_service "${service}" "${retval}" |
Lines 479-485
Link Here
|
479 |
else |
479 |
else |
480 |
# if parallel startup is allowed, start it in background |
480 |
# if parallel startup is allowed, start it in background |
481 |
( |
481 |
( |
482 |
( "/etc/init.d/${service}" stop ) |
482 |
( "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" stop ) |
483 |
service_stopped "${service}" |
483 |
service_stopped "${service}" |
484 |
retval=$? |
484 |
retval=$? |
485 |
end_service "${service}" "${retval}" |
485 |
end_service "${service}" "${retval}" |
Lines 496-502
Link Here
|
496 |
mark_service_coldplugged() { |
496 |
mark_service_coldplugged() { |
497 |
[[ -z $1 ]] && return 1 |
497 |
[[ -z $1 ]] && return 1 |
498 |
|
498 |
|
499 |
ln -snf "/etc/init.d/$1" "${svcdir}/coldplugged/$1" |
499 |
ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/coldplugged/$1" |
500 |
return 0 |
500 |
return 0 |
501 |
} |
501 |
} |
502 |
|
502 |
|
Lines 507-513
Link Here
|
507 |
mark_service_starting() { |
507 |
mark_service_starting() { |
508 |
[[ -z $1 ]] && return 1 |
508 |
[[ -z $1 ]] && return 1 |
509 |
|
509 |
|
510 |
ln -sn "/etc/init.d/$1" "${svcdir}/starting/$1" 2>/dev/null || return 1 |
510 |
ln -sn "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/starting/$1" 2>/dev/null || return 1 |
511 |
|
511 |
|
512 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
512 |
[[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1" |
513 |
[[ -f "${svcdir}/inactive/$1" ]] \ |
513 |
[[ -f "${svcdir}/inactive/$1" ]] \ |
Lines 522-528
Link Here
|
522 |
mark_service_started() { |
522 |
mark_service_started() { |
523 |
[[ -z $1 ]] && return 1 |
523 |
[[ -z $1 ]] && return 1 |
524 |
|
524 |
|
525 |
ln -snf "/etc/init.d/$1" "${svcdir}/started/$1" |
525 |
ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/started/$1" |
526 |
|
526 |
|
527 |
rm -f "${svcdir}/starting/$1" "${svcdir}/inactive/$1" \ |
527 |
rm -f "${svcdir}/starting/$1" "${svcdir}/inactive/$1" \ |
528 |
"${svcdir}/wasinactive/$1" "${svcdir}/stopping/$1" \ |
528 |
"${svcdir}/wasinactive/$1" "${svcdir}/stopping/$1" \ |
Lines 538-544
Link Here
|
538 |
mark_service_inactive() { |
538 |
mark_service_inactive() { |
539 |
[[ -z $1 ]] && return 1 |
539 |
[[ -z $1 ]] && return 1 |
540 |
|
540 |
|
541 |
ln -snf "/etc/init.d/$1" "${svcdir}/inactive/$1" |
541 |
ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/inactive/$1" |
542 |
|
542 |
|
543 |
rm -f "${svcdir}/started/$1" "${svcdir}/wasinactive/$1" \ |
543 |
rm -f "${svcdir}/started/$1" "${svcdir}/wasinactive/$1" \ |
544 |
"${svcdir}/starting/$1" "${svcdir}/stopping/$1" |
544 |
"${svcdir}/starting/$1" "${svcdir}/stopping/$1" |
Lines 553-559
Link Here
|
553 |
mark_service_stopping() { |
553 |
mark_service_stopping() { |
554 |
[[ -z $1 ]] && return 1 |
554 |
[[ -z $1 ]] && return 1 |
555 |
|
555 |
|
556 |
ln -sn "/etc/init.d/$1" "${svcdir}/stopping/$1" 2>/dev/null || return 1 |
556 |
ln -sn "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/stopping/$1" 2>/dev/null || return 1 |
557 |
|
557 |
|
558 |
rm -f "${svcdir}/started/$1" |
558 |
rm -f "${svcdir}/started/$1" |
559 |
[[ -f "${svcdir}/inactive/$1" ]] \ |
559 |
[[ -f "${svcdir}/inactive/$1" ]] \ |
Lines 690-696
Link Here
|
690 |
mark_service_failed() { |
691 |
mark_service_failed() { |
691 |
[[ -z $1 || ! -d "${svcdir}/failed" ]] && return 1 |
692 |
[[ -z $1 || ! -d "${svcdir}/failed" ]] && return 1 |
692 |
|
693 |
|
693 |
ln -snf "/etc/init.d/$1" "${svcdir}/failed/$1" |
694 |
ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/failed/$1" |
694 |
} |
695 |
} |
695 |
|
696 |
|
696 |
# bool service_failed(service) |
697 |
# bool service_failed(service) |
Lines 744-751
Link Here
|
744 |
return $? |
745 |
return $? |
745 |
;; |
746 |
;; |
746 |
yes) |
747 |
yes) |
747 |
for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \ |
748 |
for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \ |
748 |
$(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") ; do |
749 |
$(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${SOFTLEVEL}/net.*") ; do |
749 |
local y="${x##*/}" |
750 |
local y="${x##*/}" |
750 |
[[ ${y} == "$1" ]] && return 1 |
751 |
[[ ${y} == "$1" ]] && return 1 |
751 |
service_started "${y}" || return 1 |
752 |
service_started "${y}" || return 1 |
Lines 785-792
Link Here
|
785 |
[[ -f "${svcdir}/softlevel" ]] && mylevel=$( < "${svcdir}/softlevel" ) |
786 |
[[ -f "${svcdir}/softlevel" ]] && mylevel=$( < "${svcdir}/softlevel" ) |
786 |
|
787 |
|
787 |
for x in $( i$1 "$2" ) ; do |
788 |
for x in $( i$1 "$2" ) ; do |
788 |
[[ -e "/etc/runlevels/${BOOTLEVEL}/${x}" || \ |
789 |
[[ -e "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/${x}" || \ |
789 |
-e "/etc/runlevels/${mylevel}/${x}" || \ |
790 |
-e "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${mylevel}/${x}" || \ |
790 |
${x} == "net" ]] \ |
791 |
${x} == "net" ]] \ |
791 |
&& valid="${valid} ${x}" |
792 |
&& valid="${valid} ${x}" |
792 |
done |
793 |
done |
Lines 836-844
Link Here
|
836 |
net_services="${net_services} ${x##*/}" |
837 |
net_services="${net_services} ${x##*/}" |
837 |
done |
838 |
done |
838 |
else |
839 |
else |
839 |
for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \ |
840 |
for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \ |
840 |
$(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") \ |
841 |
$(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${SOFTLEVEL}/net.*") \ |
841 |
$(dolisting "/etc/runlevels/coldplugged/net.*") ; do |
842 |
$(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/coldplugged/net.*") ; do |
842 |
net_services="${net_services} ${x##*/}" |
843 |
net_services="${net_services} ${x##*/}" |
843 |
done |
844 |
done |
844 |
fi |
845 |
fi |