home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / tools / uselivemod < prev   
Encoding:
Text File  |  2005-07-18  |  1.0 KB  |  38 lines

  1. #!/bin/bash
  2. # Use module while running LiveCD
  3. # include it into live directory structure on the fly
  4. # Author: Tomas M. <http://www.linux-live.org>
  5. #
  6.  
  7. if [ "$1" = "" ]; then
  8.    echo
  9.    echo "Use module on the fly while running Live CD"
  10.    echo "Usage: $0 module.mo"
  11.    exit
  12. fi
  13.  
  14. if [ -a ./liblinuxlive ]; then
  15.    . ./liblinuxlive
  16. else
  17.    . /usr/lib/liblinuxlive || exit 1
  18. fi
  19.  
  20. allow_only_root
  21. IMAGES=/mnt/live/memory/images
  22.  
  23. # unionfs must be compiled with -DSETUP_BROKEN_LOSETUP=1 else this won't work!
  24. MOD="`union_insert_module / \"$1\" $IMAGES`"
  25. if [ $? -ne 0 ]; then echo "error inserting module to live filesystem" >&2; exit 1; fi
  26.  
  27. # all executables in /etc/rc.d/ from this module will be started
  28. # with two arguments: start mo. This happens only by this script (uselivemod),
  29. # not in the case when module is loaded during OS startup.
  30. find $IMAGES/$MOD/etc/rc.d -type f 2>/dev/null | while read SCRIPT; do
  31.    if [ "$SCRIPT" != "" -a -x "$SCRIPT" -a ! -d "$SCRIPT" ]; then
  32.       ${SETUP##$IMAGES/$MOD} start mo
  33.    fi
  34. done
  35.  
  36. # update ld cache
  37. /sbin/ldconfig
  38.