HostOnNet Blog

Using portsnap to upgrade FreeBSD ports tree

Looking for Linux Server Admin or WordPress Expert? We can help.

I was running cvsup as cronjob daily to update FreeBSD ports tree.

Today i installed portsnap on FreeBSD 5.4 server.

portsnap is more efficient way of updating ports tree. portsnap is part of base system on FreeBSD 6.

With portsnap, you only update files that are changed. So you can update your ports tree much faster than with cvsup.

cd /usr/ports/sysutils/portsnap
make install clean
rehash

Will install portsnap.

First step is fetch port snapshot, this is done with command

# portsnap fetch

After fetching, you need to extract it if you are doing this first timr

# portsnap extract

After the initial installation, you don’t have to extract, just update, so only changed files get overwritten.

# portsnap update

That is whenever you need to update ports, just run

# /usr/local/sbin/portsnap fetch
# /usr/local/sbin/portsnap update

To automate the port upgrading i created a shell script

/root/utils/portsup.sh

server14# cat /root/utils/portsup.sh
#!/bin/sh


/usr/local/sbin/portsnap fetch
/usr/local/sbin/portsnap update


server14#

chmod it 755, so that the script can be executed

server14# chmod 755 /root/utils/portsup.sh

and add it to cronjob

server14# crontab -l
0 3 * * * /root/utils/portsup.sh
server14#

That is portsnap will update ports tree everyday at 3 AM.

Newer version of portsnap support

# portsnap fetch update

server14# portsnap fetch
Fetching public key… done.
Fetching snapshot tag… done.
Fetching snapshot metadata… done.
Fetching snapshot generated at Thu Feb 23 03:09:19 UTC 2006:
f4b0454e7bce8a4decdb9190e22b8325a966e92005df5f100% of 39 MB 1079 kBps 00m00s
Extracting snapshot… done.
Verifying snapshot integrity… done.
Fetching snapshot tag… done.
Fetching snapshot metadata… done.
Updating from Thu Feb 23 03:09:19 UTC 2006 to Thu Feb 23 22:45:24 UTC 2006.
Fetching 4 metadata patches… done.
Applying metadata patches… done.
Fetching 0 metadata files… done.
Fetching 1542 patches…..10 ….1540. done.
Applying patches… done.
Fetching 0 new ports or files… done.
server14#

Posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.