Changeset 23110


Ignore:
Timestamp:
2010-09-23T15:58:05+02:00 (6 years ago)
Author:
cshore
Message:

[package] base/block-extroot, base/block-mount: Modified preinit and block-extroot and
block-mount so that use of block-mount and block-extroot do not require that block-extroot,
block-mount, nor the kernel modules they depend, on are required to included in the image.
That is block-extroot and dependencies may now be installed as modules onto the jffs2 part of
a squashfs system and it will work.
In addition packages which are installed into the jffs2 of a squashfs system may now affect
preinit, so long as they do not require execution of commands that occur before the merging of
the jffs2 and built-in (squashfs) preinit scripts is done.

Thanks jow for the preinit merge stuff!

Location:
trunk/package
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/etc/functions.sh

    r23087 r23110  
    293293} 
    294294 
     295 
     296pi_include() { 
     297        if [ -f "/tmp/overlay/$1" ]; then 
     298                . "/tmp/overlay/$1" 
     299        elif [ -f "$1" ]; then 
     300                . "$1" 
     301        elif [ -d "/tmp/overlay/$1" ]; then 
     302                for src_script in /tmp/overlay/$1/*.sh; do 
     303                        . "$src_script" 
     304                done 
     305        elif [ -d "$1" ]; then 
     306                for src_script in $1/*.sh; do 
     307                        . "$src_script" 
     308                done 
     309        else 
     310                echo "WARNING: $1 not found" 
     311                return 1 
     312        fi 
     313        return 0 
     314} 
     315 
    295316[ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh 
  • trunk/package/base-files/files/etc/preinit

    r20124 r23110  
    55export PATH=/bin:/sbin:/usr/bin:/usr/sbin 
    66. /etc/diag.sh 
    7  
    8 preinit_essential_hook= 
    9 preinit_main_hook= 
    10 failsafe_hook= 
    11 initramfs_hook= 
    12 preinit_mount_root_hook= 
    137 
    148pi_ifname= 
     
    2923pi_init_cmd="/sbin/init" 
    3024 
     25. /etc/functions.sh 
    3126. /lib/functions/boot.sh 
    3227 
     28boot_hook_init preinit_essential 
     29boot_hook_init preinit_main 
     30boot_hook_init failsafe 
     31boot_hook_init initramfs 
     32boot_hook_init preinit_mount_root 
    3333 
    3434for pi_source_file in /lib/preinit/*; do 
  • trunk/package/base-files/files/lib/functions/boot.sh

    r23099 r23110  
    77} 
    88 
     9boot_hook_splice_start() { 
     10        export -n PI_HOOK_SPLICE=1 
     11} 
     12 
     13boot_hook_splice_finish() { 
     14        local hook 
     15        for hook in $PI_STACK_LIST; do 
     16                local v; eval "v=\${${hook}_splice:+\$${hook}_splice }$hook" 
     17                export -n "${hook}=${v% }" 
     18                export -n "${hook}_splice=" 
     19        done 
     20        export -n PI_HOOK_SPLICE= 
     21} 
     22 
     23boot_hook_init() { 
     24        local hook="${1}_hook" 
     25        export -n "PI_STACK_LIST=${PI_STACK_LIST:+$PI_STACK_LIST }$hook" 
     26        export -n "$hook=" 
     27} 
     28 
    929boot_hook_add() { 
    10         local hook="${1}_hook" 
    11         local value="$2" 
    12         local sep=" " 
    13          
    14         eval "$hook=\"\${$hook:+\${$hook}\${value:+\$sep}}\$value\"" 
     30        local hook="${1}_hook${PI_HOOK_SPLICE:+_splice}" 
     31        local func="${2}" 
     32 
     33        [ -n "$func" ] && { 
     34                local v; eval "v=\$$hook" 
     35                export -n "$hook=${v:+$v }$func" 
     36        } 
     37} 
     38 
     39boot_hook_shift() { 
     40        local hook="${1}_hook" 
     41        local rvar="${2}" 
     42 
     43        local v; eval "v=\$$hook" 
     44        [ -n "$v" ] && { 
     45                local first="${v%% *}" 
     46 
     47                [ "$v" != "${v#* }" ] && \ 
     48                        export -n "$hook=${v#* }" || \ 
     49                        export -n "$hook=" 
     50 
     51                export -n "$rvar=$first" 
     52                return 0 
     53        } 
     54 
     55        return 1 
    1556} 
    1657 
    1758boot_run_hook() { 
    18     local boot_func 
    19     for boot_func in $(eval "echo \"\$${1}_hook\""); do 
    20         $boot_func "$1" "$2" 
    21     done 
     59        local hook="$1" 
     60        local func 
     61 
     62        while boot_hook_shift "$hook" func; do 
     63                local ran; eval "ran=\$PI_RAN_$func" 
     64                [ -n "$ran" ] || { 
     65                        export -n "PI_RAN_$func=1" 
     66                        $func "$1" "$2" 
     67                } 
     68        done 
    2269} 
    2370 
     
    100147} 
    101148 
    102 pi_include() { 
    103         if [ -f "/tmp/overlay/$1" ]; then 
    104                 . "/tmp/overlay/$1" 
    105         elif [ -f "$1" ]; then 
    106                 . "$1" 
    107         else 
    108                 echo "WARNING: $1 not found" 
    109                 return 1 
    110         fi 
    111         return 0 
    112 } 
    113  
  • trunk/package/block-extroot/files/50_determine_usb_root

    r22002 r23110  
    66 
    77determine_external_root() { 
    8         . /etc/functions.sh 
    9         . /lib/functions/extmount.sh 
    10         . /lib/functions/mount.sh 
     8        pi_include /lib/functions/extmount.sh 
     9        pi_include /lib/functions/mount.sh 
    1110 
    1211        local OLD_UCI_CONFIG_DIR="$UCI_CONFIG_DIR" 
  • trunk/package/block-extroot/files/extmount.sh

    r19880 r23110  
    1414 
    1515er_load_modules() { 
    16         [ -d $ER_ROOT/etc/modules.d ] && { 
    17             cd $ER_ROOT/etc/modules.d && { 
    18                 local modules="$(grep -l '# May be required for rootfs' *)" 
    19                 cat $modules | sed 's/^\([^#]\)/insmod \1/' | sh 2>&- || :  
    20             } 
     16        mkdir -p /tmp/extroot_modules/modules.d 
     17        mkdir -p /tmp/extroot_modules/modules 
     18        ln -sf /etc/modules.d/* /tmp/overlay/etc/modules.d/* /tmp/extroot_modules/modules.d 
     19        ln -sf /lib/modules/*/* /tmp/overlay/lib/modules/*/* /tmp/extroot_modules/modules 
     20        local modules="$(grep -l '# May be required for rootfs' /tmp/extroot_modules/modules.d/*)" 
     21        cd /tmp/extroot_modules/modules && { 
     22                cat $modules | sed -e 's/^\([^#].*\)/insmod \.\/\1.ko/'| sh 2>&- || : 
    2123        } 
     24        rm -rf /tmp/extroot_modules 
    2225} 
    2326 
    24  
  • trunk/package/block-mount/files/fsck.sh

    r22002 r23110  
    3131libmount_known_fsck="" 
    3232 
    33 include /lib/functions/fsck 
     33pi_include /lib/functions/fsck 
    3434 
  • trunk/package/block-mount/files/mount.sh

    r22002 r23110  
    66 
    77 
    8 . /lib/functions/block.sh 
    9 . /lib/functions/fsck.sh 
     8pi_include /lib/functions/block.sh 
     9pi_include /lib/functions/fsck.sh 
    1010 
    1111config_mount_by_section() { 
Note: See TracChangeset for help on using the changeset viewer.