[LV] 2007 July 05 So, I've been playing with [activetcl]'s [teacup] command for the past half year or so and found myself nearly every day performing at least three actions with it. So, the following is a [ksh] script (probably will work with other [unix] [shell]s as well, and also probably simple enough to convert to [tcl]) that automates the process. It got its first big work out this morning - my test copy of activetcl is installed in /tmp - and they rebooted the machine (and deleted all contents of /tmp) while I was away on vacation... so brew got its chance to work through the process. ---- #! /bin/ksh # Version 2: crudely process output from list and run installs # Version 1: initial attempt at running just the commands. # used for temporary files - modify as needed tmp=/tmp if [ ! -d $tmp ] ; then echo "$0: Unable to brew teapot updates due to missing directory" >&2 exit 1 fi # run 3 standard teacup commands. Evolve this script, over time, # to query the user if there are potential things to install # First, update teacup itself, so we are using the latest code teacup update-self # Now, read the results of teacup and install items found debug="0" if [ "$#" -ne 0 ] ; then debug=1 set -vx fi function steep { if [ "$#" -ne 1 ] ; then echo "USAGE: steep file" >&2 return -1 fi line="#" while [ x"$line" != x"" ] ; do case "$line" in \#) ;; entity*) ;; ---*) ;; *entities\ found*) ;; *entity\ found*) ;; profile*) echo "not processed: $line" ;; package* | application* ) echo "process $line" cmd=$(echo "$line" | awk '{ printf "teacup install %s %s -is %s\n",$2,$3,$1}') echo $cmd $cmd ;; *) echo "unknown line: $line" ;; esac read line done < $1 return 0 } # Next, determine whether anything already installed has been updated teacup list --only newer > $tmp/teacup_newer.txt 2>&1 echo "0 entities found" > $tmp/teacup_nohits.txt cmp -s $tmp/teacup_nohits.txt $tmp/teacup_newer.txt if [ $? -ne 0 ] ; then # something was returned from teacup cat $tmp/teacup_newer.txt steep $tmp/teacup_newer.txt else echo "No updated entities found" >&2 fi teacup list --only uninstalled > $tmp/teacup_notyet.txt 2>&1 cmp -s $tmp/teacup_nohits.txt $tmp/teacup_notyet.txt if [ $? -ne 0 ] ; then # something was returned from teacup cat $tmp/teacup_notyet.txt steep $tmp/teacup_notyet.txt else echo "No new entities found" >&2 fi ---- [LV] 2007 Sep 10 Head's up! If you consider using this script, be aware of a consequence that version 2 has. I haven't figured out a way to do this so that only the newest version of a package is installed. So the code just keeps on forcing installs. Ideally, there would be a way to get only the newest item installed. I just haven't figured out how to do that yet. Note that I recommend that when initially starting to use the repository, you initially run the command teacup install Activestate::ActiveTcl to fill the repository. That way, brew will tend to only get the new extensions anyways. ---- [Category Application] [Category Repository] [Category System Administration]