[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg -i from within postinst script



On Thursday 13 November 2008, "Anton Piatek" <anton@piatek.co.uk> wrote 
about 'Re: dpkg -i from within postinst script':
>2008/11/13 François Cerbelle <francois@cerbelle.net>:
>> Le Jeu 13 novembre 2008 12:26, Anton Piatek a écrit :
>>> Installing this package pops up a debhelper choice of which packages
>>> they want to build and install. I suppose I am closest to m-a in how
>>> it is working.
>>
>> Ok, so you could use the second solution (as msttcorefont or
>> flashplayer-nonfree):
>> - postinst ask the user where the tar.gz file is
>> - if the user dont have it, postinst download it for him
>> - postinst installs the tar.gz in the right place and tracks the list
>> of files
>> - prerm delete the file tracked at the postinst stage.
>
>It is easier to use make-jpkg to sort our the java package, as it has
>the same layout as other java packages.
>This way I don't have to work out all the extra things I need to setup
>for java to work properly (alternatives etc)
>
>So without hacking make-jpkg to bits, I end up with a .deb which needs
>installing

Do the installation without acquiring dpkg locks then.

Suggestions:
1) dpkg -x shouldn't lock the dpkg status, and you can just extract to /.  
You should be able to run the extraction in verbose mode to record 
everything that's extracted.  You could even run the {pre,post}{inst,rm} 
hooks if make-jpkg generates any.  Even if dpkg -x checks the status of 
the lock for some reason, .debs are just ar archives with tar.gz files 
inside, so you can extract with non-dpkg tools.

2) Roll you own dpkg that doesn't check the locks or changes the locking 
strategy.  You should be able to hack the dpkg source to build a slightly 
different package that installs a dsubpkg binary, for example.  Depending 
on how the locking API works, dsubpkg might make sure the lock is already 
held as it starts up (where dpkg would acquire the lock) and warn/error if 
the holder of the lock has changed as it exits (where dpkg would release 
the lock).

3) If you see similarities to m-a in your package, have end-users use your 
package like they use m-a.  A.k.a: Don't try and install a package during 
your postinst.  Don't break debian-policy and prompt users with "news" 
(new packages or new versions) during install/removal [using debconf or 
not].  One script with a short name isn't going to break many users.

4) Hack make-jpkg to bits. ;)  Seriously though, if it's building the deb, 
it shouldn't be too difficult to modify into actually doing the install.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: