I have a trivially simple command-line program that literally consists of a python script and some helper shell scripts. I'd like to learn about packaging this program, though it is trivial.
From what I gathered, I went the configure/make/install route. Since I didn't have anything to configure, or anything to make, I simple created a Makefile with nothing but an install section:
install:
cp ./myProgram /usr/bin/my-program
chown root:root /usr/bin/my-program
chmod 777 /usr/bin/my-program
cp -r ./ProgramResources /usr/lib/my-program
chown -hR root:root /usr/lib/my-program
chmod -R 777 /usr/lib/my-program
At this point, my program installs and runs fine with sudo make install.
Then, I attempt to make a deb file using checkinstall as follows:
sudo checkinstall sudo make install
It appears to get past the install part, as it reports it successful, but then fails:
======================== Installation successful ==========================
cp: cannot stat `//var/tmp/tmp.jKCmESc0v7/newfiles.tmp': No such file or directory
Copying files to the temporary directory...OK
Stripping ELF binaries and libraries...OK
Compressing man pages...OK
Building file list... FAILED!
Building Debian package...OK
Installing Debian package...OK
Erasing temporary files...OK
Deleting temp dir...OK
**********************************************************************
Done. The new package has been installed and saved to
...
The program is installed, but as far as I can tell, this newly made .deb file does nothing. dpkg -L my-program yields only
/.
and manually removing it and installing from the deb file doesn't appear to do anything - it doesn't actually put any files anywhere.
So, (1) Is there anything wrong with my approach? and (2) How can I fix the checkinstall problem?
Thank you very much for answers, even though I'm good with code, I've never known anything about packaging/distribution.
checkinstall keeps track of all the files created or modified by your installation script, builds a standard binary package (. deb, . rpm, . tgz) and installs it in your system giving you the ability to uninstall it with your distribution's standard package management utilities.
CheckInstall is a computer program for Unix-like operating systems which eases the installation and uninstallation of software compiled from source by making use of package management systems.
To install CheckInstall, just look for the checkinstall package in your distribution. On Ubuntu or Debian run sudo aptitude install checkinstall; on openSUSE run sudo zypper install checkinstall. Note that you might need other libraries or packages to compile software as well.
The double use of sudo is the problem.
With a file install.sh like
#! /bin/bash
set -x
touch useless
cp useless /usr/share/useless
command
sudo checkinstall --pkgname useless -y ./install.sh
works while
sudo checkinstall --pkgname useless -y sudo ./install.sh
^^^^
shows
cp: cannot stat ‘//var/tmp/tmp.Au4ympTNlT/newfiles.tmp’: No such file or directory
and produces an empty package.
I'm not sure if this exactly answers the question, but here's what I got so far (on ubuntu lucid, checkinstall 1.6.1):
I tried to build an open-source project, which built just fine. Then I tried packaging it for debian:
checkinstall -D --install=no --pkgname=$PKGNAME --pkgversion=0.0.1 --pkgrelease="svn-001" [email protected] --strip=no --stripso=no --addso=yes
This basically failed at the same Building file list... FAILED!
; and a similar grep: /var/tmp/tmp.NaoiwTHT6F/newfile: No such file or directory
was reported.
I also tried with adding make
at end of checkinstall
command above - that didn't do much either.
Finally, I tried this:
make clean
checkinstall -D --install=no --pkgname=$PKGNAME --pkgversion=0.0.1 --pkgrelease="svn-001" [email protected] --strip=no --stripso=no --addso=yes -d2 make
The switch -d2
is to enable debug; and ... make
will rerun make one more time.
The -d2
will print out the temporary directory:
debug: The temporary directory is: [ /var/tmp/tmp.NaoiwTHT6F ], so it can be checked by listing... And indeed, I can confirm that a
newfile
is not generated there in my case (however, there is newfiles
, newfiles.installwatch
, newfiles-tar
, and newfiles.tmp
). In fact, turns out checkinstall
is a bash
script, and so one can confirm that newfile
only appears once in it:
$ grep 'newfile ' `which checkinstall`
grep '^/home' ${TMP_DIR}/newfile > /${TMP_DIR}/unwanted
Also, the debug will point out these files/directories:
debug: INSTW_EXCLUDE=/dev,/path/to/myproject-build,/proc,/tmp,/var/tmp,
debug: INSTW_ROOTPATH=/var/tmp/tmp.NaoiwTHT6F
debug: INSTW_LOGFILE=/var/tmp/tmp.NaoiwTHT6F/newfiles.tmp
debug: INSTW_DBGFILE=/var/tmp/tmp.NaoiwTHT6F/dbgfile
Note that by default, the path to my build folder, /path/to/myproject-build
is excluded - and that is where this project also stores the built executables!
Apparently, when make
within checkinstall
goes on building for the first time, it can capture newly generated executable files - they will be listed in ${TMP_DIR}/newfiles
; however, in my case, the problem is that the executables end up under the same directory where checkinstall
is called; thus, at this dialog:
Some of the files created by the installation are inside the build
directory: /path/to/myproject-build
You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them? [n]: y
Should I exclude them from the package? (Saying yes is a good idea) [y]: n
... I must, in fact, answer n
- otherwise I'd get nothing included! I can then check the contents with:
dpkg --contents mytest.deb | less
However, then the problem is that checkinstall
:
.o
files, as well as .svn
directories/usr/bin
, and .so
s to /usr/lib
In brief - some of the approaches above may get one to have a .deb
which is not completely empty; but that doesn't mean one has only the needed files there, or that they would be routed to usual install destinations...
Well, hope this helps at least a bit,
Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With