<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-29462107</id><updated>2011-12-15T04:00:28.496+01:00</updated><title type='text'>Do it with pkgsrc</title><subtitle type='html'>Hello, I'm a humble netBSD user, and I like to discover new packages to do more and more things with my computer.
Here I'll post how I do things with pkgsrc. Feel free to make suggestions and comments about it.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-29462107.post-115938253196501760</id><published>2006-09-27T20:29:00.000+02:00</published><updated>2007-03-29T07:11:47.853+02:00</updated><title type='text'>Manage your packages in a sandbox with...</title><content type='html'>&lt;span style="font-weight: bold;"&gt;pkgtools/pkglint:&lt;/span&gt; Verifier for NetBSD packages and complete pkgsrc tree&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;pkgtools/pkgdepgraph:&lt;/span&gt; Visual representation of installed NetBSD packages&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;pkgtools/pkg_tarup:&lt;/span&gt; Generates binary package(s) from installed pkg(s)&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;wip/pkg_rmleaves:&lt;/span&gt; Interactive script for deinstalling 'leaf' packages&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mk/bulk/mksandbox:&lt;/span&gt; Script used to build a sandbox&lt;br /&gt;&lt;br /&gt;As you may know if you've read the previous posts of this blog, I used to trust wip/pkgmanager to handle all of my pkgsrc admistration tasks. Recently, I ran into a few problems that really disappoint me, and I decided to look for some other way to update and manage my packages.&lt;br /&gt;&lt;br /&gt;What i wanted was a clean and secure way, with simple commands using scripts I could understand. I must give credit to WIntellect from BSDnexus, which provided me a &lt;a href="http://forums.bsdnexus.com/viewtopic.php?id=1128"&gt;clever way&lt;/a&gt; to make the upgrade. Clever, yes, but no secure enough ;)&lt;br /&gt;&lt;br /&gt;My method use a sandbox to build all the packages that need to be upgraded, and once you've checked that everything is ok in the chrooted sandbox, you just create all the binaries you need and use them to upgrade your packages in the real environment. Let's see how to do that.&lt;br /&gt;&lt;br /&gt;1) Update you pkgsrc trees (/usr/pkgsrc and /usr/pkgsrc/wip) in the way you want.&lt;br /&gt;&lt;br /&gt;2) You may want to check and delete unwanted "leaf" packages. pkg_rmleaves is a curse based application that can help you to do that. Recompiling packages can be time consuming, and you don't want to waste time on packages you don't care about anymore, do you ?&lt;br /&gt;&lt;br /&gt;3) You should know build your sandbox, once and for all. Doing that is pretty easy, you just have to use /usr/pkgsrc/mk/bulk/mksandbox. If you're using xorg instead of Xfree86, edit it to change this line (line n°115) "need_xsrc=yes" to "need_xsrc=no". Then you just have to launch the script to create your sandbox in the directory of tour choice :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]# cd /usr/pkgsrc/mk/bulk/&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [bulk]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# ./mksandbox /usr/sandbox/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That should do the trick. Type df. See how the script null mounted in read-only mode all the directories the chroot will need, and in read-write, all the directories he will work in. Here's the part of the script that give details about that :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/bin /bin ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/sbin /sbin ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/lib /lib ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/libexec /libexec ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/X11R6 /usr/X11R6 ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/bin /usr/bin ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/games /usr/games ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/include /usr/include ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/lib /usr/lib ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/libdata /usr/libdata ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/libexec /usr/libexec ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/lkm /usr/lkm ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/share /usr/share ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/sbin /usr/sbin ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/var/mail /var/mail ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/src /usr/src ro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkgsrc /usr/pkgsrc rw&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkgsrc/packages /usr/pkgsrc/packages rw&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkg_distfiles /usr/pkg_distfiles rw&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice that my distfiles are stored in /usr/pkg_distfiles, to avoid losing them when I decide to update the trees with my barbarian script (see pkgmanager's post).&lt;br /&gt;&lt;br /&gt;The script that controls those null mounts is /usr/sandbox/sandbox. It is invoked when you first create you sandbox, but next time you'll have to use it yourself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; #/usr/sandbox/sandbox mount     &lt;br /&gt;to null mount the directories&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; #/usr/sandbox/sandbix umount&lt;br /&gt;to unmount them&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;OK, now your sanbox is created. You'll have to add a few packages in it to begin with. Blame me if you want to, but I like to use bash, so this one will be part of what I need. You will also need pkgtools/pkg_tarup. So you have to chroot in your sandbox and install those.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# chroot /usr/sandbox /bin/sh&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [/]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# cd /usr/pkgsrc/shells/bash &amp;&amp;amp; make install&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [bash]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# cd /usr/pkgsrc/pkgtools/pkg_tarup &amp;&amp;amp; make install&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here you are, get out of the sanbox with Ctrl-D, or by typing exit.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [pkg_tarup]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# exit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4) Now, we are going to use WIntellect's method to build the needed packages :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; # cd /usr/sandbox/tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# lintpkgsrc -i &gt; out_of_date&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That command will generate the list of outdated packages&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# pkgdepgraph -D out_of_date &gt; to_delete&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That one will create the list of packages that need to be deleted before hands&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# pkgdepgraph -R out_of_date &gt; rebuild.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And finally, this one generate a script which will be used to build all the packages needed.&lt;br /&gt;&lt;br /&gt;5) It's now time to chroot and to perform the build :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# chroot /usr/sandbox/ /usr/pkg/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@SANDbox [/]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# cd /tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@SANDbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# pkg_delete -r `cat to_delete`&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@SANDbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# sh rebuild.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If the building process encounters a problem on a package, he will stop. Then you can see which package caused the issue, and solve it with your bare hands, then fire rebuild.sh up again. This script won't rebuild packages already done, don't worry, it's just perfect ;)&lt;br /&gt;&lt;br /&gt;Note that the process can be longer in this virgin chrooted environment, you may need to build a lot of packages that you already have in your real environment. But with time passing, your sandbox should be almost in sync with the real one and that won't be an issue anymore. I think it's a cheap price for the serenity provided by the fact that you don't have to worry about half broking your box if there's a problem during the build !&lt;br /&gt;&lt;br /&gt;6) Once everything is done, you have to create the binary packages for later use in your real environment. To be sure, we will create every single packages installed in the sandbox :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@SANDbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# pkg_tarup `pkg_info | cut -d ' ' -f 1 -s`&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This command will create all the binary packages in /tmp (or /usr/sandbox/tmp, as you're still chrooted). Once this is done, un-chroot yourself.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@SANDbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# exit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;7) You're now in you real environment, and you don't want to make any mess. Trust me, there won't be any harm.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# cd /usr/sandbox/tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# pkg_add -uu `cut -d "'" -f 2 -s out_of_date`&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This should install everything. You can check that your system is up to date by running lintpkgsrc -i and verifying that you don't see anymore mismatching package.&lt;br /&gt;&lt;br /&gt;8) Time for housekeeping&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# rm -rf /usr/sandbox/tmp/*&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;# /usr/sandbox/sandbox umount&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You're done.&lt;br /&gt;&lt;br /&gt;Let's sum up all the commands needed, considering that the sandbox is already created :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [root]# cd /usr/sandbox/tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# lintpkgsrc -i &gt; out_of_date&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# pkgdepgraph -D out_of_date &gt; to_delete&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# pkgdepgraph -R out_of_date &gt; rebuild.sh&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# /usr/sandbox/sandbox mount&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;root@YOURbox [tmp]# chroot /usr/sandbox/ /usr/pkg/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [/]# cd /tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [tmp]# pkg_delete -r `cat to_delete`&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [tmp]# sh rebuild.sh&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [tmp]# pkg_tarup `pkg_info | cut -d ' ' -f 1 -s`&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@SANDbox [tmp]# exit&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# pkg_add -uu `cut -d "'" -f 2 -s out_of_date`&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# rm -rf /usr/sandbox/tmp/*&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; root@YOURbox [tmp]# /usr/sandbox/sandbox umount&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This, in my opinion, is the ultimate way to upgrade your packages :) I hope you like it too, don't hesitate to give me comments about it, if you think about ways to improve it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29462107-115938253196501760?l=diwp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/115938253196501760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29462107&amp;postID=115938253196501760' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/115938253196501760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/115938253196501760'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/2006/09/manage-your-packages-in-sandbox-with.html' title='Manage your packages in a sandbox with...'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29462107.post-115037277064636242</id><published>2006-06-15T13:59:00.000+02:00</published><updated>2007-03-09T02:39:03.293+01:00</updated><title type='text'>Monitor your network activity with...</title><content type='html'>&lt;b&gt;&lt;span style="" lang="EN-GB"&gt;net/bmon&lt;/span&gt;&lt;/b&gt;: Bmon is an interface bandwidth monitor&lt;br /&gt;&lt;b&gt;net/slurm&lt;/b&gt;: Realtime traffic statistics&lt;br /&gt;&lt;b&gt;net/wmnet&lt;/b&gt;: Dockable network monitor&lt;br /&gt;&lt;b&gt;sysutils/pftop&lt;/b&gt;: Utility for real-time display of statistics for PF&lt;br /&gt;&lt;b&gt;wip/tcptrack&lt;/b&gt;: Watch TCP connections&lt;br /&gt;&lt;b&gt;sysutils/pfstat&lt;/b&gt;: Utility to render graphical statistics for PF&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-GB"&gt;I like to always have an eye on my network activity. When I detect a strange behaviour, I also like to be able to track it down, to know who the hell is trying to hack my box! Most of the time it's actually just a cron job I forgot :)&lt;br /&gt;&lt;br /&gt;Here are the tools I use to feed my madness:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://people.suug.ch/%7Etgr/bmon/"&gt;&lt;span style="" lang="EN-GB"&gt;bmon&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt; is a text based application, which gives you a lot of information about traffic on each of your network interfaces, including some kind of graph. Very useful when you're not at home.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.raisdorf.net/projects/slurm/"&gt;&lt;span style="" lang="EN-GB"&gt;slurm &lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;serves the same purpose than bmon, to chose one or another is a matter of taste. You can only track one interface at a time, but ergonomics may seem cleaner... (though I prefer bmon)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://dockapps.org/file.php/id/77"&gt;&lt;span style="" lang="EN-GB"&gt;wmnet &lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;is a dockapp I use when I'm at home. I tried a lot of dockapps but this one is definitely the best, because you can use a logarithmic scale and thus see little traffic as well as bandwidth tsunamis. You can also customize the colours to adapt it to your desktop's style.&lt;br /&gt;&lt;br /&gt;I use it like that :&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;wmnet --logscale --maxrate=10000000 -t grey -r green -w --device vr0 &amp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now let's see the tools I use to have a deeper understanding of what's happening.&lt;br /&gt;&lt;br /&gt;If like me you use pf as firewall, you may try &lt;/span&gt;&lt;a href="http://www.eee.metu.edu.tr/%7Ecanacar/pftop/"&gt;&lt;span style="" lang="EN-GB"&gt;pftop&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;. It gives you a very detailed view on every connections currently used on your computer. You can sort connection by address, port, rate, age, number of packets. Not an easy to read interface, but there's really a lot of information.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.rhythm.cx/%7Esteve/devel/tcptrack/"&gt;&lt;span style="" lang="EN-GB"&gt;tcptrack&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt; is also very handy. The interface looks like &lt;i&gt;top&lt;/i&gt;'s one, and allows you to easily spot the most active connections. I prefer pftop but if you don't use pf (though I don't understand why, since it's so great), I guess tcptrack is a good tool.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.benzedrine.cx/pfstat.html"&gt;&lt;span style="" lang="EN-GB"&gt;pfstat&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;, for pf users once again, allows you to generate graphs from your network activity. The man page explains pretty well how to set it up, but I will summarize it here.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="" lang="EN-GB"&gt;Add the following line to your pf.conf (of course, replace vr0 by the name of the interface you wanna log) and restart pf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: courier new;"&gt;set loginterface vr0&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="" lang="EN-GB"&gt;Add a cron task as root (&lt;i&gt;crontab -e&lt;/i&gt;)      to feed your log file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;    &lt;p class="MsoNormal" style="text-indent: 35.4pt;"&gt;&lt;span style="font-family: courier new;" lang="EN-GB"&gt;* * * * * /usr/pkg/bin/pfstat -q &gt;&gt;/var/log/pfstat&lt;/span&gt;&lt;i style=""&gt;&lt;span style="" lang="EN-GB"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="" lang="EN-GB"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul style="margin-top: 0cm;" type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="" lang="EN-GB"&gt;You should consider setting up      another cron task to occasionally truncate the log file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal" style="margin-left: 35.4pt;"&gt;&lt;span style="font-family: courier new;"&gt;1 1 * * 1 tail -n 50000 /var/log/pfstat &gt;/tmp/pfstat &amp;&amp;amp; mv /tmp/pfstat /var/log/pfstat&lt;/span&gt;&lt;i style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="" lang="EN-GB"&gt;Write a pfstat.conf file and save it in      /etc for example. Here's the one I use, see man page to write your own :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style="font-family: courier new;" lang="EN-GB"&gt;image "/home2/stats/pfstat-week.png" {&lt;br /&gt;from 1 weeks to now&lt;br /&gt;width 960 height 300&lt;br /&gt;left&lt;br /&gt;graph bytes_v4_in label "incoming" color 0 192 0 filled,&lt;br /&gt;graph bytes_v4_out label "outgoing" color 0 0 255&lt;br /&gt;right&lt;br /&gt;graph states_searches label "states searches" color 192 192 0&lt;br /&gt;}&lt;br /&gt;image "/home2/stats/pfstat-day.png" {&lt;br /&gt;from 1 days to now&lt;br /&gt;width 960 height 300&lt;br /&gt;left&lt;br /&gt;graph bytes_v4_in label "incoming" color 0 192 0 filled,&lt;br /&gt;graph bytes_v4_out label "outgoing" color 0 0 255&lt;br /&gt;right&lt;br /&gt;graph states_entries label "states" color 255 0 0&lt;br /&gt;}&lt;br /&gt;image "/home2/stats/pfstat-hour.png" {&lt;br /&gt;from 1 hours to now&lt;br /&gt;width 960 height 300&lt;br /&gt;left&lt;br /&gt;graph bytes_v4_in label "incoming" color 0 192 0 filled,&lt;br /&gt;graph bytes_v4_out label "outgoing" color 0 0 255&lt;br /&gt;right&lt;br /&gt;graph states_entries label "states" color 255 0 0&lt;br /&gt;}&lt;/span&gt;&lt;span style="" lang="EN-GB"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style="" lang="EN-GB"&gt;Now add a cron task to refresh your graphs      every five minutes for example&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;span style="" lang="EN-GB"&gt;&lt;span style="font-family: courier new;"&gt;*/5 * * * * /usr/pkg/bin/pfstat -c /etc/pfstat.conf -d /var/log/pfstat &gt; /dev/null&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can do whatever you want with those graphs, but printing them on a web page hosted on your computer may be a good idea.&lt;br /&gt;&lt;br /&gt;Here's the kind of graphs you can obtain:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://photos1.blogger.com/blogger/892/3140/1600/pfstat-hour.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;span style="text-decoration: none;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" alt="" href="http://photos1.blogger.com/blogger/892/3140/1600/pfstat-hour.jpg" style="'width:300pt;height:93.75pt'" button="t"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\DUNAND~1.000\LOCALS~1\Temp\msohtml1\01\clip_image001.jpg" href="http://photos1.blogger.com/blogger/892/3140/400/pfstat-hour.jpg"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/892/3140/1600/pfstat-hour.0.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/892/3140/400/pfstat-hour.0.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="" lang="EN-GB"&gt;&lt;br /&gt;&lt;br /&gt;Of course, I didn't mention netstat because it's not a pkgsrc package, but it's the most useful tool when it comes to monitor your network activity.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29462107-115037277064636242?l=diwp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/115037277064636242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29462107&amp;postID=115037277064636242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/115037277064636242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/115037277064636242'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/2006/06/monitor-your-network-activity-with_15.html' title='Monitor your network activity with...'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29462107.post-114986141711712101</id><published>2006-06-09T14:41:00.000+02:00</published><updated>2007-03-27T09:05:18.953+02:00</updated><title type='text'>Bypass your company firewall/proxy with...</title><content type='html'>&lt;span style="font-weight: bold;"&gt;net/corkscrew&lt;/span&gt;: Tool for tunneling SSH through HTTP proxies&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;net/tsocks&lt;/span&gt;: Transparent SOCKS proxying library&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;www/tinyproxy&lt;/span&gt;: Lightweight HTTP/SSL proxy&lt;br /&gt;&lt;br /&gt;Most company restrict the internet access by forcing users to use an HTTP proxy. If that access isn't enough for you to endure the pain of a whole day of (pseudo) work, if you want to be able to browse any website, to listen to any streaming radio, to connect to your favorite poker online site or anything else, know that there IS a solution.&lt;br /&gt;&lt;br /&gt;1) Host an openSSH server on your home computer, and make it listen on the port 443&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;If you're office computer is running windows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2) You should also install an HTTP proxy on your home computer, because you won't be able to use openssh and thus to benefit of the socks proxy feature (-D), &lt;a href="http://tinyproxy.sourceforge.net/"&gt;tinyproxy&lt;/a&gt; is easy to configure and works very well.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;pkgmanager install www/tinyproxy&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;cp /usr/pkg/share/examples/rc.d/tinyproxy /etc/rc.d/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;echo 'tinyproxy=YES' &gt;&gt; /etc/rc.conf&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;cp /usr/pkg/share/examples/tinyproxy/tinyproxy.conf.default /usr/pkg/etc/tinyproxy/tinyproxy.conf&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;vi &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkg/etc/tinyproxy/tinyproxy.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Edit the tinyproxy.conf file, make sure you find the following lines&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Port 8888&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Bind 127.0.0.1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;ConnectPort 443&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;That way, your http proxy will listen only on localhost, on the port 8888, and will allow you to browse https sites.&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;3) You'll have to use &lt;a href="http://www.putty.nl/latest/x86/putty.exe"&gt;putty&lt;/a&gt;. Go in the &lt;span style="font-style: italic;"&gt;Connection/Proxy&lt;/span&gt; section and give the HTTP proxy details here. Go in the &lt;span style="font-style: italic;"&gt;Connection/SSH/Tunnels&lt;/span&gt; section and use port forwarding to redirect local port 8888 to localhost:8888 (on the remote host, your home computer). You can redirect any port you need, for example, if you want to play Go on KGS, redirect local port 2379 to goserver.igoweb.org:2379 and tell your Go client (cgoban) to connect to localhost:2379.&lt;br /&gt;&lt;br /&gt;You should also go in the &lt;span style="font-style: italic;"&gt;Connection&lt;/span&gt; section and tell putty to send null packets every 10 seconds, to keep the connection alive. Once this is done, go in the &lt;span style="font-style: italic;"&gt;Session&lt;/span&gt; section, enter the hostname of your home computer, port 443, SSH, and save the session for later use, then try to connect.&lt;br /&gt;&lt;br /&gt;4) Once you are logged on your server, you may check that port redirection is OK. Launch &lt;span style="font-style: italic;"&gt;cmd.exe&lt;/span&gt; and make &lt;span style="font-style: italic;"&gt;netstat -an&lt;/span&gt; to check that you're listening on the port 8888. Launch your web browser and tell him to use an http proxy on localhost:8888, and you should be able to browse any web site, enjoy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;If your office computer is running an unix-like, let's say NetBSD ;)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;2) Install &lt;a href="http://www.agroman.net/corkscrew/"&gt;corkscrew&lt;/a&gt;. It allows you to use ssh through an HTTP proxy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;pkgmanager install net/corkscrew&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3) Write a file that you will name auth_proxy for example, and which should contain your credentials to connect on the HTTP proxy, if needed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;echo 'login:pass'  &gt;&gt; ~/.ssh/auth_proxy&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;4) Write a file that you will name config_out for example (192.168.3.10 is the address of the proxy I have to use)&lt;br /&gt;&lt;br /&gt;&lt;font&gt;&lt;span style="font-family:courier new;"&gt;echo 'ProxyCommand /usr/pkg/bin/corkscrew 192.168.3.10 80 %h %p ~/.ssh/auth_proxy' &gt;&gt; ~/.ssh/config_out&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;5) Add an alias in your .bashrc&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;alias ssh_out='ssh -F ~/.ssh/config_out'&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;6) If you're not always on the same network, then create as many auth_proxy files, config_out files, and alias that you need.&lt;br /&gt;&lt;br /&gt;7) Now just connect to your home computer with the -D option.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;ssh_out -D 8080 yourcomputer.hostname.org -p 443&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You now have a SOCKS4/5 proxy listening on your port 8080.&lt;br /&gt;&lt;br /&gt;8) What you want is to redirect all your TCP resquests to this socks proxy. For that purpose, you'll use &lt;a href="http://tsocks.sourceforge.net/"&gt;tsocks&lt;/a&gt;. It's a great tool.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;pkgmanager install net/tsocks&lt;br /&gt;echo 'local = 192.168.0.0/255.255.255.0' &gt;&gt; /usr/pkg/etc/tsocks.conf&lt;br /&gt;echo 'server = 127.0.0.1' &gt;&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkg/etc/tsocks.conf&lt;br /&gt;echo 'server_port = 8080' &gt;&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;/usr/pkg/etc/tsocks.conf&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;192.168.0.0/255.255.255.0 is my local network, use yours.&lt;br /&gt;&lt;br /&gt;9) To activate tsocks, you have to export the LD_PRELOAD variable&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;export LD_PRELOAD=/usr/pkg/lib/libtsocks.so&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Then, every application you will run through this shell will use the proxy, which means that everything will go through the ssh tunnel right to your home computer wich will redirect all that stuff to the right directions. Everything will be as if you were at home.&lt;br /&gt;&lt;br /&gt;Be aware that suid binaries or binaries launched through sudo won't use tsocks, so consider logging into your root account to use them.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29462107-114986141711712101?l=diwp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/114986141711712101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29462107&amp;postID=114986141711712101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114986141711712101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114986141711712101'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/2006/06/bypass-your-company-firewallproxy-with.html' title='Bypass your company firewall/proxy with...'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29462107.post-114985531259191848</id><published>2006-06-09T13:46:00.000+02:00</published><updated>2006-09-27T21:59:11.740+02:00</updated><title type='text'>Masterize file deletion with...</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="" lang="EN-GB"&gt;sysutils/wipe&lt;/span&gt;&lt;/b&gt;&lt;span style="" lang="EN-GB"&gt;: Secure data destruction&lt;br /&gt;&lt;b&gt;wip/neb-wipe&lt;/b&gt;: Secure disk partition eraser (NetBSD only)&lt;br /&gt;&lt;b&gt;sysutils/fatback&lt;/b&gt;: Recover deleted files from FAT filesystems&lt;br /&gt;&lt;br /&gt;Some people are paranoid when it comes to the security and the privacy of their data, even of the erased ones, I guess that it is my case... Since erasing in a secure way is really easy with &lt;/span&gt;&lt;a href="http://wipe.sourceforge.net/"&gt;&lt;span style="" lang="EN-GB"&gt;wipe&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;, there's no reason to ignore it.&lt;br /&gt;&lt;br /&gt;wipe interface is the same as rm for the main flags :&lt;br /&gt;&lt;br /&gt;&lt;i&gt;-i interactive - prompt whether to remove each file explicitly checks file permissions&lt;/i&gt;&lt;br /&gt;&lt;i&gt;-f forces file wiping and suppresses permission warnings&lt;/i&gt;&lt;br /&gt;&lt;i&gt;-r or -R recursion - traverse subdirectories&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;So you can easily write an alias in your .bashrc file or whatever shell you use, to replace rm by wipe.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;alias rm='wipe -i'&lt;/span&gt;&lt;i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;neb-wipe allows you to erase your whole netBSD partition, before you give your crappy disk back to your reseller or sell it to your worst enemy&lt;i&gt;. &lt;/i&gt;Usage is pretty simple :&lt;br /&gt;&lt;br /&gt;&lt;i&gt;neb-wipe - Erase harddisk partitions in a very secure manner,&lt;br /&gt;using the 35-pass Gutmann method&lt;br /&gt;Version 1.0&lt;br /&gt;&lt;br /&gt;Usage is: neb-wipe [ -r count ] device&lt;br /&gt;where device is the desired partition, e.g. "sd0a"&lt;br /&gt;If the -r option is given, no Gutmann patterns are used;&lt;br /&gt;Instead, neb-wipe writes the given amount of random&lt;br /&gt;patterns to the disk.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;If you are in the opposite situation, you want to explore the disk your worst enemy sold you, and it happens this sucker was using fat32, then you can use &lt;/span&gt;&lt;a href="http://sourceforge.net/project/showfiles.php?group_id=46038"&gt;&lt;span style="" lang="EN-GB"&gt;fatback&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt;, it is made to undelete files from FAT filesystems and it works pretty well.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29462107-114985531259191848?l=diwp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/114985531259191848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29462107&amp;postID=114985531259191848' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114985531259191848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114985531259191848'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/2006/06/masterize-file-deletion-with.html' title='Masterize file deletion with...'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29462107.post-114984628230969713</id><published>2006-06-09T11:15:00.000+02:00</published><updated>2006-09-27T21:57:34.726+02:00</updated><title type='text'>Manage your packages with ...</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-GB"&gt;&lt;span style="font-weight: bold;"&gt;wip/pkgmanager&lt;/span&gt;: Package manager for pkgsrc&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; devel/cpuflags&lt;/span&gt;: Determine compiler flags to best target current cpu&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.scode.org/pkgmanager/"&gt;&lt;span style="" lang="EN-GB"&gt;pkgmanager&lt;/span&gt;&lt;/a&gt;&lt;span style="" lang="EN-GB"&gt; is the greatest tool I know to manage my package collection from pkgsrc. It would never leave your system in inconsistent state as pkg_chk could. Check the website to understand how it works, and give it a try. Here’s my method to handle package installation, removal and update :&lt;br /&gt;&lt;br /&gt;Of course you first need a pkgsrc tree. If you don't already have one, you can grab it and extract it with :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; wget -c -P /tmp ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; tar xfz /tmp/pkgsrc.tar.gz -C /usr&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You may also grab the last wip tree :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; wget -c -P /tmp http://pkgsrc-wip.sourceforge.net/snapshots/pkgsrc-wip-\&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-GB"&gt;&lt;span style="font-family: courier new;"&gt;$(date+%Y%m%d)-snapshot.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; tar xfz /tmp/pkgsrc-wip-$(date +%Y%m%d)-snapshot.tar.gz -C /usr/pkgsrc&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, the first thing you have to do is to install pkgmanager&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; cd /usr/pkgsrc/wip/pkgmanager&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; make install clean clean-depends&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's see how to handle the main tasks :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; a) Build and Install a new package&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's say you want to install pkgfind&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; pkgmanager install pkgtools/pkgfind&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;pkgtools/pkgfind is then written in your want-list, compiled and installed, with all dependencies needed of course&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; b) Remove a package&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to remove pkgfind, just type&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; pkgmanager uninstall pkgtools/pkgfind&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;pkgtools/pkgfind will be removed from your want-list, and uninstalled, as well as every unneeded packages (former dependencies) its uninstallation may produce.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; c) Update your packages&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You first need to update your pkgsrc tree.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; cd /usr/pksrc/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; cvs update&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; cd /usr/pkgsrc/wip&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; cvs update&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;If you don't like cvs and don't care about netBSD servers bandwidth, which is bad, then you may use this crappy script :&lt;/p&gt;&lt;span style="font-family: courier new;"&gt;#!/usr/pkg/bin/bash&lt;br /&gt;&lt;br /&gt;echo "Fetching the trees"&lt;br /&gt;&lt;br /&gt;echo -n "--Fetching pkgsrc-wip-"&lt;br /&gt;echo -n $(date +%Y%m%d)&lt;br /&gt;echo -n "-snapshot.tar.gz : "&lt;br /&gt;wget --quiet -c -P /tmp http://pkgsrc-wip.sourceforge.net/snapshots/pkgsrc-wip-$(date +%Y%m%d)-snapshot.tar.gz&lt;br /&gt;if [ "$?" -ne 0 ]&lt;br /&gt;   then&lt;br /&gt;   echo "Can't fetch it, trying archive from yesterday"&lt;br /&gt;   echo -n "--Fetching pkgsrc-wip-"&lt;br /&gt;   echo -n $(date -r $(expr `date +%s` - 86400) +%Y%m%d)&lt;br /&gt;   echo -n "-snapshot.tar.gz : "&lt;br /&gt;   wget --quiet -c -P /tmp http://pkgsrc-wip.sourceforge.net/snapshots/pkgsrc-wip-$(date -r $(expr `date +%s` - 86400) +%Y%m%d)-snapshot.tar.gz&lt;br /&gt;       if [ "$?" -ne 0 ]&lt;br /&gt;           then&lt;br /&gt;           echo "Can't fetch it, exiting"&lt;br /&gt;           exit 1&lt;br /&gt;       fi&lt;br /&gt;fi&lt;br /&gt;echo "OK"&lt;br /&gt;&lt;br /&gt;echo -n "--Fetching pkgsrc.tar.gz : "&lt;br /&gt;wget --quiet -c -P /tmp ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz&lt;br /&gt;if [ "$?" -ne 0 ]&lt;br /&gt;then&lt;br /&gt;   echo "Can't fetch it, exiting"&lt;br /&gt;   exit 1&lt;br /&gt;fi&lt;br /&gt;wget --quiet -c -P /tmp ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz.MD5&lt;br /&gt;wget --quiet -c -P /tmp ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz.SHA1&lt;br /&gt;echo "OK"&lt;br /&gt;&lt;br /&gt;echo -n "Removing the old tree : "&lt;br /&gt;rm -rf /usr/pkgsrc/&lt;br /&gt;echo "OK"&lt;br /&gt;&lt;br /&gt;echo -n "Extracting the trees : "&lt;br /&gt;tar xfz /tmp/pkgsrc.tar.gz -C /usr&lt;br /&gt;if [ "$?" -ne 0 ]&lt;br /&gt;then&lt;br /&gt;   echo "NOK"&lt;br /&gt;   echo "Problems during extraction, check your pkgsrc tree"&lt;br /&gt;   exit 1&lt;br /&gt;fi&lt;br /&gt;tar xfz /tmp/pkgsrc-wip-$(date +%Y%m%d)-snapshot.tar.gz -C /usr/pkgsrc&lt;br /&gt;if [ "$?" -ne 0 ]&lt;br /&gt;then&lt;br /&gt;   echo "NOK"&lt;br /&gt;   echo "Problems during extraction, check your wip tree"&lt;br /&gt;   exit 1&lt;br /&gt;fi&lt;br /&gt;echo " OK"&lt;br /&gt;&lt;br /&gt;echo -n "Fetching vulnerability list : "&lt;br /&gt;/usr/pkg/sbin/download-vulnerability-list &gt;&gt; /dev/null&lt;br /&gt;if [ "$?" -ne 0 ]&lt;br /&gt;then&lt;br /&gt;   echo "NOK"&lt;br /&gt;else&lt;br /&gt;   echo "OK"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo&lt;br /&gt;echo "All done"&lt;br /&gt;echo&lt;br /&gt;exit 0&lt;br /&gt;&lt;/span&gt;&lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-GB"&gt;&lt;br /&gt;Once your trees are up to date, just type&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; pkgmanager sync&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;&lt;br /&gt;Now if you wish to compile your packages with the appropriate flags, I suggest you to use devel/cpuflags. You just have to install it and to add those lines at the beginning of your /etc/mk.conf&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; .ifdef BSD_PKG_MK&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; .sinclude "/usr/pkg/share/mk/cpuflags.mk"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; .endif&lt;/span&gt;&lt;o:p style="font-style: italic;"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29462107-114984628230969713?l=diwp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://diwp.blogspot.com/feeds/114984628230969713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29462107&amp;postID=114984628230969713' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114984628230969713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29462107/posts/default/114984628230969713'/><link rel='alternate' type='text/html' href='http://diwp.blogspot.com/2006/06/manage-your-packages-with.html' title='Manage your packages with ...'/><author><name>wilouf</name><uri>http://www.blogger.com/profile/08960790656281817261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
