From owner-freebsd-current Wed Oct 21 22:09:17 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA27830 for freebsd-current-outgoing; Wed, 21 Oct 1998 22:09:17 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from firewall.scitec.com.au (fgate.scitec.com.au [203.17.180.68]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA27824 for ; Wed, 21 Oct 1998 22:09:14 -0700 (PDT) (envelope-from john.saunders@scitec.com.au) Received: by firewall.scitec.com.au; id PAA20894; Thu, 22 Oct 1998 15:08:44 +1000 (EST) Received: from mailhub.scitec.com.au(203.17.180.131) by fgate.scitec.com.au via smap (3.2) id xma020873; Thu, 22 Oct 98 15:08:30 +1000 Received: from saruman (saruman.scitec.com.au [203.17.182.108]) by mailhub.scitec.com.au (8.6.12/8.6.9) with SMTP id PAA27492 for ; Thu, 22 Oct 1998 15:08:30 +1000 From: "John Saunders" To: "FreeBSD current" Subject: Package upgrade check program Date: Thu, 22 Oct 1998 15:08:29 +1000 Message-ID: <001b01bdfd7a$021fd540$6cb611cb@saruman.scitec.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Importance: Normal Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG With everybody hot into upgrading to 3.0, I thought I would throw this script in that I have been working on the last couple of days (bit at a time). This script suggests upgrades to installed packages. I'm continuing to work on a version that will do the upgrade for you (after prompting of course). Enjoy... #!/bin/sh # pkg_check: # # Scan the installed packages and suggest upgrades or alternative # packages to install. # # Change directory to the package database directory. if cd /var/db/pkg 2>/dev/null; then else echo "Cannot find package database directory /var/db/pkg" exit 1 fi # Scan through all the installed packages. for pkg in *; do # Try to determine the name of the package without the version # number postfix. Commented out line uses lazy checking. base=`echo $pkg | sed -e '1,$ s/\([a-zA-Z_]-\)[0-9].*$/\1/'` #base=`echo $pkg | sed -e '1,$ s/\([a-zA-Z_]\)-[0-9].*$/\1/'` # Get a list of ports matching the package base name. new=`grep "^$base" /usr/ports/INDEX | sed -e '1,$ s/|.*$//'` # Upgrade is yes when installed package doesn't match any in ports. upgrade="yes" # Alternatives is yes when one of the ports matches the installed # package, but multiple ports are available. alternatives="no" # Simple case no upgrade needed. if [ "$pkg" = "$new" ]; then upgrade="no" else # Scan the multiple available ports. for i in $new; do if [ "$pkg" = "$i" ]; then upgrade="no" else alternatives="yes" fi done fi # Dump the information. if [ "$upgrade" = "yes" ]; then echo "Upgrade package $pkg to one of..." for i in $new; do echo " $i" done elif [ "$alternatives" = "yes" ]; then echo "Alternatives for $pkg exist..." for i in $new; do if [ "$pkg" = "$i" ]; then echo " $i (installed)" else echo " $i" fi done fi done exit 0 -- . +-------------------------------------------------------+ ,--_|\ | John Saunders mailto:John.Saunders@scitec.com.au | / Oz \ | SCITEC LIMITED Phone +61294289563 Fax +61294289933 | \_,--\_/ | "By the time you make ends meet, they move the ends." | v +-------------------------------------------------------+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message