slitaz-modular diff initramfs/usr/bin/activate @ rev 54

Fixed off option when tazpanel is release. Made sure MAIN_WWW_DIR/slitaz links to /var/www/slitaz. Add slitaz-modular soft link to COOKING folder for new slitaz-modular script.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Apr 10 12:44:31 2011 +0000 (2011-04-10)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/initramfs/usr/bin/activate	Sun Apr 10 12:44:31 2011 +0000
     1.3 @@ -0,0 +1,72 @@
     1.4 +#!/bin/bash
     1.5 +# Activate a module, while running LiveCD.
     1.6 +# Include it into live directory structure on the fly
     1.7 +#
     1.8 +# Author: Tomas M. <http://www.linux-live.org>
     1.9 +
    1.10 +
    1.11 +
    1.12 +MODULE=$(readlink -f "$1")
    1.13 +
    1.14 +if [ "$MODULE" = "" -o ! -e "$MODULE" -o -d "$MODULE" ]; then
    1.15 +   echo
    1.16 +   echo "Activate a module on the fly while running Linux Live"
    1.17 +   echo "Usage: $0 module.lzm"
    1.18 +   exit 1
    1.19 +fi
    1.20 +
    1.21 +if [ "$(echo $MODULE | fgrep -i .lzm || fgrep -i .xz)" = "" ]; then
    1.22 +   echo
    1.23 +   echo "$(basename $MODULE): Module must end with .lzm"
    1.24 +   exit 2
    1.25 +fi
    1.26 +
    1.27 +PATH=.:$(dirname $0):/usr/lib:$PATH
    1.28 +. liblinuxlive || exit 3
    1.29 +
    1.30 +allow_only_root
    1.31 +IMAGES=/mnt/live/memory/images
    1.32 +MODULES=/mnt/live/memory/modules
    1.33 +
    1.34 +# are we even using union?
    1.35 +if [ "$(grep '^aufs / ' /proc/mounts)" = "" ]; then
    1.36 +   echo "not in the live mode, can't continue. Try lzm2dir $MODULE /"
    1.37 +   exit 4
    1.38 +fi
    1.39 +
    1.40 +mkdir -p "$MODULES"
    1.41 +
    1.42 +# Test whether the module file is stored in union
    1.43 +# if yes, then we must move it somewhere else (to RAM) else it can't be added
    1.44 +if [ -e "/mnt/live/memory/changes/$(readlink -f "$MODULE")" ]; then
    1.45 +   echo "module file is stored inside the union, moving to $MODULES first..."
    1.46 +   TARGET="$MODULES/$(basename "$MODULE")"
    1.47 +   mv "$MODULE" "$TARGET"
    1.48 +   if [ $? -ne 0 ]; then
    1.49 +      echo "error copying module to memory, not enough free RAM? try df" >&2
    1.50 +      rm "$TARGET"
    1.51 +      exit 6
    1.52 +   fi
    1.53 +   MODULE="$TARGET"
    1.54 +fi
    1.55 +
    1.56 +MOD=$(union_insert_module / "$MODULE" $IMAGES)
    1.57 +if [ $? -ne 0 ]; then echo "error inserting module to live filesystem" >&2; exit 3; fi
    1.58 +
    1.59 +# All executables (but symlinks) in /etc/rc.d/init.d/ from this module will be started
    1.60 +# with two arguments: "start" "activate".
    1.61 +# This is done only by the 'activate' script, not in the case when the module is loaded 
    1.62 +# during OS startup (in that case, your distro is responsible for execution)
    1.63 +#
    1.64 +# For compatibility, /etc/init.d is also examined, but it's not recommended for you to put your startup scripts
    1.65 +# there in your module
    1.66 +
    1.67 +MOD="$IMAGES/$(basename $MOD)"
    1.68 +
    1.69 +find_n_run_scripts $MOD start activate
    1.70 +
    1.71 +# update ld cache if new ld.so.conf/cache exists in the module
    1.72 +if [ -e "$MOD/etc/ld.so.conf" -o -e "$MOD/etc/ld.so.cache" ]; then
    1.73 +   echo "Module contains ld.so.conf or ld.so.cache, updating libs cache..."
    1.74 +   /sbin/ldconfig
    1.75 +fi