deb package creation using fpm with build dependencies - linux

I'm trying to create a deb package using fpm, which contains some shell script files.But the deb package should create with a dependency called vim(vim editor in Linux). Means when installing deb package it should install vim first and then script files.
Requirement is when installing deb package the vim should install first and then script files.
The fpm command I have tried is :
fpm -s dir -t deb -n 'test' --deb-pre-depends vim --after-install /home/test/testfile.sh -C /home test
And after deb package created. when installing it, I'm getting following errors:
dpkg: regarding test_1.0_amd64.deb containing test, pre-dependency problem:
test pre-depends on vim
vim is not installed.
dpkg: error processing archive test_1.0_amd64.deb (--install):
pre-dependency problem - not installing test
Errors were encountered while processing:
test_1.0_amd64.deb
Thanks in Advance...

As #Vorsprung as alredy mentioned you need to use --depends:
fpm -s dir \
-t deb \
-n 'test' \
--depends vim \
--after-install /home/test/testfile.sh \
-C /home test
You need to be aware that dpkg won't install the dependencies for you, but you can run apt-get afterwards to install all the missing dependencies:
dpkg -i test.deb
apt-get install -f

try --depends instead of --deb-pre-depends
"Depend" and "Pre Depend" are subtly different see here https://www.debian.org/doc/debian-policy/ch-relationships.html
Sounds like what you want to do is probably "Depend" so keep it simple

Related

How to create deb that install another deb before installation?

I want to create .deb file that could be installed on a out-of-box Ubuntu.
I have prepeared control, preinst, postinst files. But when I try to install my package on a fresh Ubuntu it says that "Could not get lock /var/lib/dpkg/lock". I know that it is a common problem when people want to install different software at the same time. But how do I install python3-pip and nginx?
Sure, I can create 2 files: mysofr.deb and install.sh. But the point is to have only one file, so user could install my soft with only one command.
Here is my preinst:
dpkg -s "python3-pip" >/dev/null 2>&1 && {
echo "python3-pip is installed."
echo
} || {
echo "ERROR: python3-pip is not installed. Now it will be installed from default repo"
# rm /var/lib/dpkg/lock
# dpkg --configure -a
sudo apt install python3-pip
}
As you can see, I have tried to unlock dpkg. But it was a bad idea to do it during installation.
Here is my postinst:
#!/bin/bash
cd *directory*
dpkg -i nginx_1.14.2-1_stretch_amd64.deb
rm nginx_1.14.2-1_stretch_amd64.deb
systemctl enable nginx
service nginx start
In short: I want to create deb that could check if there is a python3-pip and nginx and if there is no such software - install it: nginx from .deb file, python3-pip from default repo.
You should declare these dependencies in the control file, as Depends. See the documentation on those fields in man deb-control.
Installing from within the maintainer scripts is completely unsupported and trying to force that via the removal of the lock file is going to damage the dpkg database or the installation, don't do that.
if you get comments like that, it means that before you cancel the installation, for this problem you can use the following command "$rm /var/lib/dpkg/lock",

Corrupted filesystem tarfile - corrupted package archive Ubuntu

I'm trying to compile and install an open source application on Ubuntu. I can make the application, make the installer, and make the package. I don't see any error during those steps. when I issue the dpkg -i to install it if fails with the following error.
dpkg: error processing archive application.deb (--install):
corrupted filesystem tarfile - corrupted package archive
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
I can only find references to fixing the issue when downloading files and say to issue apt-get clean and purge. I've done that and it doesn't work and it doesn't seem applicable since I'm creating the install file. When I issue dpkg -c application.deb, it shows me the contents, so the file isn't total corrupted.
Any suggestions on how to get this application to install?
Following the description on https://github.com/Brewtarget/brewtarget on a newly installed Ubuntu 14.04.3 gives me a .deb that installs.
These are the commands I ran:
$ sudo apt-get install cmake git qtbase5-dev qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt5webkit5-dev libqt5sql5-sqlite libqt5svg5 libqt5multimedia5-plugins doxygen
$ git clone https://github.com/Brewtarget/brewtarget.git
$ mkdir brewtarget-build
$ cd brewtarget-build
$ cmake ../brewtarget
$ make
$ make package
$ sudo apt-get install libphonon4 libqt4-webkit phonon phonon-backend-vlc
$ sudo dpkg -i brewtarget*.deb
Selecting previously unselected package brewtarget_2.2.0.
(Reading database ... 175209 files and directories currently installed.)
Preparing to unpack brewtarget_2.2.0_x86_64.deb ...
Unpacking brewtarget_2.2.0 (2.2.0-1) ...
Setting up brewtarget_2.2.0 (2.2.0-1) ...
$ file *.deb
brewtarget_2.2.0_x86_64.deb: Debian binary package (format 2.0)
What version of Ubuntu are you running?
It is odd that your error message says "application.deb", as I got a .deb named "brewtarget_2.2.0_x86_64.deb" when following the instructions.
Try these commands
# sudo dpkg -i --force-overwrite application.deb
After that run
# sudo apt-get -f install

How can I add dependancy files in Debian Package in Ubuntu?

I am trying build a debian package with some dependencies... Let me know how can I add dependencies into it. I have tried putting it in control file... but it is not working.. i am following this link:
http://www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html
In your debian/control file you need a line that looks similar to this:
Depends: foo, bar, baz(>=1.0)
Edit: dpkg -i does not download dependencies only apt-get does that. You normally need to run sudo apt-get install -f after you used dpkg -i unless you add your package to an apt repository and install it from there

Compiling VIM with breakindent patch

In Ubuntu 12.04 Precise the only way to get breakindent patch working in VIM seems to be compiling VIM itself after patching it. Here's what I've done:
Install pbuilder and create local environment
sudo apt-get install pbuilder debootstrap
sudo pbuilder create --debootstrapopts --variant=buildd
Get the sources
sudo apt-get source vim
Patch them with breakindent patch retrieved from the official repo
cd vim-7.3.429
patch -p1 < vim-breakindent.patch
sudo pbuilder build vim_7.3.429-2ubuntu2.1.dsc
Pbuilder correctly generates deb packages but, after installing them, no breakindent option is available:
:set bri
E518: Unknown option: bri
Where's the mistake?
Thank you
pbuilder is still using the unmodified .dsc, .orig.tar.gz, and .debian.tar.gz to build the package. Applying the patch to your local copy doesn't help.
You should probably add the patch to debian/patches/ and debian/patches/series, bump the local version number in debian/changelog (debchange can help), and re-make the source archive (something like dpkg-buildpackage -S).
Update: it worked following some more steps.
After apt-get source:
cd vim-7.3.429
sudo chmod u=rw,g=r,o=r ../vim-breakindent.patch
sudo cp ../vim-breakindent.patch debian/patches/debian/.
added one new entry in debian/changelog, bumping version from vim_7.3.429-2ubuntu2.1 to vim_7.3.429-2ubuntu2.2
added debian/vim-breakindent.patch at the end of debian/patches/series
generate new source package:
sudo pdebuild
compile the new .dsc:
sudo pbuilder build vim_7.3.429-2ubuntu2.2.dsc
install new debs:
sudo dpkg -i /var/cache/pbuilder/result/*.deb

Installing Issue in the Debian-Linux Server

I am trying to install Kyoto Cabinet in the Debian-Linux Server by using this commands. However, when I execute
./configure
Command, it gives error
-bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
Can anybody help me why is this happening and how to solve this issue ? Or any idea why this error can happen ?
Because of the ^M character, the configure file is probably using Windows-style line endings.
Try to convert it to use UNIX-style:
dos2unix configure
or in vi type:
:set fileformat=unix
than save the script and try again.
kyotocabinet is now packaged in debian sid
apt-get install libkyotocabinet-dev --install-suggests
you may need to add this to /etc/apt/sources.list
deb http://cdn.debian.net/debian sid main
For me, an initial installation of Kyoto Cabinet (K.C.) was unsuccessful because C++ and zlib were missing from minimal Centos 6. Eventually, these omissions were discovered and K.C. installed (initial instructions from http://skipperkongen.dk/2013/02/14/giving-kyotocabinet-a-go/):
yum -y install gcc-c++
yum -y install zlib-devel
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar xzvf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure && make && make install # takes some time!
Test Kyoto Cabinet with:
kcprototest wicked 5
To install the Kyoto Cabinet API for Python (initial instructions from others):
Test Kyoto Cabinet with:
kcprototest wicked 5
As root, of course:
cd $HOME
yum -y install python-devel
wget http://fallabs.com/kyotocabinet/pythonlegacypkg/kyotocabinet-python-legacy-1.18.tar.gz
tar xzvf kyotocabinet-python-legacy-1.18.tar.gz
cd kyotocabinet-python-legacy-1.18
python setup.py install # may take some time!
Create and run a test program, e.g., testkc.py, from the Kyoto Cabint web site.
It should run OK.
You probably want to make K.C. available outside root. Create a new file:
vi /etc/ld.so.conf.d/usrlocal.conf
and add the line:
/usr/local/lib
Then run
ldconfig -v
Move the testkc.py to a user account and run it there; it should be OK

Resources