Cloud Overload

Welcome to the Cloud Era, where data is no longer relegated to your personal PC, but to the ubiquitous and ambiguous “cloud.”  This has a number of advantages, but unfortunately, cloud as a technical term has now been soundly abused (as much as “database”) — used to mean everything from a hosted service (formerly known as a “website”) to a redundant cluster of computers meant to provide resilience in the case of localized failure.

Here I present a brief review of a handful of “cloud services,” by which I’m mostly referring to what I’ll call “cloud drives” — in other words, a service which provides synchronization and storage services for files you put in it.


I’ll start with Dropbox, which is arguably the category leader, and a handy reference point by which to judge other entrants.  Dropbox provides 2 GB of space free to do with essentially anything you want, has clients for all popular platforms, including Windows, OSX, and Linux, as well as mobile platforms like the iPhone, Android and (of all things) the Blackberry.  As with other providers, paid plans increase the storage available and enable use for business.

Aside from the obvious things that one can do with shared storage, Dropbox has a number of features:  First, files can be shared publicly, enabling a handy way of sharing a file with somebody using a URL.  Second, on mobile platforms, Dropbox will automatically upload pictures taken — and on desktop platforms, screen shots.  This is quite handy when combined with the previous ability to publicly share files.

onedriveOneDrive is the offering from Microsoft formerly known as SkyDrive and attached to their Live service — and Passport, or what-have-you.  OneDrive starts with a lot more storage — 15 GB, and has smaller-increment paid plans than Dropbox.  (Smaller leaps in storage for less money.)  OneDrive doesn’t support *nix or the Blackberry.  OneDrive has the same photo upload and public sharing features as Dropbox.

What OneDrive adds is automatic organization of documents and combination with other Microsoft services, like Office 365, and is built in to newer Windows operating systems.  Great if you use a lot of Office or are stuck with a Windows phone, I guess.

googledriveGoogle Drive matches OneDrive’s 15GB storage space, and synchronizes with Google Docs in a fashion somewhat similar to OneDrive — except that Google Docs is free, and documents can be freely edited and collaborated with no other subscriptions or software.  Integration with Gmail means that attachments can be added to your drive easily, though it also means that Gmail and Google Drive share the 15GB limit.

Google Drive lacks picture upload capabilities, but can share files publicly.

icloudiCloud Drive is Apple’s offering in Cloud drives, with general file synchronization and storage being a recent development.   Its features beyond that are both venerable and (understandably) very Apple-specific, so some of its features, like contact synchronization, are really only useful if you’re already using Apple devices to store your contacts in the first place.  Others, like Notes, require a new iCloud email address.  It’s available on Windows, IOS8, and (soon) OSX.  iCloud Drive comes with 5GB of storage, which is shared with backups of your IOS devices.

While it does have photo features, iCloud lacks the ability to share files publicly.

amazon-cloud-driveAstute readers have spotted a trend by now — every place that has their own infrastructure seems to have a cloud drive offering — and yes, Amazon has their own cloud drive offering called Amazon Cloud Drive.  If you have a Kindle, you’re no doubt using it already, and you’ll find any personal documents here.  It also integrates with Amazon’s cloud player.  5GB is included, which is shared with personal Kindle documents (but not purchased eBooks.)

Amazon’s Cloud Drive has client apps for phones (that can handle phones) but lacks an app for desktop synchronization.  Files uploaded to the Amazon Cloud Drive may be shared publicly.

owncloudOwncloud is a bit different for a number of reasons, but the biggest one is probably that it’s open source software that you run on your own platform.  While this may not be too useful if you don’t have a platform, the easy availability of inexpensive VPSes makes this a relatively inexpensive proposition to set up, and it has some features that other offerings lack.  However, it also lacks one critical thing that other cloud drives promise:  built in redundancy — so you either need to set up your own, or use it in a way that resilience isn’t critical.  Intriguingly, owncloud can use Google Drive for storage, which means its features can be combined with Google Drive’s resilience.

Like other cloud drives, Owncloud has synchronization clients for major platforms.  Photos can be uploaded from phones, but not automatically.  Owncloud stands out because of the control it provides, its essentially unlimited storage (limited by your platform, of course.)  Shared files are automatically versioned, can be password protected, and when deleted, linger for set periods of time.  Owncloud can also include document editing capabilities (if installed) and has “apps” which can be loaded on the server to handle contacts, calendars, etc.  Contacts, for example, provides a decent web interface, as well as synchronization via carddav.


One Way to be Happy

All the staff and kids from our group home were walking back from the cafeteria when Jay, for no apparent reason, started screaming:  a high-pitched, ear-piercing shriek like nails on a chalkboard.

Cindy, our group home leader, gently pushed Jay’s wheelchair until it was facing a wall and put on the brakes.  His shrieks continued, only stopping so that he could breathe.  “Why don’t you take this one?” she asked, leaning close to my ear so I could hear her.

Jay has Rett syndrome, which is very similar to autism.  Or maybe autism.  And perhaps something else.  Nobody really seems to know for sure — but we’ve been given a plan of action for the tantrums, which essentially is to remove as many stimuli as possible and wait it out nearby.  Although as a caregiver it may be instinctive to try to soothe Jay by talking or touching, this doesn’t help, and just prolongs the episode.  So I have little to do but wait nearby, try not to get a headache, and make sure Jay doesn’t hurt himself — which, although very unlikely, is possible, so I’m not going to let him out of my sight.

Nobody else is in the cafeteria, so I’m soon joined by two friends who notice me sitting alone — Luke, a fellow caregiver and a patient named Kirby.  Kirby has an enzymatic deficiency that somewhat mimics Tourette’s syndome’s symptoms, and his hands are restrained (wrapped in padded cuffs and chained to his chair) to keep him from hurting himself.  Kirby greeted me with a hearty hello, then spit in my face.

“Oh shit,” Kirby apologized, looking mortified.  “Sorry.”

“Don’t worry about it,” I smiled.”It happens.”  Jay is still screaming his lungs out.  Luke handed me some paper towels which he always keeps at the ready.

The three of us talk for a while over Jay’s screaming.  Kirby punctuates the conversation with occasional profanity and unnecessary apologies, and every now and then the chains on his arms tighten and his body goes completely rigid.  What he’s trying to do (or not do) I can only guess.

A man on crutches somewhat unsteadily comes to our table and introduces himself as David.  This is unnecessary for us because all of us already know him… but he doesn’t know us, so we tell him our names, again.

David has been hit in the head by a golf ball which damaged his ability to form new memories, so that anything after the moment of impact can’t be permanently stored — like the movie Memento.  The injury had two other side effects — first, it had damaged his motor skills, making it difficult for him to walk, or golf, or generally move about.  Second, it has provided David with an intensely sunny disposition and charming personality that he insists he didn’t have before the accident.

David sat down next to Kirby and eyed Kirby’s restraints.  “Do you shake hands, is that okay?  I don’t want to be rude…”

Kirby smiled, “Well, it’s better if I don’t.  I can’t always control my hands.”  Kirby’s face twisted into a grimace and he shouted, “you pigfucker!”

David smiled brightly.  “Well, you certainly made me feel better!”

David’s brother Tom was apparently visiting, and joined us at the table.

“Can’t you shut that kid up?” Tom said to nobody in particular, as Jay continued to shriek.  I wasn’t particularly fond of Tom.

“Pigfucker!” said Kirby, but without the telltale grimace that normally accompanies an attack.

Luke stifled a laugh and announced that it was time for he and Kirby to go back, leaving me with David, who may remember me if he hasn’t looked away and thought about something else, Tom, and Jay’s wailing about 10 feet away.

“I’m David,” he introduced himself to me, holding out his hand cheerily.

Tom wore an expensive, three piece suit and nervously twirled the keys to a Porsche around his fingers.  “You look tired,” David said to him — something David said to Tom a lot, which was his gentle way of saying, “you look old,” which was inevitable, because the Tom that David remembered was from twelve years earlier, before the accident.

“Will you stop saying that?” Tom pleaded.  Again.

David shrugged, realizing he must have said it before.

“I’m sorry, I guess I don’t know how you guys put up with that,” Tom gestured vaguely in the direction of Jay, who took a deep breath, paused just long enough to give us hope that he might stop, then resumed his siren-like scream.

David seemed genuinely confused.  “Put up with what?  That kid is clearly upset, and there’s not a thing we can do about it because of his condition.  But it does remind us how fortunate we are.”

“Fortunate?”  Tom seemed incredulous.  “You can’t remember anything, you can’t walk, you gave up your career and everything you ever loved, you’re sitting in a crappy cafeteria without any food listening to a kid scream at the top of his lungs, and you’ll never get any better.  You’ll never leave this place.  You’ll never remember anything.  You’ll never work again.  When your kids visit, you don’t recognize them, you don’t know who your grandkids are and soon you’ll stop telling me I’m tired and you’ll say ‘good lord you’re old’ every time I come and visit you.  How can you consider yourself fortunate by any stretch of the imagination?”

David took Tom’s hand.  “I’m happy.  I can get around, I like meeting people, and now I meet people all the time.  This chair is comfortable.  This table’s a nice color.  Everything’s new to me.  I’m always learning.  I can forget about absolutely anything I don’t like just by not thinking about it, and I can remember what I want by writing it down.  Here’s an example.”  David showed Tom something written on his hand.  “It says you visit me all the time here.  I wouldn’t remember that, and I’m sorry, but I love that you’re here, and it’s great that there are so many people who love and care about me.  That’s what being fortunate is.”

I realized that Jay had been quiet now for a minute or two.  I stepped over to see if he had returned to the world.

“How are you doing, Jay?” I asked quietly.

“Tastes more meatier!” he yelled enthusiastically, echoing the words of a commercial he’d heard.  While the words may not make sense, they at least seemed to match his emotional state.  We headed home.


I Hate You, Ventra

tempChicago’s transit system has had a few farecard systems:  over the past decade, a magnetic stripe system has coexisted with the Chicago Card (and Chicago Card Plus) contactless smart card system, an RFID system for electronically paying for bus and train fares.  The Chicago Card system is actually quite a decent design, where a rider can tap the card against a touchpad on a bus or turnstile, and set it up to automatically reload itself at set low balances.

This is being replaced by Ventra, which is also an RFID card, but with several important additional features designed by the criminally insane.  First, you’ll notice the debit Mastercard logo which appears on the Ventra card — this has two important implications.  The first is that instead of using a Ventra card at all, you can instead pay for your ride with any regular debit or credit card with an RFID chip, right?  That’s got to be handy.

Well, sort of.  Since most regular debit or credit cards won’t record, or more importantly, notify a turnstile about a transfer you just took, you’ll be paying full fare for any bus-to-train or train-to-bus or any other permutations of transfers for which you’d normally be entitled to a discount.  So consider yourself screwed there.

In addition, one of the popular uses of RFID technologies is to leave the devices in one’s wallet/purse/etc and wave it at the reader.  This is, shall we say, a really bad idea if every card in your wallet is going to pay for your train ride every time you walk through a turnstile.  Since a Ventra card is doing what an RFID Mastercard would be doing plus exchanging data about transfers, it’s actually a bit slower — perceptably so, if I may judge from the number of people giving themselves the Heimlich on the turnstiles while attempting to use their Ventra card.

On to the second implication of that Debit MasterCard logo:  the Ventra card can also be used as a debit MasterCard — not that the same debit balance used to pay for the train might also be used to buy a sandwich, or even that you can link the card somehow to your own bank account, but that you can set up a new, separate, prepaid debit account, because apparently you’re a raving lunatic who would rather spend hundreds of dollars on fees than carry around two cards, one for riding the train, and another one for buying sandwiches.  If you truly can only lift one card and have no need of extra money, you’re probably still better off with just a regular credit card.

In August, I got an email that I’m being transitioned from my working Chicago Card Plus to Ventra, along with a note that the balance from my Chicago Card would be moved to my Ventra card “as soon as” my Ventra card was activated.  In September, I received a Ventra card, with a letter referring to an email that supposedly had an access code that I’d need to activate it.

If I were a sociopath designing a card activation, I don’t think I could do better than online activation that makes you type in a lot of information in order to ultimately direct you to a help line, where the help line makes you type in your card number and other identifying information, places you on hold for a while, before announcing that the lines are all busy and maybe you should try activating online.

Over the course of several days, I took a spin through this circle of sadistic incompetence, but was rescued when I finally did get an activation email.  Well, rescued from the phone, anyway — it turns out the psychotic web designers spent a lot of time making a fairly pretty graphic of a spinning thing for you to look at for ten minutes before the web site tells you there’s some kind of error, and it can’t make the mandatory changes it requires you to make before allowing you to continue.

So the “immediate” balance transfer from my Chicago Card has been at least two weeks, and despite my customer service inquiry to the sociopaths at Ventra, there has been no response.  Not that I’m in any kind of hurry.


PC Repair and Sunk Cost Fallacies

We have a Gateway Profile 5.5 that we bought used at a Hamfest.  While not the latest or greatest, it was at least a solid workhorse of a machine, until it suddenly switched itself off.  When it came back on, the screen presented only this:

This system's cooling fan is not operating properly. Please check fan operation. 
Your system has been halted.

It probably wasn’t worth a lot of money to fix, so I made the natural assumption that one of the fans had either failed or was clogged with dust.  I thoroughly cleaned the interior, checked the fan bearings, cleaned the heatsinks and replaced the heat sink compound.  It worked for about a day before I got the same message, from which it absolutely refused to recover.

One of the fans was a relatively expensive squirrel cage fan, but fine, if it took new fans to make all this worthwhile, then I’d buy brand new fans.  The PC booted all the way, but wouldn’t run a full burn in test without shutting itself down.

The other possibility was that the sensors on the motherboard were defective.  Motherboards for the system were available, but at a premium relative to their capabilities due to their proprietary nature.  Fine.

As of this moment, to fix this problem, I have gone through:

  • 4 motherboards (2 refused to boot, 2 with the same fan message)
  • 2 sets of fans
  • 2 power supplies
  • An I/O board
  • A hard drive
  • A CPU
  • Two sets of RAM

In a very literal way, there is nothing left of the original PC except the LCD screen and a plastic shell, leading me with several possibilities:

  • This is a common problem due to a failure of a component on the motherboard
  • Through some relationship bordering on magical, the problem is caused by the LCD (or even more unlikely, by the case itself, somehow.)
  • I am exceedingly unlucky, and have experienced the same type of failure on multiple components within the same short period of time (or I manage to keep buying defective parts.)

The worst part is, even though I’m well aware of the sunk cost fallacy and that any further attempt to repair this PC is likely to result in nothing more than a time consuming way to dispose of money, the pile of parts which should be a functional PC instill an overwhelming desire in me to fix this PC, and once and for all find out what’s really wrong with it.

Probably ghosts.


PS3 Media Server and the Xbox 360

PS3 Media Server is a DLNA server capable of, among other things, streaming and transcoding local media files to Digital Media Players.  While this includes the PS3, it also includes the Xbox 360, which makes a pretty decent media player, and the server handles things like subtitles rather neatly.

Transcoding means the server can handle converting, for example, mkv video files on-the-fly, obviating any need to convert them before viewing.  However, my initial experiments with mkv files showed the following error in the debug log:

[wmav2 @ 0x33e4946240] output buffer size is too small

However, looking at the command issued to mencoder by PS3 Media Server, there were no knobs to increase the buffer size beyond what was already specified…  And only the Xbox 360 had this issue, as other devices did not require wmav2/asf.

Counterintuitively, the solution was to upgrade ffmpeg to 1.0.1.  While ffmpeg transcoding worked perfectly well, its libavformat and libavcodec libraries are used by mencoder to transcode to wmav2, and something between mplayer/mencoder and the older version of ffmpeg led to the error.

On a Gentoo box, this stack works well:

PS3 Media Server 1.72
MPlayer 1.1
ffmpeg 1.0.1

Kindle Lending Library List

I’m fond of the Kindle Lending Library, but it can be somewhat awkward to use — both returning books and locating books isn’t as simple as one would hope, the process generally being “search for a book and then see if it happens to have a lendable Kindle edition.”  While this is great if I know what book I want, sometimes, I just prefer something free to plow through.  Without further ado and for future reference, this link will show all Kindle Lending Library books and allow the results to be searched through in a sane way:


Fun with Extortionware, or Curse you, Java!

Safety on the internet — that is, protecting your computer from malware — used to be as simple as not downloading and running dodgy executable code.  Sure, some people were tricked, either via emails from “friends” or popups trying really hard to convince them to run a local binary.

Websites that wanted to provide a richer experience had a few options:  run ActiveX controls in IE — the notion of letting a binary run because a website told it to seemed stupid even at the time, even with the idea of “signed” ActiveX controls, so you’d know who provided a control.  There was Flash, a proprietary binary and scripting language now owned by Adobe, and then there was Java, which ran in its own virtual machine with limited access, which seemed like the saner of all the options.

Ransomware Screen

This ransomware screen appeared over pretty much everything

Recently, I stayed in a hotel where the first thing I did was poke through some of my history, looking for an article I’d been reading before — which I located, and about a paragraph in, my screen was entirely replaced with a (fake) FBI warning and a demand to pay a “release fee” of $200 to regain control of my computer.  This was accompanied by the hotel’s IP address, and a display window that was apparently supposed to turn on the PC’s camera and show me in my underwear.

This is known as the “FBI Green Dot Moneypak” scam, or the “FBI Moneypak Virus,” which actually covers a large family of extortionware — which is essentially a monetizing payload, like this scam, plus a way to deliver it to your computer.  In my case, the delivery mechanism appears to be a Java exploit, triggered by either a malicious ad from a site I’d visited before (at home we use a proxy that strips out suspicious ads, so it’s possible it had been there before, but my PC wasn’t actually infected until I visited the same site from the hotel.)

In my case, the infection was completely missed by malware scanners, which seemed to think that my PC was perfectly fine, and even ad hoc scanners proved relatively useless — even a few which claimed to be able to detect and remove this (detection is free, removal requires payment) were blissfully unaware that the infection had taken place.  Googling wasn’t a lot of help either, since I was either directed to sites with generic instructions to run whatever scanner they were hocking (none of which worked) or long lists of registry keys to check, none of which appeared to exist on my system.  So it was either hiding itself well, or too recent to be picked up by scan-based systems.

At any rate, since it was Windows 7, I was able to “switch user” to an Administrator account, and I since I hadn’t received a request to escalate permissions, chances were relatively good it hadn’t inserted itself too deeply into my OS.  I found two suspicious binaries — suspicious, because they weren’t where binaries typically go:  in c:\ProgramData was “lsass.exe” and in c:\Users\username\AppData\Local\Temp was “ctfmon.exe.”  Both of these are legitimate Windows binaries that would be run — lsass.exe, for example, is the Local Security Authority Subsystem Service, a legitimate version pretty much needs to be running or the system will restart, and ctfmon.exe activates the language bar.  Since I generally have that turned off, this is pretty suspicious, but even more suspicious is the location of these files.  Deleting them in safe mode (from an alternative account) cleared the infection, returning control of my PC.  The PC complained about not being able to find a few files it wanted to run on startup, but I considered that a good sign.

Meanwhile, I went back to my browser to examine the source of the infection, and surely enough, a Java plugin was enabled — and since it’s the only thing enabled, it’s pretty obvious that this was the source of the problem.

If you haven’t done so already, I’d recommend disabling your Java plugins (virtually no Internet site uses it any more) and any other plugins which you don’t actually need.  If you do use Flash, which is relatively hard to avoid, at least make sure it’s up to date.  Note that updating the version of Flash doesn’t necessarily update the plugin version, so check from within your browser, not just by looking at versions in the Control Panel.

Mozilla has a handy URL that actually works across browsers:



[not over] Packing for Travel

I recently stood in the airport security line, watching the passenger in front of me struggle with wangling his things into five bins, awkwardly shoving those plus a rollerboard and duffel bag down the belt.  “How long are you going for?” I asked.

“Oh, just the one night,” he said, noticing my one backpack and one bin (for the laptop. ) “Did you check your bags?”

“Heavens no, I’m only going for four days.”

As one who travels frequently, and has for a while, I make it a rule not to carry more than one bag unless I really need to, and with rare exceptions, I never do.  I realize some people may have medical conditions that force them to travel with special shampoo or dozens of shoes, or can’t lift enough to carry around a bag without wheels, but in my observation, people carry around a lot more than they actually need to.

I recently went through my travel kits and shed about a pound of stuff that is becoming less necessary:  an ethernet cable, a VGA cable, a few audio cables.  I’ve added a DVI cable to what I carry — it seems that hotel televisions will either accept this input (sometimes with a little fiddling) or be so antiquated or locked down that no connection is possible.

I do follow a few simple rules to keep things efficient:

  • Every cable is retractable.  This eliminates tangles and clutter, making packing quicker as well as reducing bulk
  • Everything but clothes in kits.  This serves a few purposes:  it’s easy to find things and tell if something’s missing in a small kit, and each kit serves a specific purpose.  So if I know I’m going to a country with non-US power, I can grab that kit, and I can leave the airplane power kit at home if I know the airplane doesn’t have power outlets (or it’s a short flight.)  It also keeps all the stuff from rubbing on each other.  I use colorful Guatemalan bags for each group of things.Kits
  • Check the weather.  While no forecast is perfectly accurate, it’s senseless to pack everything from a short-sleeved shirt to a parka “just in case.”
  • Stop carrying anything you don’t use.  I periodically go through everything I carry, and if it went on a trip with me and I didn’t use it, it’s probably not going next time.  (There are a few things that are handy to have and compact, like a lens cleaning cloth, that survive the purge, but not many.)
  • Clothes get rolled or bundled.
  • Don’t carry things the hotel has.  If there’s any doubt, it’s worth confirming, but carrying around a hair dryer or iron is pretty ridiculous for most destinations.  I’m usually fine with hotel soaps and shampoos, and carry a small amount of paper shampoo just in case.
  • As few devices as possible.  This is getting easier and easier, as one smart phone can eliminate almost everything else, but I still see people traveling with phones, mp3 players, laptops, DVD players, e-readers, tablets, hand held games, those massive Bose headphones, piles of media and god knows what else.
  • Devices that are as small as possible.  I’ll bring up the massive Bose headphones again — don’t get me wrong, they’re very nice, but they’re a lot to carry around.  Personally I take noise-canceling earbuds, which fit in a shirt pocket.  Laptops are a touchy subject, but there’s little reason to lug around a huge screen if you can plug it into one when you need it, and I’ve seen more than one person struggle with a laptop so large it couldn’t reasonably be opened in the space allowed by a plane seat.
  • Both hands empty.  This has a lot of implications, but essentially, if you have to carry something in your hands, it’s something you have to put down to use your hands, or learn to juggle.  If you’ve ever seen somebody carrying a bag in each hand take a phone call, you know exactly what I mean.  It’s one of the many reasons I prefer a backpack to a bag with rollers.
  • Use the “three things” rule.  People can generally keep track of a grand total of three things at a time, so (for example) it’s best not to have more than three things at a time out from your bag on the plane.  Kits are helpful here, since remembering three kits is three things, and you can check to make sure your kits contain the items they should without losing track of a long list of things.  (My memory is quite good, but I have better things to expend mental effort on than keeping track of a larger number of things.)

The breach that keeps on giving

In what should be old news by now, back in June, LinkedIn‘s servers were breached, leaking around 6.5 million user names and passwords.  Hackers were then able to determine (for the most part) what passwords were associated with the hashes and accounts.  While this may have compromised LinkedIn accounts, the greater problem is with any other accounts that happen to use the same username and password.

In my case, the only such pair was LinkedIn and, which was a bit sloppy on my part, but since I’m not in the habit of re-using passwords at all, it hadn’t occurred to me, nor had it occurred to me that this would present a problem until somebody managed to send an express package from the Ukraine, charging my account for it, to the tune of $60 or so.

While I’m kicking myself for this, it could have been a lot worse, even if I were to use the same password for email, which would then have allowed hackers to intercept “lost password” requests for all the accounts I have which don’t use the same passwords.

The lesson I take away is that even accounts I consider “unimportant” because they’re not linked to credit cards or can be used to make purchases should be given random passwords rather than common, disposable passwords.  And, of course, chaining accounts is bad.




FreeBSD bsdpan- to p5- migration for perl modules

FreeBSD has a package system to manage installations and dependencies, and so does perl.  Perl on FreeBSD, therefore, causes these to intersect in interesting, and sometimes suboptimal ways.

CPAN can be used to install perl packages that aren’t in the ports tree, and FreeBSD handles this with relative grace by including them in its package database with the prefix “bsdpan,” and be excluded from updates.  An identical package installed from the ports tree will be prefixed with “p5″ instead, and be treated as any other port, with dependencies and upgrades handled as part of the ports system.

After trying out a few CPAN modules (which in turn installed their own dependencies) I found myself with a great many “bsdpan” packages, which I’d prefer to tuck neatly into the bsd ports tree rather than continue to manage with CPAN, therefore, I whanged together a shell script to do it:

pkg_info | grep ^bsdpan | awk '{print $1}' > /tmp/bsdpan-to-p5.tmp
> /tmp/bsdpan-to-p5-2.tmp
cd /usr/ports
while read bsdname; do
  name=$(echo $bsdname | cut -c 8- )
  portpath=$(make search name=p5-$name | grep ^Path | awk '{print $2}' | sed -r 's/\/usr\/ports\///')
  shortname=$(echo $name | sed -r 's/(.*)-.*/\1/');
  if [ "$portpath" ]; then
     echo -n p5-$name is in ports,
       echo " adding to list"
       echo portupgrade -o $portpath -f bsdpan-$shortname >> /tmp/bsdpan-to-p5-2.tmp
     echo p5-$name not in ports
     portpath=$(make search name=p5-$shortname- | grep ^Path | awk '{print $2}' | sed -r 's/\/usr\/ports\///')
     if [ "$portpath" ]; then
       paths=$(echo $portpath | wc -w)
       if [ "$paths" -eq "1" ]; then
          p5name=$(make search name=p5-$shortname- | grep Port | awk '{print $2}')
          echo " ... $p5name found, using that"
          echo portupgrade -o $portpath -f bsdpan-$shortname >> /tmp/bsdpan-to-p5-2.tmp
done < /tmp/bsdpan-to-p5.tmp
rm /tmp/bsdpan-to-p5.tmp
echo "Starting conversion ..."
sh /tmp/bsdpan-to-p5-2.tmp
rm /tmp/bsdpan-to-p5-2.tmp

The script tries to automate a manual process of finding the corresponding “p5″ port for each “bsdpan” port, and builds a script that replaces each one using the portupgrade tool.

It doesn’t make any attempt to resolve dependencies, so it may take a few passes.  It also can’t help where a search for the port name returns more than one possibility (usually part of a longer name) or when the “p5″ name happens to be nothing like the “bsdpan” name, but in practice, there are only a handful of exceptions.