How to create RPM package that uses setcap and works on both dnf/yum (fedora/redhat) and zypper (openSuse) - yum

I'm developing an RPM package for a service that requires the command setcap for setting capabilities. The purpose of using setcap is to listen to port numbers below 1024.
RPM packages have a 'Requires' section that is a comma-separated list of other required packages, and in theory I can use that to make sure the target system installs the packages needed.
Now here's the problem:
setcap is available for Fedora in package libcap and for openSUSE in package libcap-progs.
the package libcap is not available on openSUSE, and libcap-progs is not available on Fedora.
Is it possible to create a single RPM package that installs setcap and works on both Fedora and openSUSE?

It's possible to write the following:
Requires: /usr/sbin/setcap
This will resolve on both Fedora and openSUSE to their corresponding library

Related

Centos 8, yum update command not working. given following error. can't find php-common-7.2

I've tried to remove php-common-7.2 but couldn't find where it located.
Problem: package php-pecl-igbinary-3.2.2-1.el8.remi.7.2.x86_64 requires php(api) = 20170718-64, but none of the providers can be installed
- package php-pecl-igbinary-3.2.2-1.el8.remi.7.2.x86_64 requires php(zend-abi) = 20170718-64, but none of the providers can be installed
- cannot install both php-common-7.2.34-3.el8.remi.x86_64 and php-common-7.4.16-1.el8.remi.x86_64
- cannot install both php-common-7.2.34-4.el8.remi.x86_64 and php-common-7.4.16-1.el8.remi.x86_64
- cannot install the best update candidate for package php-pecl-igbinary-3.2.1-1.el8.remi.7.4.x86_64
- problem with installed package php-common-7.4.16-1.el8.remi.x86_64
- package php-common-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 is filtered out by modular filtering
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
My server configuration is
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
Apache Web Server
php7.4-cli
using Webmin & virtaulmin`
You are trying to install igbinary extension for PHP 7.2 with PHP 7.4. This cannot work.
For a proper configuration, please follow the Wizard instructions
And not enough information for more help:
rpm -qa php\*
dnf repolist
dnf module list PHP

Chef:Install Apache at custom path/location

I want to install apache using chef. But when I use:
package 'httpd' do
action :install
end
It will install apache inside /etc/httpd but I want to install apache in another directory (for example: /abc).
The Chef package resource uses the underlying system's package manager such as yum, apt.
You haven't mentioned the distribution you are running on. However, using package 'httpd' on YUM based distribution will trigger yum install httpd
So, first find how you can change/set the install path using the underlying OS command. E.g. for YUM:
yum --installroot=<path> install <package>
In a Chef package resource:
package 'httpd' do
options '--installroot=/abc'
action :install
end
I have created a custom package and then installed in to desired loaction it helped me a lot Thank you very much everyone

Can I use phantomJS on Azure app service for linux?

I'm getting a consistent error when trying to use the html-pdf package in my node application:
StatusError: Error: spawn /home/site/wwwroot/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT
As far as I can tell everything is installed correctly and the npm install works as expected. My suspicion is that there is some missing dependency in the built-in linux image, but I'm not sure how to confirm that.
According to the information comes from the Download PhantomJS page, there is two note for Linux Distributions as below.
Note: For this static build, the binary is self-contained. There is no requirement to install Qt, WebKit, or any other libraries. It however still relies on Fontconfig (the package fontconfig or libfontconfig, depending on the distribution). The system must have GLIBCXX_3.4.9 and GLIBC_2.7.
So the native package fontconfig or libfontconfig must have been installed in docker image first.
For Debian/Ubuntu system, you can add RUN apt install fontconfig in the docker file, and check the package installed whether be exists via the command dpkg -l|grep fontconfig.
For Fedora/CentOS system, add RUN yum install -y fontconfig, and check the installed on via yum list installed|grep fontconfig.

error: unpacking of archive failed: cpio: Bad magic when installing an rpm

I packaged an rpm using
make package
command, and copied the resulting rpm to another machine which has a company specific OS. Now when I try to install the rpm using
rpm --nodeps -i filename.rpm
I get the error the same as the one in the title.
So I ran
rpm -qa | grep rpm
on the machine used to build the rpm package, and got this:
rpm-4.8.0-37.el6.x86_64
rpm-devel-4.8.0-37.el6.x86_64
rpm-python-4.8.0-37.el6.x86_64
rpm-libs-4.8.0-37.el6.x86_64
rpm-build-4.8.0-37.el6.x86_64
redhat-rpm-config-9.0.3-51.el6.noarch
After a bit of investigation, I tried removing the redhat-rpm-config package and bam, rpm installation worked on the other machine. Now, this is a solution and all but I don't think I can just uninstall this package for every machine that we're going to use in creating the rpm. Is there any other way to ignore this redhat-rpm-config-9.0.3-51.el6.noarch when creating an rpm package using cmake?
What is the RPM version of the system you are installing on? Are its sources publicly available somewhere?
There could be various compatibility issues if you build binary RPMs using a newer RPM/distribution. In general, we build binary RPMs using the RPM and redhat-rpm-config versions in the buildroot (which is created by mock) itself, which matches the target RPM version, even if the build host has a newer RPM version.
If this is not an option for you, I would look at specific RPM features controlled by redhat-rpm-config. The one that sticks out to me immediately is payload compression:
# Use XZ compression for binary payloads
%_binary_payload w2.xzdio
Other changes include support for larger files, but this does not seem to be the issue here because it would not change by uninstalling the redhat-rpm-config package.
You very likely made binary RPM using rpmbuild on different OS than was the target OS. You should use "mock" for building the package.
dnf install mock
mock -r epel-6-x86_64 yourpackage.src.rpm
To solve "error: unpacking of archive failed: cpio: Bad magic" issue at RPM package installation on your machine:
1/ List rpm pkgs which are installed on the server machine (the machine on which the rpm pkg is generated):
$ rpm -qa | grep rpm
….
….
2/ If pkg redhat-rpm-config-9.0.3-51.el6.noarch is present in the given list, desinstall it:
$ rpm -e redhat-rpm-config-9.0.3-51.el6.noarch
3/ Generate now the pkg and tranfer it on your dev machine. Pkg installation should work.
Philippe.

How can I build an RPM package in a Debian based system?

I'd like to build packages using a build system (i.e. jenkins, travis, etc) but all I have are Ubuntu 12.04 VMs.
I've found this [1] instructions but mach does not support CentOS 7.0.
[1] http://blog.burghardt.pl/2008/12/how-to-build-rpm-packages-in-centos-chroot-on-debian/
http://mojo.codehaus.org/rpm-maven-plugin/ <- rpm plugin for the maven build system
sudo apt-get install rpm # for Ubuntu
Check out the command that it installs called rpmbuild.
Found it! There is actually a tool called rinse: "Rinse is a simple tool which is designed to carry out the installation of a new RPM-based distribution".
rinse --distribution="centos-7" --directory="/tmp/centos-7"
http://collab-maint.alioth.debian.org/rinse/