edit {hack} a .deb package to remove user options – silent install.

So, with my new Dell M1000e and M600 blades now sitting in their new home in my workshop and having tested all the blades are working (-1) I now need to load test them. I could just use a program designed for this, but i’m thinking that as i’ll be burning through a chunk of electricity i’ll put the compute cycles to good use (the heat will be keeping me warm). So i’m going to do some Folding at Home. If you don’t know about this, then you should check out this great project.

My team id is 232280. Feel free to join me.

Anyway, i’ll be running Ubuntu on the blades for a while (when I can get the latest version installing from USB), so I played around with installing inside a VM. The instructions for this can be found¬†http://folding.stanford.edu/home/guide/linux-install-guide/¬†but take them with a pinch of salt as a few links are broken/need fixing (i’m letting them know on the forum). The installer asks for user details as part of the package and you can’t do an ‘unattended install’ which is what I was after (for a very specific reason). NVM, i’ll just figure out how to disassemble the .deb package and change it.

I haven’t done this before so I started not know that it was possible, but it’s actually quite simple. I found a post explaining how to open and then recreate the .deb package.

mkdir tmp 
dpkg-deb -R original.deb tmp 
# edit DEBIAN/postinst 
dpkg-deb -b tmp fixed.deb 

…and then had a bit of a read up of what I found inside – read this, sec 7.6. After a bit of head scratching and a few edits that didn’t work I finally worked out what I needed to do to remove the user interaction. (some of this helped.) Rename the templates file and comment out the lines referencing db_get then add in the variables for user, team, passkey, power and autostart. (One thing I would like to do is add some sort of reference to different machines MAC address in the user but i’ll look into that later.) After doing this i’ve hacked the .deb into something that I can script silently – which means remote deployment :D.

I also came across https://www.linux.com/learn/writing-simple-bash-script while wondering the web – it’s really well written for beginners like me.

You can find my hacked .deb here. My team id is baked in. Install using:

wget http://www.crazy-logic.co.uk/wp-content/uploads/2017/01/FAHinstaller.deb
sudo dpkg -i --force-depends FAHinstaller.deb

ver 2 now includes the mac address in the username so i can see how much each blade will have done.

Bookmark the permalink.

Comments are closed.