0

I am trying to build a Debian package which installs a database (the DBMS is a dependency, this package makes sure a certain database is present). I would like postinst to take care of initializing the database with a schema, for which I have prepared a .sql file. This .sql script is only needed during installation; I do not see a need to keep it around afterwards.

How would I include such a script (or any resource file needed only by postinst) in a package? (Initializing the DB with the script is not the issue, as long as I know where the script resides.)

user149408
  • 1,255

1 Answers1

2

You need to install it as part of the package’s contents, somewhere like /usr/share/yourpackage. Files needed by postinst should be kept around in general, because your postinst might be used again after the first time it’s run (e.g. following a dpkg-reconfigure)... There’s no provision for deleting files shipped by a package (dpkg expects them to stay).

See also Where do temporary files go while installing a .deb package? and the dbconfig-common suggestion in my answer there.

Stephen Kitt
  • 434,908