Ignore:
Timestamp:
Dec 28, 2008, 2:56:18 AM (16 years ago)
Author:
price
Message:

config-init.sh: degrade to non-bash gracefully

Location:
trunk/packages/invirt-base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-base/debian/changelog

    r1926 r1928  
    22
    33  * run_parts_list: fix unclear docstring
     4  * config-init.sh: degrade to non-bash gracefully
    45
    56 -- Greg Price <price@mit.edu>  Sun, 28 Dec 2008 01:00:07 -0500
  • trunk/packages/invirt-base/files/lib/init/config-init.sh

    r1445 r1928  
    11# For a package which only configures another, "parent" package.
    22#
    3 # Global variable PARENTPACKAGE names parent; may be array
    4 # for zero or many parents.
     3# Global variable PARENTPACKAGE names parent; unset for no parent,
     4# array for (zero or one or) many parents.
    55#
    66# Global variable PACKAGE names this package, for log message.
    77#
    8 # Requires bash.
     8# If BASH_VERSION is null or unset, accepts only one parent in
     9# PARENTPACKAGE, or empty for zero.
    910
    1011. /lib/init/vars.sh
    1112. /lib/lsb/init-functions
    1213. /lib/init/gen-files.sh
     14
     15if [ $BASH_VERSION ]; then
     16  handle_parents () {
     17    for p in "${PARENTPACKAGE[@]}"; do
     18      invoke-rc.d "$p" "$1"
     19    done
     20  }
     21else
     22  handle_parents () {
     23    if [ -n "$PARENTPACKAGE" ]; then
     24      invoke-rc.d "$PARENTPACKAGE" "$1"
     25    fi
     26  }
     27fi
    1328
    1429config_init () {
     
    1833      gen_files
    1934      log_end_msg $?
    20       for p in "${PARENTPACKAGE[@]}"; do
    21         invoke-rc.d "$p" "$1"
    22       done
     35      handle_parents "$1"
    2336      ;;
    2437    stop)
    25       for p in "${PARENTPACKAGE[@]}"; do
    26         invoke-rc.d "$p" "$1"
    27       done
     38      handle_parents "$1"
    2839      ;;
    2940    *)
Note: See TracChangeset for help on using the changeset viewer.