Me olvidaba de una cosa:
Ese script es procesado por este otro que viene como ejecutable del sistema

===============================================

#!/bin/sh
#

. /etc/colors
. /etc/system.cfg
. /etc/live.cfg
. /etc/chat.pwd

E=echo
help()  { cat <<~~
Usage: pkg CMD ARGs

CMD:    -c      Check URL for available packages list.
        -i      Install package from URL or DIR.
        -r      Install package from URL or DIR onto ramdisk!!!
                The -r option runs without any questions.
        -u      Uninstall package NAME.
        -l      Show list and descriptions of installed packages.
        -s      Download package from URL and save in DIR.

URL:    http://www.dom          use given http or
        ftp://ftp.dom           or ftp site
        /dir/file               use local disk
        -/                      alias for http://default-web-site/
Examples:
        pkg -c -/                       # Get packages list from default site
        pkg -c ftp://my.ftp.dom/pub/    # Get packages list from ftp server
        pkg -i -/mc                     # Install mc from home site
        pkg -i http://www.dom/mc        # Install mc from http server
        pkg -i /mnt/hd/dir/mc           # Install mc from /mnt/hd/dir
        pkg -u mc                       # Uninstall mc
        pkg -s -/mc /mnt/hd/dir         # Download mc from home site and save
                                        # in /mnt/hd/dir.
        pkg -s http://www.dom/mc        # Download from www.dom and save in
                                        # the default save directory.
~~
}

depchk()        {       $E $TMP |sed -n /$i/P
}

OLDD=`pwd`
cd /

if [ "$BOOTDEV" =  fd -o "$BOOTDEV" = ram1  ]; then
        TMPD=/tmp/$$~
else
        TMPD=/boot/$$~
fi

ask()   { $E -n "$1? "; t=""; read t; }
msg()   { $E "$*"; }
quit() {
        [ $1 ] || msg "${CY}Installation aborted, removing temp files...$CW"
        rm -rf $TMPD
        cd $OLDD
        msg
        trap - 2
        sync
        exit ${1:-2}
}
url()   {
        PNAME=`basename $1`
        URL=`dirname $1`
        if [ "$URL" = -/ ]; then URL="$PKGDOMAIN"; fi
        if [ "`$E $URL | sed -n /:/P`" ]; then LOCAL=n; else LOCAL=y; fi
        }
dlf()   {
        mkdir -p $TMPD
        if [ "$LOCAL" = y ]; then
                cp $URL/$1 $TMPD/$1 2>/dev/null
                if [ $? != 0 ]; then
                    msg "${CR}ERROR- file $URL/$1 does not exist.$CW"
                    quit
                fi
        else
                snarf -n $2 $URL$1 $TMPD/$1
                if [ $? != 0 ]; then
                    msg "${CR}Download error - $URL$1$CW"
                    quit
                fi
        fi
}
chks()  {
        t=$3
        $E -n "Checking required $1 space...            "
        i=`block_device $2 | sed s:/dev/::`
        set -- `df | sed -n /^.....$i/P`
        eval `sed -n /$t=/P $TMPD/$PNAME | sed s/$t/REQD/`
        if [ "$BOOTDEV" != fd -o "`block_device /tmp`" = "`block_device /pkg`" 
]; then
                if [ "$t" = PACKED ]; then
                    PACKED=$REQD
                    REQD=0
                else
                    REQD=`expr $REQD + $PACKED`
                fi
        fi
        if [ $4 -gt $REQD ]
                then = 0 Ok
                else = 1; ERRCOD=11
        fi
        
}
scan()  {
        for i in etc lib usr usr/lib usr/lib/diald usr/share
usr/share/terminfo usr/share/terminfo/l; do
            [ -d /pkg/$i ] || continue
            for n in `ls -1 /pkg/$i`; do
                [ -d /$i/$n ] && continue
                ln -sf /pkg/$i/$n /$i/$n
            done        
        done
}
ver()   { $E "$FREESCO" |sed -n '/0\.3\./P;/1\.0\./P'; }

inst()  {
        trap quit 2
        url $1; ACTION=$2; ERRCOD=0
        msg "Installing...                              $CM$PNAME$CW"
        dlf $PNAME -q
        if [ $ACTION = normal ]; then
                ask "Do you want to view the install/uninstall script (y/n) [n]"
        fi
        case $t in y|Y) more $TMPD/$PNAME; clear;; esac
        chmod a+x $TMPD/$PNAME
        $E;$TMPD/$PNAME info;$E
        $E -n "Checking versions...                     "
        eval `sed -n /FREESCO=/P $TMPD/$PNAME`
        if [ "`ver`" ]
                then = 0 "Pv$FREESCO"
                else = 0 "${CY}v$VERSION != Pv$FREESCO"; ERRCOD=1
        fi
        chks temp /tmp PACKED
        chks disk /pkg UNPACKED
        $E -n "Checking dependencies...         "
        eval `sed -n /DEPEND=/P $TMPD/$PNAME`
        j=""
        TMP=`ls /pkg/db/`
        for i in $DEPEND; do
                if [ "`depchk`" ]; then continue; fi
                if [ ! "$ERRCOD" = 1 ]; then $E; fi
                $E "            \"$i\" is required for this package"
                ERRCOD=1; j="$i $j"
        done
        if [ "$j" ]; then
                $E;$E "${CY}It is recommended that you install \"$j\""
                $E "before you install $PNAME";$E
        else = 0 Ok; fi
        $E -n "Checking if package is installed...      "
        j=""
        for i in $TMP; do
                if [ "$PNAME" = "$i" ]; then
                        j="$PNAME"
                        ERRCOD=1
                        beep
                fi
        done
        if [ "$j" ]; then = 0 "${CY}$j is already installed$CW"; else = 0 Ok; fi

        $E -n "Checking for existing libraries...       "
        j=""
        TMP=`ls /lib/`
        eval `sed -n /LIBS=/P $TMPD/$PNAME`
        for i in $TMP; do
                for e in $LIBS; do
                        if [ "$e" = "$i" ]; then
                                j="$j $e"
                        fi
                done
        done
        if [ "$j" ]; then
                = 1
                $E;$E "${CY}Existing libraries to be over written"
                $E "$CM$j$CW";$E
        else
                = 0 Ok
        fi
        case $ERRCOD in
                1)  if [ $ACTION = normal ]; then
                        ask "${CY}Non-fatal error occured. Continue installing 
(y/n) [y]$CW"
                        case $t in n|N) quit;; esac
                    fi;;
                11) quit;;
        esac
        $TMPD/$PNAME preinstall $URL $TMPD
        if [ $ACTION = normal ]; then
                $E
                ask "Do you want install this package (y/n) [y]"
                case $t in n|N) quit;; esac
                if [ "$BOOTDEV" != fd -a "$BOOTDEV" != ram1 ]; then
                    ask "Do you want to save a copy of this package (y/n) [n]"
                    case $t in y|Y)
                        PKGSAVE=y
                        read -p "What directory do you want to use ? [$PKGDIR]" 
ans
                        [ "$ans" ] && PKGDIR=$ans
                        [ -d $PKGDIR ] || mkdir $PKGDIR                 
                        ;;
                    esac        
                fi
        fi
        eval `sed -n /FILES=/P $TMPD/$PNAME`
        j=${FILES:-$PNAME.tgz}
        for i in $j; do
                dlf $i
                cd /
                $E -n "Unpacking $i .. "
                if zcat <$TMPD/$i >/dev/null 2>&1
                        then
                        zcat <$TMPD/$i | star
                        if [ "$PKGSAVE" = y ]; then
                            mv $TMPD/$i $PKGDIR/$i
                        else
                            rm -r $TMPD/$i
                        fi      
                else msg "${CR}Broken archive, try download/install again.$CW"; 
quit
                fi
                =
        done
        $TMPD/$PNAME postinstall $URL $TMPD
        if [ $? != 0 ]; then
                $TMPD/$PNAME uninstall
                quit
        fi
        scan
        [ -f "$TMPD/$PNAME" ] && cp $TMPD/$PNAME /pkg/db/
        [ "$PKGSAVE" = y ] && cp $TMPD/$PNAME $PKGDIR/ && chmod -x 
$PKGDIR/$PNAME
        msg "Successfully installed...          $CM$PNAME$CW"
        if [ "$PKGSAVE" = y ]; then
                eval `sed -n /EXFILE=/P /pkg/db/$PNAME`
                msg "Saving extra package files ..."
                for i in $EXFILE; do
                        dlf $i
                        cp -f $TMPD/$i $SAVD/
                        rm -f $TMPD/$i
                done
        fi
        quit 0
}
case "c$1" in

c-c)    url $2
        dlf packages.txt -q
        more $TMPD/packages.txt
        quit 0;;

c-i)    inst $2 normal; sync;;

c-r)    url $2
        if [ "`ls /boot/pkg/db/`" ]; then
            msg "$CR !!You can not use this feature with existing packages on
your drive !!"
            quit 1
        fi
        if [ `block_device /mnt/ram1` = /dev/ram0 ]; then
                msg "${CR}You don't have a ramdisk$CW"
                exit 2
        fi      
        mkdir -p $TMPD
        if [ "$LOCAL" != y ]; then
                snarf -nq ${URL}packages.txt $TMPD/packages.txt
                if [ $? = 0 ]; then
                        if [ "`cat $TMPD/packages.txt | sed -n 
'/030freesco-NORAM/P'`" ]; then
                                msg "${CR}You can't install onto a ramdisk from 
$URL$CW"
                                quit 2
                        fi      
                fi
        fi
        rm -r $TMPD
        j=/mnt/ram1/pkg
        if [ ! -d $j ]; then
                cp-rf /boot/pkg $j
                rm -f /pkg
                ln -sf $j /
        fi
        inst $2 ramdisk;;

c-s)    url $2
        [ "$3" ] && SAVD=$3 || SAVD=$PKGDIR
        [ -d $SAVD ] || mkdir $SAVD
        dlf $PNAME
        cp $TMPD/$PNAME $SAVD/
        eval `sed -n /FILES=/P $TMPD/$PNAME`
        j=${FILES:-$PNAME.tgz}
        eval `sed -n /EXFILE=/P $TMPD/$PNAME`
        k=`echo $EXFILE |sed 's/,/\     /g'`
        j="$j $k"
        msg "Saving...  $CC$SAVD/$PNAME'*'$CW"
        for i in $j; do
                dlf $i
                cp -f $TMPD/$i $SAVD/
                rm -f $TMPD/$i
        done
        sync
        quit 0;;

c-u)    PKGNAME="$2"
        if [ ! $2 ]; then
            $E "Installed packages that can be unistalled"
            ls /pkg/db
            $E
            read -p "Type the name of the package to be uninstalled ? " PKGNAME
        fi
        [ "$PKGNAME" = "" ] && exit
        if [ -x "/pkg/db/$PKGNAME" ]; then
                ask "Are you sure you want to uninstall $CC$PKGNAME$CW (y/n) 
[n]"
                case $t in y|Y)
                        if [ -f /pkg/rc/rc_$PKGNAME ]; then
                                /pkg/rc/rc_$PKGNAME stop
                        fi      
                        /pkg/db/$PKGNAME uninstall
                        eval `sed -n /FILES=/P /pkg/db/$PKGNAME`
                        rm -rf /pkg/db/$PKGNAME
                        msg "$CC$PKGNAME$CW has been uninstalled..."
                        sync;;
                esac
        else
                msg "${CR}No such package $PKGNAME or uninstall script 
/pkg/db/$PKGNAME$CW"
        fi;;

c-l)    dir /pkg/db/
        [ "`dir /pkg/db/`" ] && ask "Do you want to view descriptions (y/n)
[n]" || $E "No packages installed"
        case $t in y|Y)
                for j in /pkg/db/*; do [ -x $j ] && $j info |more; done;;
        esac;;

c-rescan) scan;;

*) help;;
esac

==================================

No sé si te sirve de algo proque de esto no entiendo nada solo sé usarlo :p
Espero que sí te sirva.

saludos

--
   .''`.   John Doe
  : :' :   LUGS: http://www.cafelug.org.ar/ http://www.lugsam.org.ar/
  `. ``    BLOG: http://www.los10binarios.com.ar/
    `-     UIN: 92831439
           JID: [EMAIL PROTECTED]
           MSN: [EMAIL PROTECTED]
           "Experiencia compartida, es experiencia adquirida."
--
Para desuscribirte tenés que visitar la página
https://listas.linux.org.ar/mailman/listinfo/lugar-gral/

/* Publica y encontra trabajo relacionado con softlibre en 
http://www.usla.org.ar/modules/jobs/ */

Si tenés algún inconveniente o consulta escribí a mailto:[EMAIL PROTECTED]

Responder a