Difference between revisions of "Fedora-rpm"
From Bashlinux
(Redirected page to Fedora RPM Build) |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | #REDIRECT [[Fedora_RPM_Build]] |
||
− | __NOTOC__ |
||
− | = Fedora RPM Build = |
||
− | == Structure == |
||
− | To build an rpm must be created and/or placed different files under `/usr/src/redhat` as follow: |
||
− | # Spec file with details of name, dependencies, instructions, etc and script of how to build the rpm under `SPEC` folder |
||
− | # Compressed file with the sources under `SOURCES` folder |
||
− | |||
− | == Build == |
||
− | To build the new rpm, run the command: |
||
− | |||
− | <pre><nowiki> |
||
− | # rpmbuild -ba SPEC/newrpm.spec |
||
− | </nowiki></pre> |
||
− | |||
− | The created files will be placed as follow: |
||
− | # New RPM created under `RPMS/''system_architecture''` folder |
||
− | # RPM with sources and spec file packed under `SRPMS` folder |
||
− | # Unpacked sources under `BUILD` folder |
||
− | |||
− | == Scripts == |
||
− | There are 4 types of scripts: |
||
− | # Pre install: pre |
||
− | # Post install: post |
||
− | # Pre uninstall: preun |
||
− | # Post uninstall: postun |
||
− | |||
− | The `rpm` command has 3 main types of execution to be considered: |
||
− | # install |
||
− | |||
− | <pre><nowiki> |
||
− | rpm -i newrpm.rpm |
||
− | </nowiki></pre> |
||
− | |||
− | # upgrade |
||
− | |||
− | <pre><nowiki> |
||
− | rpm -u newrpm.rpm |
||
− | </nowiki></pre> |
||
− | |||
− | # remove |
||
− | |||
− | <pre><nowiki> |
||
− | rpm -e newrpm.rpm |
||
− | </nowiki></pre> |
||
− | |||
− | |||
− | and different values are passed to each script based on which type of execution is performed by the `rpm` command. |
||
− | |||
− | More details on [[http://www.ibm.com/developerworks/library/l-rpm3.html]] |
||
− | |||
− | <pre><nowiki>#!wiki |
||
− | '''warning''' |
||
− | |||
− | Be careful with the usage of each script section, please note the execution order which is crucial at upgrade time. |
||
− | </nowiki></pre> |
||
− | |||
− | |||
− | ==== New installation ==== |
||
− | The execution order and values passed are: |
||
− | * %pre NEW_PACKAGE ($1 = 1) |
||
− | * %install |
||
− | * %post NEW_PACKAGE ($1 = 1) |
||
− | |||
− | ==== Upgrade ==== |
||
− | The execution order and values passed are: |
||
− | * %pre NEW_PACKAGE ($1 = 2) |
||
− | * %install |
||
− | * %post NEW_PACKAGE ($1 = 2) |
||
− | * %preun OLD_PACKAGE ($1 = 1) |
||
− | * %files NEW_PACKAGE, Delete all files no longer listed |
||
− | * %postun OLD_PACKAGE($1 = 1) |
||
− | |||
− | ==== Remove ==== |
||
− | The execution order and values passed are: |
||
− | * %preun OLD_PACKAGE ($1 = 0) |
||
− | * %files OLD_PACKAGE, Delete all files listed |
||
− | * %postun OLD_PACKAGE ($1 = 0) |
Latest revision as of 22:18, 6 June 2015
Redirect to: