Building my own .deb package (help on postinst config)
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Building my own .deb package (help on postinst config)
Hi all, first excuse me if this is more suitable on the programming section (a mod can move it there if he/she prefer). The point is this: I'm building the linux packages for Mercury (a multiplatform MSN messenger clone). Since it's distributed in binary .zip files, I have to make a virtual file system on my home directory and then run 'dpkg-deb -b /home/username/fake_file_system' to build the package, after that, I convert the .deb package to .rpm and .tgz packages using alien. Everything works like a charm, no problems here, but I'd like my packages to come preconfigured for new users because Mercury has a lot of hidden options and need some tweking to work properly (to use the sound system of the desktop you're running and to set the default browser, etc.); for this, Mercury uses a file named GlobalSettings.xml which is stored under /home/username/.Mercury; so basically what I need is to create two GlobalSettings.xml files: one for KDE (using artsplay as sound player) and other one for GNOME and other DE's like fluxbox, XFCE, etc which use mainly alsa as the default sound player. (I think these two files could go in '/usr/share/mercury'), but I need a postinstall script which detects whether the directory '/home/username/.Mercury' exists or not, and if the directory exists do nothing (don't write a new GlobalSettings.xml file there because it would erase a previous config), but if the directory does not exist, then detect which desktop is the user running and write one of the 2 GlobalSettings.xml files in the directory.
So my question is, which file(s) under my /home/username/fake_file_system/DEBIAN directory do the job of the post-installation config and which manual(s) should I read in order to edit these files (so far I only have a '.../DEBIAN/control' file). I've read the debian new maintainers' guide and they say something about a postinst.ex file which, I assume' is the one that does this job, but the reference is rather superficial and doesn't point me to any other manual on how to create a postinstall configuration file.
Oh, and another question: after succesfully building a preconfigured .deb package will this package run fine on other systems after converting it with alien?? (I mean, the postinstallation script will run on the .rpm and .tgz packages??).
Well, your cause is very noble, but it's still a script request. Not sure if that's allowed here.
Anyway, I'll give you the benefit of the doubt. Try this:
Code:
#! /bin/bash
S1=`ls -a $HOME | grep .Mercury`
if [ "$S1" = ".Mercury" ]; then
echo found a previous Mercury install, not writing default configuration
exit 0
else
echo no configuration file found, creating default
# <insert write command for xml file here>
exit 0
I know this fails, but you'd have to think along this line.
Hi Dutch Master, thanks for your answer. Well, I don't see anything wrong with scripts as they can be very usefull in these cases (I don't know how to make complex bash scripts, but I can try with a guide under my arm, lol). But what I'd specially like to know is, which file(s) of the debian packaging system do the job of the postinstall configuration. Also a good manual on how to edit these files would be very usefull for me (I've read the Debian New Maintainers' guide but as I said above, the reference to the postinst.ex file is rather vague).
Anyway, creating preconfigured linux packages of Mercury is not that important since most of the people using mercury has a previous configuration (it would be usefull only for new users)... I rather see this as an opportunity to challenge myself and learn something new, but if it's too complex for me to write these scripts, well, I'll leave it like that (I've managed to build the packages anyway).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.