Portupgrade script.

Yann Golanski yann at kierun.org
Tue Nov 9 02:39:04 PST 2004


Would people be kind enough to have a look at the following script and
tell me what horrors/faux pas/stupid things I have done?  

The script is an almost automated way to upgrade all your ports to the
latest version. 

Of course, I bet someone else has done this and I'll be told to RTFM.
My excuse is that I didn't find it on my own... ;>

################################################################################
#!/bin/sh
# portupgrade script.

### variables.
day=`date +%d`
month=`date +%b`
year=`date +%Y`
host=`uname -n`

### Variouse ports that need stuff... Where should I put those?
# X11
X_WINDOW_SYSTEM=xorg
# mutt
WITH_MUTT_MBOX_HOOK_PATCH=yes
MAIL_GID=mail
# rxvt
WITH_MOUSEWHEEL=yes
WITH_RXVT_SCROLLBAR=yes
WITH_MENUBAR=yes
# imp3
WITH_APACHE2=yes
WITHOUT_LDAP=yes
# Aspell
ASPELL_EN=yes

### Does what it does...
/usr/local/bin/cvsup -g -L 2 /usr/ports/CVSUP
less /usr/ports/UPDATING
echo '[UPDATING] Do you want to update the port tree? [yn]?'
read -p '[y]es or [n]o: ' -e val
case ${val} in
[yY])
  echo 'Updating the port collection now!!!...'
  ;;
[nN])
  echo 'Aborting NOW!!!...'
  exit;
  ;;
*)
  echo 'What the hell?... I am aborting now.'
  exit;
  ;;
esac
/usr/local/sbin/portaudit -Fda
/usr/local/sbin/portsdb -Uu
/usr/local/sbin/pkgdb -F
/usr/bin/tar ycf /var/db/$year-$month-$day-pkg.tbz2 /var/db/pkg
/usr/local/sbin/portupgrade -C -u -v -r -R -P -a -l /usr/ports/LATEST.update
cat /usr/ports/LATEST.update | \
        sort | \
        mail -s "Portupdate $host on $day $month $year" root@$host
/usr/local/sbin/portsclean -C -L -P

### reporting.
echo ''
echo 'This is what has been updated today:'
/usr/bin/grep -v '^\-' /usr/ports/LATEST.update | sort 
echo ''
### EOF
################################################################################


-- 
yann at kierun.org                  -=*=-                      www.kierun.org
    PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20041109/4cc37444/attachment.bin


More information about the freebsd-stable mailing list