diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.vserver | 10 | ||||
-rwxr-xr-x | bin/rc-status | 8 | ||||
-rwxr-xr-x | sbin/functions.sh | 25 | ||||
-rwxr-xr-x | sbin/rc-services.sh | 70 |
5 files changed, 57 insertions, 63 deletions
@@ -1,6 +1,10 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 + 08 Nov 2005; Roy Marples <uberlord@gentoo.org>: + + punted serial from rc-lists/boot as it's no longer provided by baselayout + 07 Nov 2005; Roy Marples <uberlord@gentoo.org>: documented pppd module settings, #53954 @@ -8,6 +12,9 @@ rc-status now warns about broken symbolic links in /etc/runlevels and trace_dependencies got a bit of a revamp, attempts to fix #104394 + Always setup_defaultlevels as we need the default vars set for + rc-status. + 04 Nov 2005; Roy Marples <uberlord@gentoo.org>: udhcpc now checks the dhcp lease file for a valid IP address. diff --git a/ChangeLog.vserver b/ChangeLog.vserver index 4a78a97..0d1e0c8 100644 --- a/ChangeLog.vserver +++ b/ChangeLog.vserver @@ -1,6 +1,16 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 + 08 Nov 2005; Christian Heim <phreak@gentoo.org>: + Merging uberlord's latest changes of baselayout (r1604). + + ChangeLog | 7 +++++ + ChangeLog.vserver | 10 +++++++ + bin/rc-status | 8 ++--- + sbin/functions.sh | 25 +++++++++--------- + sbin/rc-services.sh | 70 +++++++++++++++++----------------------------------- + 4 files changed, 47 insertions(+), 63 deletions(-) + 07 Nov 2005; Christian Heim <phreak@gentoo.org>: Merging uberlord's latest changes of baselayout (r1599). diff --git a/bin/rc-status b/bin/rc-status index 81b09eb..7aba912 100755 --- a/bin/rc-status +++ b/bin/rc-status @@ -197,7 +197,7 @@ fi if [[ -f "/etc/runlevels/${BOOTLEVEL}/.critical" ]]; then boot_crit= - for x in $(< /etc/runlevels/${BOOTLEVEL}/.critical); do + for x in $(< "/etc/runlevels/${BOOTLEVEL}/.critical"); do boot_crit="${boot_crit} ${x##*/}" done else @@ -207,10 +207,10 @@ fi for level in ${runlevelidxs} ; do echo "Runlevel: ${HILITE}${level}${NORMAL}" for service in ${runlevels[${arridx}]} ; do - if [[ ! -e ${runleveldir}/${level}/${service} \ + if [[ ! -e "${runleveldir}/${level}/${service}" \ && ${level} != "UNASSIGNED" \ - && ${level} != "${BOOTLEVEL}" \ - && " ${boot_crit} " != *" ${service} " ]]; then + ]] && [[ ${level} != "${BOOTLEVEL}" \ + || " ${boot_crit} " != *" ${service} "* ]]; then print_msg "${service}" "${BAD}" 'broken ' elif [[ -n ${inactive} && $(in_list "${inactive}" "${service}") -eq 1 ]] ; then print_msg "${service}" "${WARN}" 'inactive' diff --git a/sbin/functions.sh b/sbin/functions.sh index e301d67..ab39a45 100755 --- a/sbin/functions.sh +++ b/sbin/functions.sh @@ -51,7 +51,7 @@ RC_DOT_PATTERN='' # Import code from the specified addon if it exists # import_addon() { - local addon=${svclib}/addons/$1 + local addon="${svclib}/addons/$1" if [[ -r ${addon} ]] ; then source "${addon}" return 0 @@ -116,7 +116,7 @@ setup_defaultlevels() { # get_libdir() { if [[ -n ${CONF_LIBDIR_OVERRIDE} ]] ; then - CONF_LIBDIR=${CONF_LIBDIR_OVERRIDE} + CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" elif [[ -x /usr/bin/portageq ]] ; then CONF_LIBDIR=$(/usr/bin/portageq envvar CONF_LIBDIR) fi @@ -132,8 +132,8 @@ esyslog() { local tag= if [[ -x /usr/bin/logger ]] ; then - pri=$1 - tag=$2 + pri="$1" + tag="$2" shift 2 [[ -z "$*" ]] && return 0 @@ -149,7 +149,7 @@ esyslog() { # increase the indent used for e-commands. # eindent() { - local i=$1 + local i="$1" (( i > 0 )) || (( i = RC_DEFAULT_INDENT )) esetdent $(( ${#RC_INDENTATION} + i )) } @@ -159,7 +159,7 @@ eindent() { # decrease the indent used for e-commands. # eoutdent() { - local i=$1 + local i="$1" (( i > 0 )) || (( i = RC_DEFAULT_INDENT )) esetdent $(( ${#RC_INDENTATION} - i )) } @@ -170,7 +170,7 @@ eoutdent() { # num defaults to 0 # esetdent() { - local i=$1 + local i="$1" (( i < 0 )) && (( i = 0 )) RC_INDENTATION=$(printf "%${i}s" '') } @@ -466,10 +466,10 @@ dolisting() { # save the settings ("optstring") for "option" # save_options() { - local myopts=$1 + local myopts="$1" shift - if [[ ! -d ${svcdir}/options/${myservice} ]] ; then + if [[ ! -d "${svcdir}/options/${myservice}" ]] ; then mkdir -p -m 0755 "${svcdir}/options/${myservice}" fi @@ -484,7 +484,7 @@ save_options() { # by calling the save_options function # get_options() { - if [[ -f ${svcdir}/options/${myservice}/$1 ]] ; then + if [[ -f "${svcdir}/options/${myservice}/$1" ]] ; then echo "$(< ${svcdir}/options/${myservice}/$1)" fi @@ -586,7 +586,7 @@ reverse_list() { # Starts addon. # start_addon() { - local addon=$1 + local addon="$1" (import_addon "${addon}-start.sh") return 0 } @@ -629,7 +629,7 @@ is_older_than() { shift for x in "$@" ; do - [[ ${x} -nt ${ref} ]] && return 0 + [[ ${x} -nt "${ref}" ]] && return 0 if [[ -d ${x} ]] ; then is_older_than "${ref}" "${x}"/* && return 0 @@ -699,6 +699,7 @@ if [[ -z ${EBUILD} ]] ; then setup_defaultlevels else + setup_defaultlevels # Should we use colors ? if [[ $* != *depend* ]] ; then # Check user pref in portage diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh index b7e6043..a592a7e 100755 --- a/sbin/rc-services.sh +++ b/sbin/rc-services.sh @@ -742,69 +742,45 @@ trace_dependencies() { local x="${x} $( get_net_services "${mylevel}" )" [[ -n ${x} ]] && net_services="${x}" fi - - local -a visited - for (( i=0; i<${#services[@]}; i++)); do - [[ ${visited[@]} == *" ${services[i]} "* ]] && continue + + # OK, this is a topological sort + # The bonus about doing it in bash is that we can calculate our sort + # order as we calculate our dependencies + local -a visited sorted + visit_service() { + local service="$1" dep + local -a deps + + [[ " ${visited[@]} " == *" ${service} "* ]] && return + visited=( "${visited[@]}" "${service}" ) + if [[ -n ${deptype} ]] ; then - deps=( "${deps[@]}" $( "${deptype}" "${services[i]}" ) ) + deps=( "${deps[@]}" $( "${deptype}" "${service}" ) ) else deps=( - $( ineed "${services[i]}" ) - $( valid_iuse "${services[i]}" ) + $( ineed "${service}" ) + $( valid_iuse "${service}" ) ) if is_runlevel_start || is_runlevel_stop ; then - deps=( "${deps[@]}" $( valid_iafter "${services[i]}" ) ) + deps=( "${deps[@]}" $( valid_iafter "${service}" ) ) fi local x=" ${deps[@]} " deps=( ${x// net / ${net_services} } ) fi - services=( "${services[@]}" "${deps[@]}" ) - visited=( "${visited[@]}" "${services[i]}" ) - done - - # Now, we sort our services - # When a service is first visited, we mark it dead and then - # revisit any dependencies. Finally we add ourselves to the sorted list. - # This should never get into an infinite loop, thanks to our dead array. - local -a dead=() deadname=() sorted=() - for (( i=0; i<${#services[@]}; i++ )); do - dead[i]="false"; - deadname[i]="${services[i]}" - done - - after_visit() { - local service="$1" i - - for (( i=0; i<${#deadname[@]}; i++)); do - [[ ${service} == ${deadname[i]} ]] && break - done - ${dead[i]} && return - dead[i]="true" - - local x deps=" $( ineed ${service} ) $( valid_iuse ${service} ) " - if is_runlevel_start || is_runlevel_stop ; then - deps="${deps} $( valid_iafter ${service} ) " - fi - - if [[ -z ${deptype} ]] ; then - # If its a net service, just replace it with 'net' - deps="${deps// net / ${net_services} }" - fi - - for x in ${deps}; do - after_visit "${x}" + services=( "${services[@]}" "${deps[@]}" ) + for dep in ${deps[@]}; do + visit_service "${dep}" done - sorted=( "${sorted[@]}" "${service}" ) } - - for (( i=0; i<${#services[*]}; i++ )); do - after_visit "${services[i]}" + + for (( i=0; i<${#services[@]}; i++)); do + visit_service "${services[i]}" done + services=( "${sorted[@]}" ) if [[ -n ${deptype} ]] ; then |