简体   繁体   中英

What code is run when a .deb is installed?

When I install the elasticsearch debian package the files are copied to various folders in my system and the elasticsearch server is started.

How does this happen? which files inside the .deb package contain all this installation information?

When I view the package, I see the following files:

➜  downloads  dpkg-deb -c elasticsearch-0.90.2.deb 
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/elasticsearch/
-rw-r--r-- root/root       165 2013-06-26 08:56 ./usr/share/elasticsearch/NOTICE.txt
-rw-r--r-- root/root      7942 2013-06-26 08:56 ./usr/share/elasticsearch/README.textile
-rw-r--r-- root/root      2031 2013-06-26 08:56 ./usr/share/elasticsearch/core-signatures.txt
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/elasticsearch/bin/
-rwxr-xr-x root/root      5511 2013-06-26 08:56 ./usr/share/elasticsearch/bin/elasticsearch
-rwxr-xr-x root/root      2099 2013-06-26 08:56 ./usr/share/elasticsearch/bin/elasticsearch.in.sh
-rwxr-xr-x root/root       740 2013-06-26 08:56 ./usr/share/elasticsearch/bin/plugin
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/elasticsearch/lib/
-rw-r--r-- root/root  11000124 2013-06-26 08:56 ./usr/share/elasticsearch/lib/elasticsearch-0.90.2.jar
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/elasticsearch/lib/sigar/
-rw-r--r-- root/root    246605 2013-06-26 08:56 ./usr/share/elasticsearch/lib/sigar/libsigar-amd64-linux.so
-rw-r--r-- root/root    494929 2013-06-26 08:56 ./usr/share/elasticsearch/lib/sigar/libsigar-ia64-linux.so
-rw-r--r-- root/root    233385 2013-06-26 08:56 ./usr/share/elasticsearch/lib/sigar/libsigar-x86-linux.so
-rw-r--r-- root/root    428580 2013-06-26 08:56 ./usr/share/elasticsearch/lib/sigar/sigar-1.6.4.jar
-rw-r--r-- root/root    865400 2013-06-26 08:56 ./usr/share/elasticsearch/lib/jna-3.3.0.jar
-rw-r--r-- root/root    770462 2013-06-26 08:56 ./usr/share/elasticsearch/lib/jts-1.12.jar
-rw-r--r-- root/root    489884 2013-06-26 08:56 ./usr/share/elasticsearch/lib/log4j-1.2.17.jar
-rw-r--r-- root/root   1563004 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-analyzers-common-4.3.1.jar
-rw-r--r-- root/root    296563 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-codecs-4.3.1.jar
-rw-r--r-- root/root   2213537 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-core-4.3.1.jar
-rw-r--r-- root/root    107736 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-grouping-4.3.1.jar
-rw-r--r-- root/root    123614 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-highlighter-4.3.1.jar
-rw-r--r-- root/root     63680 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-join-4.3.1.jar
-rw-r--r-- root/root     35907 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-memory-4.3.1.jar
-rw-r--r-- root/root    202556 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-queries-4.3.1.jar
-rw-r--r-- root/root    385813 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-queryparser-4.3.1.jar
-rw-r--r-- root/root     45506 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-sandbox-4.3.1.jar
-rw-r--r-- root/root     92692 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-spatial-4.3.1.jar
-rw-r--r-- root/root    142268 2013-06-26 08:56 ./usr/share/elasticsearch/lib/lucene-suggest-4.3.1.jar
-rw-r--r-- root/root     69290 2013-06-26 08:56 ./usr/share/elasticsearch/lib/spatial4j-0.3.jar
drwxr-xr-x root/root         0 2013-06-26 08:56 ./etc/
drwxr-xr-x root/root         0 2013-06-26 08:56 ./etc/default/
-rw-r--r-- root/root       890 2013-06-26 08:56 ./etc/default/elasticsearch
drwxr-xr-x root/root         0 2013-06-26 08:56 ./etc/init.d/
-rwxr-xr-x root/root      5469 2013-06-26 08:56 ./etc/init.d/elasticsearch
drwxr-xr-x root/root         0 2013-06-26 08:56 ./etc/elasticsearch/
-rw-r--r-- root/root     12519 2013-06-26 08:56 ./etc/elasticsearch/elasticsearch.yml
-rw-r--r-- root/root      1380 2013-06-26 08:56 ./etc/elasticsearch/logging.yml
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/lintian/
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/lintian/overrides/
-rw-r--r-- root/root       482 2013-06-26 08:56 ./usr/share/lintian/overrides/elasticsearch
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/doc/
drwxr-xr-x root/root         0 2013-06-26 08:56 ./usr/share/doc/elasticsearch/
-rw-r--r-- root/root       741 2013-06-26 08:56 ./usr/share/doc/elasticsearch/copyright

.deb files are ar archives. You can extract it with

ar x elasticsearch-0.90.2.deb 

This contains

debian-binary
control.tar.gz
data.tar.gz

You can extract the control.tar.gz with

tar xvzf control.tar.gz

This can contain four scripts: prerm , preinst , postrm and postinst

postinst is the post install script.

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM