Missing UPDATING anymore

This is on-topic from time to time. To avoid that issue I run a script as user as below:
Code:
#!/bin/sh
sudo /usr/sbin/portsnap fetch update
/usr/sbin/pkg version -v | /usr/bin/grep need
if test $((`/usr/bin/stat -f "%a-%m" /usr/ports/UPDATING`)) -ne 0
then
echo "*******************************************************"
echo "************ /usr/ports/UPDATING modified *************"
echo "*******************************************************"
sudo touch /usr/ports/UPDATING
fi
sudo pkg audit -F
I run it on a SSD where update of access time is switched off. Otherwise the 9th line might be skipped. The method is copied from x11/biff. BTW: Sometimes only the text messages are updated. But it triggers the message as well. May be others have a similar solution already.

Kind regards and happy updating :beer::)!
 
This bit:
Code:
/usr/sbin/pkg version -v | /usr/bin/grep need
Is probably better do it like this:
Code:
/usr/sbin/pkg version -vl'<'
Or
Code:
/usr/sbin/pkg version -vL'='
The last one will also trigger on ports that are ahead or are missing.
 
Dear SirDice,
yes, thank you. This is much smarter. I will use the second option you have proposed because it covers more cases. Now I have read pkg-version(8). It gives more information than just pkg(8). Next time will check the references at the bottom of the man pages carefully. They are not there just to fill up the pages. Thank you!
 
Depending on your situation you might also want to add -R for checking against the remote package repository or -I for checking against the local /usr/ports/INDEX-*.
 
Is the remote package repository server supposed to be a machine in the local network which might pick up the ports for all other machines? Or is it one of the offical FreeBSD servers? May be one of those which compiles the ports to packages?
 
The remote repository is the one that shows up with pkg -vv. Which can be the official servers or your own. Depending on how you configured pkg(8).
 
Back
Top