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
Url :
http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20041109/4cc37444/attachment.bin
On Tue, Nov 09, 2004 at 10:39:02AM +0000, Yann Golanski wrote:> 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.Without looking further I'd say this is a bad idea because sometimes an upgrade to a port radically changes its functionality or does something else inconvenient. For example, upgrading databases/mysql*-server will shut down a running mysql server. You need to be manually reading /usr/ports/UPDATING before each update. What I tend to do is automate the cvsup and then email a report of what could be upgraded. The actual upgrades are done semi-automatically with a portupgrade -arR after checking it isn't going to do anything untoward. -------------- 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/5c97cc0b/attachment.bin
On Tue, 2004-11-09 at 05:39, Yann Golanski wrote:> ### 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=yesYou don't export these, so they're not actually seen by portupgrade. It's far more convenient to place these in either /etc/make.conf or /usr/local/etc/pkgtools.conf. If you search the ports list archives for make.conf and pkgtools.conf you'll find discussions on how to use both. I think a number of us have such scripts, but don't publish them. I fire mine off manually to (a) cvsup and (b) fetch packages, then check UPDATING and only fire off the automated world and/or ports rebuilds if there's no surprises lurking; otherwise I handle them manually. -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [WAY too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon univ. KF8NH
On Tue, Nov 09, 2004 at 10:39:02AM +0000, Yann Golanski said:> 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.I tried a similar sort of thing, to save time on my poor little 366MHz laptop: I already had a script to do the cvsup and pkg_version, so I thought I'd speed things up by going through that list and doing a portupgrade -Rr on each out-of-date port, rather than the more CPU/disk-intensive portupgrade -Rra. for lack of a better phrase, this made portupgrade get all funky on me sometimes: I'd find that ports weren't upgraded, or were upgraded incompletely, or that sometimes ports would be magically deinstalled despite their still being required. so you can give it a shot, but I've stuck with using portupgrade -Rra, or manually doing portupgrade -Rr on the specific ports I want, and I haven't had any problems (well, it was occasionally installing sgmlformat or docbook without anything that required it, but that seems to have died down). chris ------------------------------- Chris Doherty "I think," said Christopher Robin, "that we ought to eat all our provisions now, so we won't have so much to carry." -- A. A. Milne -------------------------------