LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-26-2007, 07:45 PM   #1
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
Question 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??).

Thanks in adavance.
 
Old 01-28-2007, 07:49 AM   #2
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
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.
 
Old 01-28-2007, 08:52 AM   #3
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Original Poster
Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
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).

Thanks in advance.
 
Old 01-28-2007, 10:49 AM   #4
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Original Poster
Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
ok, I found the file in question, it's the 'postinst' script under the '.../DEBIAN' subdirectory of the fake file system... Thanks for your help.
 
  


Reply

Tags
build



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.deb postinst and prerm probs mithereal Debian 1 09-28-2005 02:24 AM
How to make deb package chrisstooss Debian 6 09-16-2005 05:21 PM
How to install deb package tstrickland Linux - Newbie 10 07-21-2005 06:39 PM
help with deb package on Xandros 3.0 xiongnu Debian 2 06-08-2005 11:03 PM
building optimized deb-src packages (debian/rules) Rounan Debian 1 02-17-2004 12:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration