A look at a *good* PBI install script from 2007.

In looking around my ~/Projects folder, I found an old PBI install script I wrote a couple years back. When I was working on a TexLive PBI (only me and Oko were interested), I wrote a very robust script. Most PBI that use install scripts should be nearly like this but normally, they only handle the GUI case and screw you if you use text mode or have special need.

This script was written to the published API at the time, which basically amounted to $INSTALLMODE being set to tell you if you were in a GUI or not; a variable to tell you what name your PBI would have inside /Programs. This was an improvement over using “$1” everywhere, as was required in previous versions of the PBI API.

Here is my old script:

#!/bin/sh

# the year of this release, e.g. 2007, 2008 e.t.c. -> This should be equal to
# the Program Version we set in PBC.
YEAR="2007"

# the size of all our installed files in $PBI_BASE/texlive/$YEAR/
TEXSIZE="1.1GB" # as a string

# compat check.. should be unecessary but I don't trust PC-BSD. Since users can
# now override our install location and documentation does not talk to us about
# coping with it not being /Programs/$PROGDIR/, abort install rather then risk
# performing undefined/undocumented behavior should /Programs/$PROGDIR be
# overrided.

if [ -d "/usr/Programs" ]; then
PBI_BASE="/usr/Programs"
elif [ -d "/Programs" ]; then
PBI_BASE="/Programs"
elif [ -d "/usr/local/MyPrograms" ]; then
PBI_BASE="/usr/local/MyPrograms"
else
if [ $INSTALLMODE = "GUI" ]; then
kdialog --sorry "Can't find PBI Installation Directory... aborting"
else
echo "Can't find PBI Installation Directory... aborting"
fi
exit 255
fi

# set the path
MY_TEX_PATH="$PBI_BASE/texlive/$YEAR/bin/i386-freebsd/"


# XXX check if we are already installed or improperly installed

if [ -d "$PBI_BASE/texlive/$YEAR" ]; then
if [ $INSTALLMODE = "GUI" ]; then
kdialog --sorry "$PROGDIR appears to be already installed, aborting"
else
echo "$PROGDIR appears to be already installed, aborting"
fi
exit 255
fi

# give the user a chance to abort the installation
if [ $INSTALLMODE = "GUI" ]; then
kdialog --warningyesno
"The installation requires approximatly $TEXSIZE of disk space Continue?"
if [ $? -gt 0 ]; then
exit 1
fi
else
echo "The installation requires approximatly $TEXSIZE of disk space"
echo -n "Continue?[yes/no]"; read GO
echo $GO | grep -i "no"
if [ $? = 0 ]; then
exit 1
fi
fi


# Do installation
echo 'MSG: Setting up TeX Live directory'
mkdir -p $PBI_BASE/texlive/$YEAR
ln -s $PBI_BASE/texlive/$YEAR $PBI_BASE/$PROGDIR/TEXLIVE_$YEAR

echo "MSG: Installing TeX Live files..."

# extract our texlive installation
cd /$PBI_BASE/texlive/$YEAR/ &&
lzma d texlive${YEAR}.tar.lzma -so | tar -xpf -

# prompt for a default paper size
if [ $INSTALLMODE = "GUI" ]; then
PAPER=`kdialog --combobox "Select default paper size"
"A4 Paper" "US Letter"`
else
echo -n "default paper size [A4 Paper, US Letter]: "; read PAPER
fi

echo $PAPER | grep -i "Letter"
if [ $? -eq 0 ]; then
texconfig-sys paper letter
fi

echo $PAPER | grep -i "A4"
if [ $? -eq 0 ]; then
texconfig-sys paper a4
fi


echo "MSG: Updating TeX filename databases"
texconfig-sys rehash


if [ $INSTALLMODE = "GUI" ]; then
kdialog --yesno
"Congratulations! Installation complete -- test installation?"
if [ $? = 0 ];then
cd /tmp/
$MY_TEX_PATH/pdflatex sample2e.tex && kpdf /tmp/sample2e.pdf
if [ $? -gt 0 ]; then
kdialog --error
"The test may have failed to load, please report any errors: $?"
fi
fi
echo "MSG: Displaying readme file"
kwrite $PBI_BASE/$PROGDIR/PBI_README.txt
else
# I don't know a programa off hand to use for console output.
more $PBI_BASE/$PROGDIR/PBI_README.txt
fi

What is wrong with that script? Nothing compared to what is wrong with the PBI script API.

$PROGDIR should expand to /Programs/ProgNameVer instead of ProgNameVer.

The maintainer shouldn’t have to treat GUI and TEXT mode differently – the API should do it. In fact, that was the main impetus for the EPI spec creating platform independence. In an EPI, people would have said ask the user a question. Not have to understand shell script and massive toggles for GUI/TEXT mode install.

I believe PBI now also do similiar idiocy in regards to fonts handling that should be done at a higher level. However, according to the officially published documentation, my old script is still the correct way to go with a PBI.

One of the reasons I gave up on Kris Moores PBI, was the brain damaged design, the other reasons were the total miss management of PBI…

Under the draft spec’s I wrote for EPI, the above script would have become something like this:

# optional EPIL script for EPI

define question dialog with
title = "TextLive EPI"
message = "Please set a default paper size"
default = "A4 Paper"
options = ['A4 Paper', 'US Letter']
launch as paper_size

if paper_size == "A4 Paper" then do
execute "texconfig-sys paper a4"
else
execute "texconfig-sys paper letter

Now I ask you, if you were not a programmer, which one do you understand? Then let me ask you, if you just want to get on with your life, which would you rather write?

Both the PBI sh and EPI EPIL scripts would result in a simple dialog asking you to choose from one of two options. If you know how to use TexLive, the EPIL script would be totally unnecessary because you already know how to change paper sizes. That means you don’t even have to write a script at all in a normal case.

End result? Oh so simpler.

Marley & Me

Tonight I was watching a movie called Marley & Me. The films an excellent glimpse into what life can be like, for anyone who hasn’t bee living with their head so far up their arse to notice 8=) It’s about a couple of newly weds, who trade the winter for a warmer location in Ft. Lauderdale, south Florida. In order to stave off his wife’s plans for a family for a few years, journalist John Grogan springs an early birthday present on his wife Jenny: they adapt a yellow Labrador Retriever, the clearance puppy. While successful in his intentions, Johns plan backfires when young Marley proves to be one of the worlds most hyper destructive dogs, yet too much of a lovable lug to just get rid of anytime soon. The movie charts a course that I would call “A slice of paradise” with all of it’s pitfalls to go along with it. Marley & Me follows the lives of the Grogan family, and dear but incorrigible Marley, If you love dogs, you’ll love Marley, if the exact opposite is true, well you’ll be relieved not to be in such deep doggy waters >_>. I love animals, always have and likely always will; having dogs, I can also be sympathetic to the whole ruckus caused by Marley. Hmm, for some reason I can’t help but remember a dog named Milo, that I used to help look after years ago as part of this business; he too failed obedience school (horribly lol).

For me, I would say it is fair to say that I feel a bit of a personal connection with this film. Fort Lauderdale is the city that I grew up in as a child, so Broward county is a name I’d know anywhere, and the news paper in South Florida, is also one that my parents used to deliver for… it’s a small world, isn’t it? Even closer to home then that, their first sons name, Patrick was also the name of one of my elder brothers: most people that know me fairly well, also know that I have an older brother but there’s more to my families history then that. In short, my brothers Reese and Patrick were twins, but only Reese survived. My father also had a son, long before I was born, but Jeffery never quite made it into this world :'(. Whatever the afterlife holds, one thing that I have always hoped, is that someday I’ll see us all together in heaven.

As everything must someday, life on earth eventually comes to an end, and Marley is no exception to that rule. Years role on, and take their toll: Marley grows old, as we all will some day. The ending is very sad, but I would have to say that he had a very good life, and it was one full of much chewing too ;). I think that perhaps, this line from the film sums up best what it’s like to have someone like that in your life:

John Grogan:

A dog has no use for fancy cars, big homes, or designer clothes. A water log stick will do just fine. A dog doesn’t care if your rich or poor, clever or dull, smart or dumb. Give him your heart and he’ll give you his. How many people can you say that about? How many people can make you feel rare and pure and special? How many people can make you feel extraordinary?

If anyone can watch Marley & Me, and take the ending without drawing a tear along the way: I truly feel sorry for any animals in that persons care.

We all have people in our lives, animals as well, that are such an integral part of our life, of every thing that makes it worth living. You can’t hope for more then that.

of passwords and tags

Having some spare time, I set to updating my code books while I wait on the Google Wave video to reload; I had to pop off at ~55min for a Live Operation ;). Ahh, crud! Now it looks like I’m going to be interrupted by dinner 8=).

Around late April, I devised a new schema for how I handle my password management—yes I am insane. I actually do have an encoding system for increasing password strength, that is tied to how my brain functions. It’s built from a system of standard passwords that are pseudo-salted with mnemonics that are tied to both the schema and how my brain internally organizes data. The end result, a systematic password that is more difficult to brute force, and hard to guess unless you are me ;).

I’ve just converted about 50% of my core services to the new password system, and I’ll do the rest tonight.

At the moment, my bookmarking has been focused around delicious. The pattern I have chosen for tagging is roughly the same as what I’ve been using in Gnolia; Category/Sub-Category/… and in place of larger meta tags (e.g. Programming/Perl) I’ve bundled the tags. It’s an informal hierarchy but rather nifty. Gnolia lacks bundles which I dislike about it, but honestly the only thing Delicious’s method offers in improvement, is you can’t forget to add the meta tag along side the regular one (e.g. Programming/Perl/Frameworks).

The tags I’ve arranged are strongly organised, I like keeping things tidy. There is a simple “Personal” tag for things connected with me, Services/ for various services: Services/Webmail for example contains marks for Google and Live mail. Programming/Language/{Distributions,Documentation,Modules,Frameworks, …} is also in use

For some reason, I love organizing crap…. lol.

Something about this song just grows on me

Mister Officer, I didn’t mean to speed
No I didn’t know I was pushing 90
Mister Officer it’s such a pretty day
Can’t you let me go with just a warning

Mister Officer, I’m so sorry
Yes I know that this is not the autobahn
Mister Officer this isn’t like me
Yes sir, yes I have a reason

I had the top down the radio blaring through the speakers
I think I blew a speaker out
I wasn’t trying to be reckless
I wasn’t even in a hurry
I just can’t stop thinking bout him
Can’t stop thinking about him
Shouldn’t be thinking while I’m driving but I can’t stop

Mister Officer I didn’t see you
And I guess I didn’t hear your siren
Mister Officer I know you’re serious
I can’t help it if I can’t stop smiling

I had the top down the radio blaring through the speakers
I think I blew a speaker out
I wasn’t trying to be reckless
I wasn’t even in a hurry
I just can’t stop thinking bout him
Can’t stop thinking about him
Shouldn’t be thinking while I’m driving but I can’t stop

I had the top down the radio blaring through the speakers
I think I blew a speaker out
I wasn’t trying to be reckless
I wasn’t even in a hurry
I just can’t stop thinking bout him
Can’t stop thinking about him
Shouldn’t be thinking while I’m driving but I can’t stop
Can’t stop thinking bout him
Can’t stop thinking about him
Shouldn’t be thinking while I’m driving but I can’t stop

Mister Officer, I didn’t mean to speed
No I didn’t know I was pushing 90
Mister Officer it’s such a pretty day
Can’t you let me go with just a warning

— Mister Officer, Jypsi



Bugs can be fun, as long as I didn’t write them

In order to make optimal use of tonight, I did a portsnap and fed a list of ports to be updated, into my updater.sh script; then went to work on playing with pthreads. A short while later, when things got to ImageMagick, I got the shock of my week—pkg_delete crashed during a make deinstall!

In looking through the code, I’ve found the reason why, there’s a package name passing through the code as a null by the time it finishes passing through pkg_do in src/usr.sbin/pkg_install/delete/permform.c. From the looks of things, it goes bonkers once Plist is setup via read_plist(). Hmm, well well, the Package (_pack) structure being passed to it has rather interesting contents at the time.

I just don’t have much more time to fiddle with this damn thing! I’ve got to be up for another groaning day of work tomorrow.

OK, found it, there’s some funkyness here. When it hands off to add_plist (basically every damn thing in the bloody +CONTENTS), it has NULL’d the dohicky that gets copied in later. read_plist() sucks a file line by line, looks like if the trailing character is a space, read_plist() sets it to the null character ().

That creates a bit of a problem, because the +CONTENTS file for ImageMagick has a line ‘@pkgdep ‘, which results in pissing off the whole damn thing… lol.

So… how to handle this problemo? I see two things: 0.) pkg_delete should NEVER FUCKING CRASH!!!! No matter what is in a +CONTENTS file, at least, that is my opinion!!! And 1.) if ‘@pkgdep ‘ is not valid in a +CONTENTS file, whatever causes ImageMagick/ports to be shoved there needs to be found and fixed. Digging into +CONTENTS file creation is a beast for another hour. Why the pkg_delete program chooses to pass a NULL through I have no bloody idea, maybe shifting through CVS logs might hold the answer to that mystery. The pkg_install suite has some rather ugly and quickly hacked together parts, that really makes me wish they had used shell or (like OpenBSD) imported Perl into the base for the job, rather then doing it in C. Don’t get me wrong, I like C, but please don’t write functions with over 1,000 Lines Of Code ;). Either way, when it comes to fixing the pkg_install issues… that’s something I’m not going to touch unless a developer suggests what they would like to see in a patch, because whomever is maintaining it, should have a better overview of things then I do at the moment; I’m in no shape to do any more thinking tonight. Perhaps I’ll just file a bug report on it and see what comes of it.

Right now I just need to get some freaking sleep before work. Ugh, stairs here we come…….

Interesting tidbit: Twitter Talking Separately to Microsoft and Google About Big Data-Mining Deals

Shared from Google Reader

Twitter Talking Separately to Microsoft and Google About Big Data-Mining Deals—BoomTown

If this is how they plan to make a crappy search engine (Microsoft’s) better, by trusting in Twit’wits, oh boy and I glad that Mage introduced me to Google all those years ago lol.

I’ve used several search engines over the years, in the end I have no respect for Microsoft’s offering (Hotmail has improved, search has not) and some respect for the one over at Ask.com; which I was introduced to when some program (thankfully) changed my default search provider in IE. Since I’ve never used Yahoo! For searching, I generally skip commenting on them. Microsoft how ever, I used there search engine for many many years, dating all the way back to WebTV—at least Google tries to find what I’m looking for ;).

Notes over lunch

Work yesterday was fairly uneventful, so it left me time to concentrate on programming, doubt Friday will be so lucky… lol.

I worked out the basic architecture for pipin’s daemon, and have had the details on my mind for most of time since ~1400Q yesterday. Current on the hit list, is a pair of prototypes: one built around libpurple, that is to deal with the issue of a bare bones get connected task, the other is an experiment in moving the “Gatekeeper” component into its own thread. Once both prototypes are done, I’ll look at merging them and re-evaluate how they play together versus mucking around with GLib’s main loop. Conceptually, pipin-imd consists of three units: purple, dispatcher, and gatekeeper. The purple unit deals interfacing libpurple into our own kit; the dispatcher in mapping between purple/pipin-im events and notifying all registered clients; and a gatekeeper to manage incoming data from pipin-im clients. I also have an idea of how the communications protocol between daemon and server might work, not to mention the fact that I want a simple net command shell that would allow communicating with the daemon via a shell or batch script lol.

The plan is for the daemon to be written in C and licensed under the GPL, since purple forces use of GLib, there is no reason to use C++ for sake of the Standard Template Library. Whatever the legality of using Python ctypes based or SWIG generated code to interface with libpurple is, I doubt it would be in the spirit of the damn blasted GPL, even if the license was less restrictive >_>. The client unit, I plan to write in Python using whichever widget toolkit proves most appropriate (Qt, GTK, Wx). The daemon is a pretty simple program, the client side stuff gets all the fun, and a license more in line with my ideals of freedom, then the uglicious GPL.

Originally I had planned to work on the threaded gatekeeper prototype during the time before dinner and afterwards, but never got around to it. It wasn’t a good nights sleep, but at least I went to bed early for a change…. lol

Present open-loops

  • General SAS related work
  • Making my game prototype load key=command mappings out of an rc file
  • Finish Cara’s skins
  • Get to work on pipin-ims backend daemon
  • *Several* personal but business related web-projects
  • Continue compiling my letter about PC-BSD shortcommings
  • Setup/test CppUnit, Boost, and POCO
  • Customize Irssi and evaluate its possiblities for replacing Weechat
  • Figure out how much crap didn’t make it onto my todo list before it fell off
  • Work on the SAS Tactical Command Interface
  • Work on several other small SAS-related projects

and all I can think about right now is a quick snack…. lol

Sweet, Google Reader can send things to LiveJournal

Like many people, I often have things that I want to follow, but can’t be arsed to check up on periodically; the solution of course is RSS or “Really Simple Syndication” feeds. The age old problem is the bother to actually _look_ at the RSS feeds in question lol. A while ago, I switched to Google Reader during a period of reorganisation; a topic that I should probably revisit in a few weeks.

While much of my life is an open book, most of the services I use are not very integrated even when they are capable of it; this is mostly by my intention! Most people on planet earth and beyond, can reach me via instant messenging—the prefered way, since I’ll hang ya if the phone rings >_>. My LiveJournal is my ‘personal’ place, and perhaps consequently one of the most public. There are other mainstream services that I’ve come to employ, which kind of creates a bit of an onion approach to my data lol. LiveJournal serves me, I don’t actually care whether anyone reads it or not, after all it replaced mounds of log files and such, and that is what its principal purpose was and still is ^_^.

One of my friends makes use of Google Reader, so I’ve started exploring Readers ability to share and comment feeds with others; which lead me to this little puppy: “Send To” LiveJournal and Iterasi for Google Reader. Combined with a few other tidbits, this might get more frequent use: most things of interest to me in regard to RSS feeds, end up noted int his journal anyway, well if time permits lol.

The entry I’ve setup in Google Reader, thanks to the help of that link, results in exactly the kind of thing that I want: a suitable subject (that makes searching my lj easy) and a message starter that I can live with.