/[baselayout]/branches/bsd-porting-2/sbin/rc-services.sh
Gentoo

Diff of /branches/bsd-porting-2/sbin/rc-services.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2019 Revision 2020
723# string trace_dependencies(service[s]) 723# string trace_dependencies(service[s])
724# 724#
725# Get and sort the dependencies of given service[s]. 725# Get and sort the dependencies of given service[s].
726# 726#
727trace_dependencies() { 727trace_dependencies() {
728 local -a services=( "$@" ) net_deps 728 local -a services=( "$@" ) net_deps=()
729 local i j net_services x 729 local i= j= net_services= x=
730 730
731 if [[ $1 == -* ]]; then 731 if [[ $1 == -* ]]; then
732 deptype="${1/-/}" 732 deptype="${1/-/}"
733 if net_service "${myservice}" ; then 733 if net_service "${SVCNAME}" ; then
734 services=( "net" "${myservice}" ) 734 services=( "net" "${SVCNAME}" )
735 else 735 else
736 services=( "${myservice}" ) 736 services=( "${SVCNAME}" )
737 fi 737 fi
738 fi 738 fi
739 739
740 net_services="$( cd "${svcdir}"/started; ls net.* 2>/dev/null )" 740 if is_runlevel_stop ; then
741 # If no net services are running or we only have net.lo up, then 741 for x in $(dolisting "${svcdir}/started/net.*") \
742 # assume we are in boot runlevel or starting a new runlevel 742 $(dolisting "${svcdir}/inactive/net.*") ; do
743 if [[ -z ${net_services} || ${net_services} == "net.lo" ]]; then 743 net_services="${net_services} ${x##*/}"
744 get_net_services() { 744 done
745 local runlevel="$1" 745 elif is_runlevel_start || ! is_net_up ; then
746 746 for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \
747 if [[ -d "/etc/runlevels/${runlevel}" ]] ; then 747 $(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") ; do
748 cd "/etc/runlevels/${runlevel}" 748 net_services="${net_services} ${x##*/}"
749 ls net.* 2>/dev/null 749 done
750 fi
751 }
752
753 local mylevel="${BOOTLEVEL}"
754 local x="$( get_net_services "${mylevel}" )"
755
756 [[ -f "${svcdir}/softlevel" ]] && mylevel="$( < "${svcdir}/softlevel" )"
757 [[ ${BOOTLEVEL} != "${mylevel}" ]] && \
758 local x="${x} $( get_net_services "${mylevel}" )"
759 [[ -n ${x} ]] && net_services="${x}"
760 fi 750 fi
761 751
762 # Cache the generic "net" depends 752 # Cache the generic "net" depends
763 net_deps=( $( ineed net ) $( valid_iuse net ) ) 753 net_deps=( $( ineed net ) $( valid_iuse net ) )
764 if is_runlevel_start || is_runlevel_stop ; then 754 if is_runlevel_start || is_runlevel_stop ; then
806 services=( "${sorted[@]}" ) 796 services=( "${sorted[@]}" )
807 797
808 if [[ -n ${deptype} ]] ; then 798 if [[ -n ${deptype} ]] ; then
809 # If deptype is set, we do not want the name of this service 799 # If deptype is set, we do not want the name of this service
810 x=" ${services[@]} " 800 x=" ${services[@]} "
811 services=( ${x// ${myservice} / } ) 801 services=( ${x// ${SVCNAME} / } )
812 802
813 # If its a net service, do not include "net" 803 # If its a net service, do not include "net"
814 if net_service "${myservice}" ; then 804 if net_service "${SVCNAME}" ; then
815 x=" ${services[@]} " 805 x=" ${services[@]} "
816 sorted=( ${services// net / } ) 806 sorted=( ${services// net / } )
817 fi 807 fi
818 fi 808 fi
819 809

Legend:
Removed from v.2019  
changed lines
  Added in v.2020

  ViewVC Help
Powered by ViewVC 1.1.20