Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to be able to view the scripts/triggers associated with a package due for upgrade so that I can tell, for example, whether it will result in the web server being restarted. I can't find an aptitude option to show me that (or apt/dpkg); the best I can get is the contents (files). Is there some combination of simulate/verbose/contents switches that I have missed that will show this?

Additionally, if a package results in something happening - like a service restart - that I don't want to happen right now, is there a way to install the package without running some or all of the scripts?

share|improve this question
    
Why was this voted down? It seems like a reasonable question to me (even though doing something like this should not normally be necessary). –  sleske Nov 30 '09 at 9:29
    
Beats me. No particularly abrasive comments or answers, just random downvote. As if "normally shouldn't be done" is the same as "never should be done under any circumstances and not even educational". :( –  Sam Brightman Dec 1 '09 at 14:22
add comment

3 Answers

up vote 6 down vote accepted

You can print the control file and some other information with dpkg -I package.deb, or use dpkg -e package.deb to extract only the control information files.

Also, you can do a dry run to see what dpkg would do with --dry-run:

dpkg --dry-run -i package.deb
share|improve this answer
    
I must have missed these options, thanks. -I doesn't seem to show much though - looks like first line (interrobang) only. –  Sam Brightman Nov 27 '09 at 11:15
    
Note: You need to have the package file available locally. Download it first via 'aptitude download <packagename>'. –  Martijn Heemels May 10 '11 at 12:36
    
The -e option will create a DEBIAN directory with the control file and the various script files that will be run. postinst is usually very interesting as it will be executed after the package is successfully installed. –  dwurf Mar 31 at 2:14
add comment

No, I don't know of any way to do this using aptitude.

You can look at the scripts directly; the scripts that run during upgrade are contained in the package. Unpack the deb using ar:

ar -x package.deb

Then look into control.tar.gz, it contains the scripts.

share|improve this answer
    
Would be better if aptitude -s with some verbosity options actually showed the scripts it would run for the whole upgrade. That's essentially what I was asking for, but I think Mikael's answer is slightly simpler. –  Sam Brightman Nov 27 '09 at 11:14
add comment

No, you can't run part of a maintainer script, there's no hooks to make that happen.

You can only view what the script would do by examining it by hand -- again, no "dry run" can tell you exactly what it will and won't do, only "I will run the postinst with these args".

These are the reasons we have staging and test environments.

share|improve this answer
    
I meant a subset of the scripts, not part of an individual script. Sorry if that wasn't clear. I don't want magic, knowing the script and the arguments allows me to hand inspect, or modify the parts that are inconvenient. –  Sam Brightman Nov 27 '09 at 11:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.