Notes paquet RPM Redhat CentOS

Voir aussi yum createrepo

Création et modification

Voir :

http://doc.fedora-fr.org/wiki/La_cr%C3%A9ation_de_RPM_pour_les_nuls_:_Cr%C3%A9ation_du_fichier_SPEC_et_du_Paquetage

http://www.tldp.org/HOWTO/RPM-HOWTO/build.html

https://fedoraproject.org/wiki/How_to_create_an_RPM_package

http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html

https://github.com/ImmobilienScout24/svn2rpm/blob/master/svn2rpm.spec

https://github.com/tomhillable/consul-rpm

https://stereochro.me/ideas/rpm-for-the-unwilling

Mock

yum install rpmdevtools mkdir -p rpmbuild/{BUILDROOT,SPECS} cd rpmbuild/SPECS/ rpmdev-newspec plop

Récupérer les fichiers

rpm2cpio ../plop-1.8.8-2.noarch.rpm | cpio -idmv

For Reference: the cpio arguments are :
-i = extract
-d = make directories
-m = preserve modification time
-v = verbose

Récup script post-install

rpm -qp --scripts plop-1.8.8-2.noarch.rpm

Éditer un paquet RPM en modifiant le SPEC

sudo yum install rpmrebuild rpmrebuild -e -p plop-1.8.8-2.noarch.rpm

Générer un SPEC d'un RPM existant

rpmrebuild -s plop.spec -p ../plop-1.8.8-2.noarch.rpm

Créer un RPM

cd ~/rpmbuild rpmbuild --target=noarch -bb --sign SPECS/plop.spec cd RPMS/noarch

Exemple de fichier .spec avec PHP (pas de compilation)

%define name superrpm
%define version 1.5.6
%define release 2
Summary: Application super RPM
Name: %{name}
Version: %{version}
Release: %{release}
Vendor: Acme
URL: http://www.acme.fr/
License: GPL3
Group: Web application
Prefix: %{_prefix}
Requires: php >= 5.2.4, mysql-server, php-pdo, httpd, php-soap, php-mbstring, php-mysql, php-xml, dmraid >= 1.0.0.rc13-53,php-gd
BuildArch: noarch
%description
Super paquet RPM
%post
chmod -R 777 /var/www/Superrpm/
chown root:root /etc/httpd/conf.d/superrpm.conf
service httpd reload
%files
#%defattr(755,root,root,644)
%defattr(-,-,-)
#/*
/etc/cron.daily/update-plop
/etc/cron.hourly/tache_plop.sh
/etc/httpd/conf.d/plop.conf
/etc/yum.repos.d/plop.repo
/etc/php-fpm.d/plop.conf
/etc/my.cnf.d/plop.cnf
/var/www/plop/
%changelog
* Mon Apr 25 2016 Equipe dev Acme <dev@null.fr>
- Plop : bugfixed
* Mon May 4 2009 Equipe dev Acme <dev@null.fr>
- Première paquet RPM

Notes attr

1. The default permissions, or "mode" for files.
2. The default user id.
3. The default group id.
4. The default permissions, or "mode" for directories.

Autres

BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)