how to create a debian package using “equivs-build” which can be “upgraded” if already installed? - package

I have created a .deb package using equivs-build command and providing necessary control, preinst, postinst, etc. I noticed that version can also be mentioned in control file. Now I want to create a .deb package with updated source code and I want to enable user to upgrade the package if it is already installed (and is of previous version, of course), as I won't be changing conf related files, etc. One way I can think of is to write a shell-script which will first check for installed version, and will take actions accordingly (i.e. if installed, just update the source-code, database-migrations, etc. and if not, install the package using dpkg -i <package-name>). I was wondering if there was a way to achieve using dpkg only (something like dpkg upgrade <package-name>) which will handle installation or up-gradation as required.

That's already how it works.
dpkg -i package_0.123.deb will upgrade if the version of package is less than 0.123, removing the previous version if necessary (there's an option to force a downgrade, too). apt-get install package will install the newest version of package, removing the old one and upgrading to a new one if necessary. apt-get upgrade will upgrade all packages to the newest version.
Basically, just take care to monotonically upgrade the version number each time you publish a new build.
If you didn't specify a version previously, the default will be something simple like 1.0. Just make it bigger than that.

Related

tcms-api 5.3 package incompatible with Windows

I attempted to upgrade my tcms-api library from 5.0 to 5.3 using:
pip install tcms-api --upgrade
on a Windows 10 machine, I saw a lot of errors when trying to install the dependent package of kerberos. Even though this is old, I saw a similar set of errors. The package installation failed since the kerberos package isn't supported on Windows and I was left at tcms-api 5.0.
Please file a bug against https://github.com/kiwitcms/tcms-api.
We can do a quick fix by providing 2 package names:
tcms-api and tcms-api[kerberos]
The first one will not install the kerberos package.
The proposed workaround makes sense but changing the underlying kerberos implementation needs careful testing which isn't a quick job.
OTOH https://github.com/kiwitcms/python-social-auth-kerberos uses gssapi which seems to be the latest and most actively maintained implementation of Kerberos for Python. There is an open issue to migrate to that in tcms-api so you can contribute if you want.
As a workaround, I was able to do the following (caveat: I haven't extensively tested my installation yet):
Clone the tcms-api repo from GitHub
Edit setup.py to change the install_requires line to use 'kerberos-sspi' rather than 'kerberos'
Install the following pip packages: Setuptools, Wheel, Twine
CD to repo folder and run: python setup.py bdist_wheel
That creates a package under the dist folder
Run pip install dist\tcms_api-5.3-py3-none-any.whl
Celebrate successful package install
The steps were modified from this page.
Update:
I confirmed the things I need the API to do work with my custom package (create and update test runs). However, I'm in a situation where I don't need to specifically harden my Kiwi instance using kerberos authentication.

Installing mongodb-enterprise-server error

Hello guys. Can someone help me about this one? I cant install mongodb because of dependency problem. I already tried updating my linux mint terminal.
dpkg: dependency problems prevent configuration of mongodb-enterprise-server:
mongodb-enterprise-server depends on libcurl3 (>= 7.16.2); however:
Package libcurl3 is not installed.
mongodb-enterprise-server depends on snmp; however:
Package snmp is not installed.
Installing via dpkg -i mongodb.deb will not include additional package dependencies. You should be able to fix your installation by following up with sudo apt --fix-broken install.
Unless you have strong reasons to avoid the standard process I would recommend following the tutorial to Install MongoDB Enterprise by adding the appropriate repo definitions. Adding the normal package repo will also make it easier for you to update to newer minor releases of MongoDB 4.0.x.

Install Racket package only if not installed

I can install a Racket package with:
raco pkg install <pkg-name>
If the package is not installed, it installs it. If the package is already installed however, it will complain that the package is already installed. While this is fine, is there a better way to check if a package is installed, and only try to install it if its not already installed?
For context, I want this because I have a (non-package) Racket project that relies on certain packages being installed. I could put them in an info.rkt file, but as far as I can tell, these won't get installed unless I try to install the project as a package, which doesn't make sense for this domain.
So, is there anyway to determine if a Racket package is installed? Additionally, can I use this information to only install a package if its not already installed?
Yes, in fact you can. If you are using a shell program or makefile (basically, using the raco pkg tool from the command line), you can pass it the --skip-installed parameter. This will only try to install the package if its not already installed. So you could do something like this in a mace file:
all: # Replace spaces here with tabs, because make...
raco pkg install --skip-installed <important-pkg>
<rest-of-makefile>
Alternatively, if you are looking for an 'in Racket' solution, you can use the installed-pkg-table function to get a hash table containing all of the installed packages. From there, its easy enough to do a hash-has-key? to see if the package is in the table. From there, you can use pkg-install-command to install the package. Your total code will look something like this:
(unless (hash-has-key? (installed-pkg-table) "<important-pkg>")
(pkg-install-command #:deps 'search-auto i))
I should note that there is a slight chance that the package database will change between searching for the key and installing the package. If that is important to you, check out with-pkg-lock

How to apply puppet manifests and modules WITHOUT installing Puppet RPM?

I would like to create an RPM package that applies a Puppet manifest on a server which does not contain Puppet, Facter and Hiera.
Also, and more importantly, I should be able to apply it WITHOUT being obliged to install neither of these tools (Puppet, Facter, Hiera) on the production server.
So basically, the package should run the following command without installing any of the required packages:
puppet apply install.pp --modulepath=./modules --hiera_config=./conf/hiera.yaml
How can I proceed to make such a package ? Is it a good idea to extract the 'binary' files the Puppet/Hiera/Facter RPMs to include them in another one ?
Thanks!
Installing the relevant packages and then removing them would be by far the fastest and safest way to do what you wish. Maybe you can convince your customer that the cost in time for any other solution is not worth the money.
Anyway, if packages are not an option, let's be innovative:
You do not have to install from packages, you can install puppet via ruby gems
In the same way, you can use source tarballs
Those two options might work, but are not innovative enough.
What about installing puppet 'locally' on a disk via the gems or the tarballs, and then mounting this disk via nfs?
While we are here, why not do the same but then mount using sshfs?
still with the idea of a having first a remote install, you could indeed repackage it via fpm (amazing tool, very strongly recommended). You still end up with a package, but a local one which will not require adding a repository, this might alleviate some of your client concerns.
building on this, if the issue is with repositories, not packages, you could download all required packages and install them manually
I guess that the summary of this answer is that the value of doing so is negative compared to using what you distribution provides.

Composer packages update but don't install

After doing
sudo php composer.phar update
I get the following:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installing SOME_PACKAGE (dev-master 6fb0f62)
Cloning SOME_TOKEN
Writing lock file Generating autoload filesUpdating
But when I do sudo php composer.phar install I get
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Does someone have any idea on what might be happening? I have a composer.json, composer.phar and composer.lock all in the same folder.
What is wrong in your opinion? With composer update, composer tries to find new versions of the packages within the specified version range. When found, it updates the package. At the end, it creates a composer.lock file with all packages and details about the installed versions.
composer install only reads this composer.lock file and installs exactly the versions specified in this. Since you already have the versions specified in that lock file, nothing will happen.
composer install is very usefull on production servers and in teams, as you'll be sure you all are using exact the same version of the dependencies.
Check if composer.look is using a package that uses an extension not released in php.ini . After releasing the extensions use comoser install

Resources