Portupgrade script.

Yann Golanski
Tue, 09 Nov 2004 02:39:06 -0000

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@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