#!/usr/bin/ksh93FMRI=$1if [ -z $FMRI ]; then echo "You must provide an FMRI as the first parameter." #FMRI="SUNWckr@0.5.11%2C5.11-0.111%3A20090418T183853Z"fiif [ -z $REPO ]; then REPO=http://pkg.opensolaris.org/devfiMFST=/tmp/$FMRIif [ ! -e $MFST ]; then wget -O $MFST $REPO/manifest/0/$FMRIfiwhile read ENTRY;do IFS=" " set -A action ${ENTRY} if [ "${action[0]}" != "file" ]; then continue fi for FIELD in ${action[*]}; do IFS="=" set -A pair ${FIELD} if [ "${pair[0]}" == "path" ]; then FNAME=${pair[1]} break fi done FILE=${action[1]} FP="/var/pkg/download/${FILE:0:2}/${FILE:2:6}" pfexec mkdir -p $FP if [ ! -e $FP/$FILE ]; then echo "Retrieving and caching $FNAME ..." pfexec wget -O $FP/$FILE $REPO/file/0/$FILE fidone < $MFST