Ignore:
Timestamp:
Mar 16, 2007 2:05:30 AM (6 years ago)
Author:
jrollins
Message:

debirf: a couple of pretty big changes/simplifications.

condensed plugins into a single phase. it was silly to have 2 phases that ran
back-to-back, when the plugins are already run by run-parts in a particular
order.

broke out some shell functions to a /usr/share/debirf/common file that will be
sourced and therefore available to all plugins. (can we explode
setup_debirf_info function now?)

updated man page. included plugins section and section on pre-defined functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debirf/fs/usr/sbin/make-debirf

    r369 r370  
    2727DEBIRF_DISTRO=${DEBIRF_DISTRO:-"etch"} 
    2828 
     29DEBIRF_COMMON="/usr/share/debirf/common" 
     30 
    2931# set locale default 
    3032export LC_CTYPE="C" 
     
    4749} 
    4850 
    49 failure() { 
    50     echo "$1" >&2 
    51     exit ${2:-'1'} 
    52 } 
    53 export -f failure 
    54  
    55 msg() { 
    56     echo " debirf: $@" 
    57 } 
    58 export -f msg 
    59  
    60 setup_debirf_info() { 
    61     export DEBIRF_INFO_TARGET="${DEBIRF_ROOT}/etc/debirf/debirf.info" 
    62     mkdir -p $(dirname "$DEBIRF_INFO_TARGET") 
    63  
    64     cat > "$DEBIRF_INFO_TARGET" <<EOF 
    65 #!/bin/sh 
    66 # this debirf initramfs was generated on $(hostname) 
    67 # at $(date -R) 
    68  
    69 EOF 
    70     debirf_info_comment() { 
    71         echo "$@" | sed 's|^\(.\)|\# \1|' >> "$DEBIRF_INFO_TARGET" 
    72     } 
    73     debirf_info_sh() { 
    74         echo "$@" >> "$DEBIRF_INFO_TARGET" 
    75     } 
    76     export -f debirf_info_comment 
    77     export -f debirf_info_sh 
    78 } 
    79  
    8051create_debootstrap() { 
    8152    # include initramfs-tools because they'll be handy 
     
    8556} 
    8657 
    87 run_plugins_install() { 
     58run_plugins() { 
    8859    # export all the DEBIRF_* environment variables: 
    8960    for var in ${!DEBIRF_*}; do 
    9061        export $var 
    9162    done 
    92     run-parts --verbose "$DEBIRF_PLUGINS/install" 
    93 } 
    94  
    95 run_plugins_prune() { 
    96     # export all the DEBIRF_* environment variables: 
    97     for var in ${!DEBIRF_*}; do 
    98         export $var 
    99     done 
    100     run-parts --verbose "$DEBIRF_PLUGINS/prune" 
     63    run-parts --verbose "$DEBIRF_PLUGINS" 
    10164} 
    10265 
     
    150113fi 
    151114 
     115# check for common functions 
     116[ -f "$DEBIRF_COMMON" ] || debirf_fail "debirf function file $DEBIRF_COMMON not found." 
     117source "$DEBIRF_COMMON" 
     118 
    152119# check plugin directory exists 
    153120if [ ! -d "$DEBIRF_PLUGINS" ] ; then 
    154121    read -p "Plugin directory $DEBIRF_PLUGINS not found.  Continue? [y|N]: " -n 1 OK ; [ -z $OK ] || echo 
    155122    if [ "${OK/y/Y}" != 'Y' ] ; then 
    156         failure "aborting." 
     123        debirf_fail "aborting." 
    157124    fi 
    158125fi 
     
    179146 
    180147# update apt 
    181 chroot "$DEBIRF_ROOT" apt-get update 
     148debirf_exec apt-get update 
    182149 
    183 # run plugins/install 
    184 msg "running install plugins..." 
    185 run_plugins_install 
    186  
    187 # run plugins/prune 
    188 msg "running prune plugins..." 
    189 run_plugins_prune 
     150# install plugins 
     151msg "installing plugins..." 
     152run_plugins 
    190153 
    191154# umount sys,proc 
Note: See TracChangeset for help on using the changeset viewer.