A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
The default manner in installing files in a Debian or Ubuntu package is to create a <package-name>.install file. That file has an extremely simple format that goes like this:
<path & name of file to install> <installation path>
You can repeat this for each and every file you want to install.
99% of the time, that works great and I tend to use it a log.
There are several issues with the default format in this file:
The path to the files changes if you have a single package or if you have two or more. In the Snap! Websites project, I tend to force at least two packages for that very reason. (i.e. one of the packages may be a -doc).
You can reduce the number of file referenced in the list by using a folder or a pattern (specifying a folder is similar to adding /* at the end of the path). In both cases, the main problem is that all the files that match will be copied.
In most cases, that's what we want, but I have a few situations where one extra file gets installed in that folder and only goes to the -dev version of the project. In that situation, I have to revert back to installing each file one at a time with the drawback that whenever another file gets added, I need to remember to add it to the .install file.
The last drawback is that we can't change the filename. If the input is "blah" then the output is going to be "blah". Again, 99.999% of the time, that's what we want. Why would we want to create a file named "foo" and when installed it gets renamed "blah"?
Well, that happens once in a while. There is an example in my alex-tools where I want to install a file named .lessfilter. In the source, I do not want to have the starting period (.) because that would hide that file and it makes it difficult to maintain that project if there are development files that are hidden.
So instead, I named the file lessfilter (no period) and at the time I want to install it, I want to be able to prepend the period... not possible in the default .install files.
One solution is to install the file properly in your Makefile. So in the Makefile you would copy the file lessfilter to an installation file named .lessfilter. That works well if you can install the in this manner. In general, this is what I would suggest you do.
The other solution is to tweak the .install file by:
1. Making is an executable (chmod a+x)
2. Adding the following as the very first line:
#!/usr/bin/dh-exec
3. And finally change the format by:
3.1 Adding an array between the two paths and filenames
2.3 Adding a filename to the right side
In my alex-tools project, I have the following lines:
debian/alex-tools/usr/share/alex-tools/skel/lessfilter => etc/skel/.lessfilter debian/alex-tools/usr/share/alex-tools/skel/lessfilter-firewall.sh => etc/skel/.config/alex-tools/lessfilter-firewall.sh debian/alex-tools/usr/share/alex-tools/skel/lessfilter-on-mimetype.sh => etc/skel/.config/alex-tools/lessfilter-on-mimetype.sh
As we can see, I also install the original files under /usr/share. Then I have them copied to /etc/skel as required. Only the first one really needs the new format.
Also if you do not creating more than one package, then all the other files that your Makefile installs are going to automatically be installed in your package. So there is no need to repeat everything. If you create two or more packages, however, you'll want to specifically list what gets installed in which package.
Recent Posts on The Linux Page: