I'm sure by now everybody in the whole industrial world has been familiarized with what a license agreement is and the absurdity of the lengths at which developers go through to make sure you accept the terms before you're able to use the software at all. It's that little 'I Accept' button you have to hit after you read the legalese of the license agreement. You DO read every license agreement you accept, right? That's what I thought.
Well, for the most part, that's fine when the license agreement you're accepting is for a piece of software that you're interacting with anyway. The problem comes in when you need to install something on say, 100 servers and no mechanism is given to accept the agreement without a curses interface in which you have to tab to the appropriate selection and say okay. Such is the case with attempting to apt-get Java on Debian. There are numerous hacks around this and I'll share one in a moment. But my gripe is, why do I need to hack around this in the first place? Why can't I just specify an affirmative on the command-line somewhere.
I'm not a fan of the apt/dpkg system. I frown on binary packages despite their obvious advantages of being incredibly quick to install because all the compilation work is already done. Everything that comes up in post-install as a question should be able to be answered by specifying arguments on the command-line but to my knowledge, this isn't the case. This is another reason why I don't like apt I guess.
So the workaround I was talking about. After some minor googling, I found a pretty nice dphys-config package that can thoroughly configure a system via configs retrieved by HTTP though it was a bit overkill for simply accepting a license agreement. So I did find enough information and a debconf script that is remarkably simple and sets the acceptance as true in the debconf db. The problem I had with the script that I found was that it didn't work if Java wasn't at least attempted to be installed prior because the db entries weren't there yet. The fix for this was for me to just sloppily append them to the config.dat file.
#!/bin/bash
. /usr/share/debconf/confmodule
db_version 2.0
db_capb backup
license=sun-dlj-v1-1
db_get shared/accepted-$license
if [ "$RET" = "true" ]; then
echo $license license has already been accepted >&2
exit 0
fi
db_set shared/accepted-$license true
db_get shared/accepted-$license
if [ "$RET" = "true" ]; then
echo $license license accepted >&2
exit 0
else
echo "Name: shared/accepted-sun-dlj-v1-1
Template: shared/accepted-sun-dlj-v1-1
Value: true
Owners: sun-java5-bin, sun-java5-jdk, sun-java5-jre
Flags: seen
" >> /var/cache/debconf/config.dat
echo $license license entry created and accepted >&2
exit 0
fi
I know this isn't elegant and there are probably better ways of doing this. If you know of one, let me know!
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
No feedback yet
Leave a comment
