当前位置:网站首页>How to package rpm

How to package rpm

2022-06-25 14:59:00 qq_ twenty-three million nine hundred and fifty-three thousand

This article describes how to compile the used library , Packaging process , It doesn't contain the compiled part

Basic information

  1. rpm After the environment is installed, the default packaging path is /root/rpmbuild
  2. SPECS Yes. spec Where the papers are
  3. RPMS It's generated rpm Package storage location
  4. BUIDROOT Where intermediate files are temporarily stored

spec Introduce

Name: by rpm Name
Version: by rpm Package version number
%prep Operations before packaging
%pre install rpm Operations before package
%%%% Here is the real installation process , Will %prep Copy the file directory prepared in to the corresponding place
%post install rpm Post package operations
%preun What to do before uninstalling , Generally, it refers to operations such as stopping service
%%%% Here is the real uninstallation process , Corresponding installation process
%postun What to do after uninstallation , Generally solve the problem of unloading residues

spec Upgrade package

When upgrading , The complete execution process is as follows :
1、 Execute new package spec In file %pre paragraph .
2、 Install the dependent packages of the new package .
3、 Execute new package spec In the document %post paragraph .
4、 Execute old package spec In the document %preun paragraph .
5、 Delete old files that are not needed in the new package .
6、 Execute old package spec In the document %postun paragraph .

Distinguish between upgrade and installation

  1. Installation phase :%pre and %post paragraph
    here $1 The content is 1 and 2
    Values for 1 when , Indicates a new installation rpm package .
    Values for 2 when , It means upgrading an existing package .
  2. Unloading phase :%preun and %postun paragraph
    here $1 The content is 0 and 1
    Values for 0 when , Indicates deleting a package .
    Values for 1 when , Indicates updating a package .

Packing command

rpmbuild --target x86_64 /mips64el/aarch64/sw_64 --bb x64.spec

原网站

版权声明
本文为[qq_ twenty-three million nine hundred and fifty-three thousand ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202200514582043.html