To create a software package in RPM format, use the following command format:
Rpm-bx [Create Option 1 create option 2...] description file 1 description file 2...
Note:-bx can be replaced with-TX, with different effects: when using-B, you must specify the package description file on the command line. When using-t, on the command line, you must specify not a package description file, but a package file in tar format containing the description file (which must be compressed using gzip). When rpm is preparing a software package, the description file is automatically extracted from the package file, and a software package in RPM format is generated based on the package creation instructions. Note: This description file must be suffixed with. spec, which must have the source field, and the source program package defined in this field must be stored in the current directory. Otherwise, RPM will return an error and exit.
Note that when-bx and X in-TX take different values, RPM will perform different operations :( the following examples all operate on the Lze's description file lze-6.0-2.spec, some use the pipeline technology and use the NL command to add a line number to the output for explanation)
1) x = P indicates that RPM executes the script program of the preprocessing segment (% prep) in the description file. This script is generally used to extract the source program package, patch the source program, and upgrade the source program.
# Rpm-bplze-6.0-2.spec2> & 1 | NL
1 executing: % prep
2 + umask022
3 + CD/usr/src/Dist/build
4 + echo 'start executing the pre-processing script (PREP'
5. The pre-processing script program (PREP) starts execution.
6 + CD/usr/src/Dist/build
Rm-rflze-6.0 7 +
8 +/bin/gzip-DC/usr/src/Dist/sources/lze-6.0-2.src.tgz
9 + tar-xvvf-
10drwxr-xr-xroot/root02001-11-0216: 02lze-6.0/
11-rw ------- root/root2462262001-11-0216: 00lze-6.0/Lze. c
12-rw ------- root/root982492001-11-0216: 00lze-6.0/lzeime. WB. c
13-rw ------- root/root3399022001-11-0216: 00lze-6.0/lzeime. py. c
14-rw-r -- r -- root/root12832001-11-0216: 00lze-6.0/funkey. Def
15-rwxr -- r -- root/root2502001-11-0216: 00lze-6.0/inputme. Def
16-rw-r -- r -- root/root8132742001-11-0216: 00lze-6.0/wbzc. dat
17-rw ------- root/root4742001-11-0216: 02lze-6.0/makefile
18 + status = 0
19 + '['0-ne0']'
Cdlze-6.0 20 +
21 ++/usr/bin/ID-u
22 + '['0 = 0']'
23 +/bin/chown-rhfroot.
24 ++/usr/bin/ID-u
25 + '['0 = 0']'
26 +/bin/chgrp-rhfroot.
27 +/bin/chmod-RF + RX, G-W, o-w.
28 + exit0
#
Note: The "executing: % Prep" shown in row 1st in this example indicates that RPM starts executing the script program of the preprocessing segment. In this example, the rows starting with the plus sign (+) after the row number are the commands of the script program in the preprocessing segment, and other contents are the results output by the command execution. From the commands executed by the script program in the preprocessing segment, we can see what rpm is doing:
Row 3: Set the file creation mask;
Row 3: Go to the default RPM compiling directory;
Row 4th: Echo string. This is the start of the script program in the pre-processing segment written by the user. Line 2 and 3 are the instructions added by rpm;
Line 6-27: The commands extended by % setup and their execution results. You can see that RPM uses the gzip command to decompress the Lze source program package (line 8 ), then run the tar command to expand the source program package (line 1 ).
Row 28th: Exits normally. The returned value is 0.
2) x = L indicates RPM to check the file segment (% files) and check whether the file exists. If it does not exist, the RPM will return an error and exit.
# Rpm-bl-vvlze-6.0-2.spec | NL
1 processingfiles: Lze
2d: file0: 0100644root. Root/etc/funkey. Def
3D: file1: 0100644root. Root/etc/inputme. Def
4d: file2: 0100644root. Root/usr/doc/lze-6.0-2/readme
5 filenotfound:/usr/doc/lze-6.0-2/license
6D: file3: 0100555root. Root/usr/bin/Lze
7D: file4: 01001_root. Root/usr/bin/lzeime. py
8d: file5: 01001_root. Root/usr/bin/lzeime. WB
9d: file6: 0100644root. Root/etc/wbzc. dat
10 provides: Lze-Edit
11 prereq:/bin/sh
12 requires:/bin/sh
#
Note: In this example, general option-VV is used to output debugging information (starting with line number and D:) during rpm check ).
From the above we can see that RPM checks all files in the file segment one by one, find the file shows its permissions, owner and group information, the results found/usr/doc/lze-6.0-2. the license file does not exist, so an error is returned (File not found) (see row 5th ). After checking the file, RPM also displays the features required by the description file (provides) and required features (requires) provided by Lze ).
3) when x = C, instruct RPM to execute the script programs of the pre-processing segments (% prep) and compilation segments (% build) in sequence. The script program in the compilation section is used to compile the source program connected to the software and generate executable programs. Generally, a make command is sufficient. Because a programmer with good habits will write the makefile (Program Maintenance File) so that other programmers can compile the software. If a software does not provide maintenance files, you can either write a makefile yourself or write the software compilation and connection commands in the compilation section.
4) when x = I, it indicates that RPM executes the script programs of the pre-processing segments (% prep), compilation segments (% build), and installation segments (% install) in sequence. The script program task of the installation section is to copy the compiled and connected execution programs to the appropriate directory (such as/bin,/usr/bin and other public execution Directories) for packaging or execution. Generally, the command is make install.
5) when x = B, instruct RPM to execute the script programs of the pre-processing segments (% prep), compilation segments (% build), and installation segments (% install) in sequence, then, package the file according to the file list of the file segment (% files), generate the RPM execution package, and finally execute the cleanup segment (% clean ).
# Rpm-bblze-6.0-2.spec2> & 1 | NL
1 executing: % prep
2 + umask022
3 + CD/usr/src/Dist/build
4 + echo 'start executing the pre-processing script (PREP'
5. The pre-processing script program (PREP) starts execution.
6 + CD/usr/src/Dist/build
Rm-rflze-6.0 7 +
8 + tar-xvvf-
9 +/bin/gzip-DC/usr/src/Dist/sources/lze-6.0-2.src.tgz
10drwxr-xr-xroot/root02001-11-0217: 04lze-6.0/
11-rw ------- root/root2462262001-11-0216: 00lze-6.0/Lze. c
12-rw ------- root/root982492001-11-0216: 00lze-6.0/lzeime. WB. c
13-rw ------- root/root3399022001-11-0216: 00lze-6.0/lzeime. py. c
14-rw-r -- r -- root/root12832001-11-0216: 00lze-6.0/funkey. Def
15-rwxr -- r -- root/root2502001-11-0216: 00lze-6.0/inputme. Def
16-rw-r -- r -- root/root8132742001-11-0216: 00lze-6.0/wbzc. dat
17-rw ------- root/root4742001-11-0216: 02lze-6.0/makefile
18-rw-r -- r -- root/root12552001-11-0217: 04lze-6.0/getinputme. c
19 + status = 0
20 + '['0-ne0']'
20 + cdlze-6.0
22 + +/usr/bin/ID-u
23 + '['0 = 0']'
24 +/bin/chown-rhfroot.
25 + +/usr/bin/ID-u
26 + '['0 = 0']'
27 +/bin/chgrp-rhfroot.
28 +/bin/chmod-RF + RX, G-W, o-w.
29 + exit0
30 executing: % build
31 + umask022
32 + CD/usr/src/Dist/build
Cdlze-6.0 33 +
34 + echo 'compile and run the connection script program (build'
35. Compile the connection script program (build) and start execution.
36 + make
37cc-fwritable-strings-duse_as_lze-dfor_linux-s-i/usr/ZZZ/src/include-DFOR_LZE_INPUTME-olze/usr/ZZZ/src/Li-
38 bsrc/mycurses. clze. cgetinputme. c/usr/ZZZ/src/My.
39cc-dfor_linux-s-i/usr/ZZZ/src/include-olzeime.wbgetinputme.clzeime.wb.c/usr/ZZZ/src/My.
40lzeime. WB. C: infunction 'do _ service ':
41lzeime. WB. C: 1409: Warning: passingarg5of 'bsearch' fromincompatiblepointertype
42cc-dfor_linux-s-i/usr/ZZZ/src/include-olzeime.pygetinputme.clzeime.py.c/usr/ZZZ/src/My.
43 + exit0
44 executing: % install
45 + umask022
46 + CD/usr/src/Dist/build
Cdlze-6.0 47 +
48 + echo 'Install the script program to start execution'
49 install the script program
50 + makeinstall
51installing...
52 done
53 + exit0
54 processingfiles: Lze
55 findingprovides :( using/usr/lib/RPM/find-Provides )...
56 findingrequires :( using/usr/lib/RPM/find-requires )...
57 provides: Lze-Edit
58 prereq:/bin/sh
59 requires:/bin/shld-linux.so.2libc.so.6libc.so.6 (glibc_2.0) libc. so.6 (glibc_2.1)
60 wrote:/usr/src/Dist/RPMS/i386/lze-6.0-2.i386.rpm
61 executing: % clean
62 + umask022
63 + CD/usr/src/Dist/build
64 + cdlze-6.0
65 + echo 'after the package is created, the script program (clean) is started to execute'
66. After the package is created, the script program (clean) is cleaned and executed.
67 + exit0
#
Note: In this example, each row is interpreted as follows:
Row 1st: displays the pre-processing segments (% prep) started by rpm );
Line 2-29: The command and result executed by the script program in the pre-processing segment (% prep). There is a plus sign (+) before the command, and there is no result before it. The Lze source program package is decompressed (gzip-DC) and the package is expanded (tar-xvvf), thus laying the foundation for compiling the source program;
Row 30th: rpm indicates the start of the compilation section (% build );
Line 31-43: The command and result executed by the compile (% build) script. The make maintenance command executed by the script program. The command executes the CC Compilation Program to compile and connect the Lze software;
Row 44th: rpm indicates that the installation section (% install) is started );
Line 45-53: the command and result executed by the installation section (% install) script. This program runs the makeinstall command to copy files such as the Lze execution program to the system directory;
Row 54th: rpm display: Start to process the Lze file (content in the % files file segment );
Line 5-59: rpm uses the/usr/lib/RPM/find-provides program to find the features provided by Lze, use/usr/lib/RPM/find-requires to find the Lze dependency function to set the Lze dependency;
Row 60th: The Lze execution package, named lze-6.0-2.i386.rpm, In the/usr/src/Dist/RPMS/i386 directory;
Row 61st: rpm: run the cleanup section (% clean) script. This section is used to clear temporary files;
Line 62-67: the command and result executed by the cleanup section (% clean) script.
From the above, we can clearly see the workflow of creating a software package with RPM: preprocessing segment, compilation segment, installation segment, software package preparation, and cleanup segment.
6) when x = s, instruct RPM to create the source code package. The RPM source package contains several items, including the software package description file (SPEC), software source program, Software patch program, and icon file. To create a source package, you do not need to execute each function segment in the software package description file. You only need to include the required file in the package.
# Rpm-bslze-6.0-2.spec
Wrote:/usr/src/Dist/srpms/lze-6.0-2.src.rpm
# Rpm-qplv/usr/src/Dist/srpms/lze-6.0-2.src.rpm
-RW ------- rootroot2067 August 5: 44lze-6.0-2.spec
-RW-r -- rootroot538706 August 7: 05lze-6.0-2.src.tgz
#
Note: In this example, the Lze source code package lze-6.0-2.src.rpm (under RPM standard source code directory/usr/src/Dist/srpms) is generated using the rpm-BS command ), then run the rpm-qplv command to query the file information contained in the source package, from which we can see that the Lze source package contains two files: one is the package description file lze-6.0-2.spec, one is the Lze source code package lze-6.0-2.src.tgz (TAR packed with gzip compressed), which is determined by the source field in the description file.
7) When x = A, instruct RPM to execute preprocessing segments (% prep), compilation segments (% build), and installation segments (% install) script programs in sequence, after that, you can package the RPM source code package, generate the RPM execution package, and finally execute the cleanup (% clean) script program based on the file list of the file segment (% files, clear intermediate files. The command execution result is equivalent to executing the rpm-BS command to generate the source code package, and then executing the rpm-BB command to generate the Execution code package.
Option List
Option details
For more information about general options, see>.
1. -- short-circuit: One-step execution
This option is intended for the single-step function segment and only applies when the command is rpm-BC (or-TC) and-Bi (or-Ti. When the rpm-BC -- short-circuit command is used, RPM will no longer execute the script program of the pre-processing segment (% prep) and directly execute the script program of the compiling segment (% build. When rpm-bi -- short-circuit command is used, RPM no longer executes the script programs of the pre-processing Section (% prep) and compilation section (% build, run only the script program of the installation segment (% install.
Why is this option used? The reason may be that there is a problem with the files in the source program package, which leads to one or more errors during RPM compilation or installation. If one-step execution is not allowed, these errors cannot be ruled out. After a single step, you can go to the directory where the source program is located, view the source program, modify the error, and use the tar command to generate a correct source program package to overwrite the original package. In this way, there will be no problem during re-production of RPM.
2. -- timecheck: set the time check Value
The usage of this option is: -- timecheck
Note: It is the period of check, in seconds. For example, -- timecheck600 sets the period of check to 600 seconds, that is, 10 minutes.
The purpose of setting the time check value is to check whether the package file is a new file generated within a specified period of time. If not, RPM generates a warning to remind you that a file is not a new file, it is an old file, which may be caused by some errors. This error may be caused by incorrect Writing of the installation script in the makefile or description file, so that a program cannot be correctly installed in the specified directory, therefore, the old program files are always referenced during RPM packaging. Example:
# Rpm-bl -- timecheck600lze-6.0-2.spec
Processingfiles: Lze
Warning: timecheckfailure:/usr/bin/Lze
Findingprovides :( using/usr/lib/RPM/find-Provides )...
Findingrequires :( using/usr/lib/RPM/find-requires )...
Provides: Lze-Edit
Prereq:/bin/sh
Requires:/bin/shld-linux.so.2libc.so.6libc.so.6 (glibc_2.0) libc. so.6 (glibc_2.1)
#
Note: In this example, the RPM is used to check the file list to see which file was generated 10 minutes ago. As a result, the RPM issued a warning: "Warning: timecheckfailure: /usr/bin/Lze ", which indicates that the file/usr/bin/Lze time check is incorrect. This is an old file. After investigation, it is a problem with makefile, which contains a phrase "cplze/usr/bin" missing ". After modification, compile the Connection Program again and perform a time check.
3. -- buildroot: Set the root directory for creating the package
This option is used as follows:
-- Buildroot
Note: the root directory used to create the package specified by the user.
This option is equivalent to adding a line to the file header of the package description file:
Buildroot:
It's just a little free to set on the command line.
By setting the root directory for creating the package, you can also create RPM packages that can only be created by the Super User (Root. The following uses ZZZ as an example to describe how to create an Lze package.
1) Create the directory used to create the RPM package under the Home Directory (/usr/ZZZ) of user ZZZ:
$ CD/usr/zzz
$ Mkdir-prpm/{build, RPMS/i386, sources, Specs, srpms}
$
2) copy the description file lze-6.0-2.spec to the RPM/specs directory, copy the source package lze-6.0-2.src.tgz to the RPM/sources directory.
$ CD/usr/zzz
$ CP/root/lze-6.0-2.specrpm/specs
$ CP/root/lze-6.0-2.src.tgzrpm/sources
$
3) Create the. rpmmacros file and edit it:
$ CD/usr/zzz
$ VI. rpmmacros
Add a line to this file:
% _ Topdir/usr/ZZZ/RPM
This command is used to determine that the top-level directory for RPM package creation is/usr/ZZZ/RPM.
4) Go to the description file directory and edit the script program for modifying the lze-6.0-2.spec installation segment:
$ CD/usr/ZZZ/RPM/specs
$ Vilze-6.0-2.spec
$
This command is used to determine that the top-level directory for RPM package creation is/usr/ZZZ/RPM.
The installation script program is changed to: (the original make command is commented out)
% Install
Echo "Install the script program to start execution"
# Makeinstall
Mkdir-p $ rpm_build_root/usr/bin
Mkdir-p $ rpm_build_root/etc
Mkdir-p $ rpm_build_root/usr/doc/lze-6.0
Cplzelzeime. wblzeime. py $ rpm_build_root/usr/bin
Cpinputme. deffunkey. defwbzc. dat $ rpm_build_root/etc
CP/usr/doc/lze-6.0/* $ rpm_build_root/usr/doc/lze-6.0
Note: In the script program, use the environment variable rpm_build_root of the root directory of the build package, and create several subdirectories (usr/bin, etc, usr/doc/lze-6.0) under the root directory of the build package one after another ), then copy the program or file to the corresponding subdirectory to complete the installation. 5) Select the -- buildroot option and execute the RPM package creation command:
$ CD/usr/ZZZ/RPM/specs
$ Rpm-BB -- buildroot/usr/zzz/ tmplze-6.0-2.spec
Executing: % prep
+ Umask022
+ CD/usr/ZZZ/RPM/build
+ Echo 'pre-processing script program (PREP) start to execute'
Pre-processing script program (PREP) started to execute
+ CD/usr/ZZZ/RPM/build
+ Rm-rflze-6.0
+/Bin/gzip-DC/usr/ZZZ/RPM/sources/lze-6.0-2.src.tgz
+ Tar-xvvf-
Drwxr-XR-xroot/root02001-11-0217: 04lze-6.0/
-RW ------- root/root2462262001-11-0216: 00lze-6.0/Lze. c
-RW ------- root/root982492001-11-0216: 00lze-6.0/lzeime. WB. c
-RW ------- root/root3399022001-11-0216: 00lze-6.0/lzeime. py. c
-RW-r -- root/root12832001-11-0216: 00lze-6.0/funkey. Def
-Rwxr -- r -- root/root2502001-11-0216: 00lze-6.0/inputme. Def
-RW-r -- root/root8132742001-11-0216: 00lze-6.0/wbzc. dat
-RW ------- root/root4742001-11-0216: 02lze-6.0/makefile
-RW-r -- root/root12552001-11-0217: 04lze-6.0/getinputme. c
+ Status = 0
+ '['0-ne0']'
+ Cdlze-6.0
++/Usr/bin/ID-u
+ '['2014 = 0']'
++/Usr/bin/ID-u
+ '['2014 = 0']'
+/Bin/chmod-RF + RX, G-W, o-w.
+ Exit0
Executing: % build
+ Umask022
+ CD/usr/ZZZ/RPM/build
+ Cdlze-6.0
+ Echo 'compile and run the connection script program (build'
Compile the connection script program (build) and start execution.
+ Make
Cc-fwritable-strings-DUSE_AS_LZE-DFOR_LINUX-s-I/usr/ZZZ/src/include-DFOR_LZE_INPUTME-olze/usr/ZZZ/src/libsrc/mycurses. clze. cgetinputme. c/usr/ZZZ/src/My.
Cc-DFOR_LINUX-s-I/usr/ZZZ/src/include-olzeime.wbgetinputme.clzeime.wb.c/usr/ZZZ/src/My.
Lzeime. WB. C: infunction 'do _ service ':
Lzeime. WB. C: 1409: Warning: passingarg5of 'bsearch' fromincompatiblepointertype
Cc-DFOR_LINUX-s-I/usr/ZZZ/src/include-olzeime.pygetinputme.clzeime.py.c/usr/ZZZ/src/My.
+ Exit0
Executing: % install
+ Umask022
+ CD/usr/ZZZ/RPM/build
+ Cdlze-6.0
+ Echo 'Install the script program to start execution'
Install the script program
+ Mkdir-P/usr/ZZZ/tmp/usr/bin
+ Mkdir-P/usr/ZZZ/tmp/etc
+ Mkdir-P/usr/ZZZ/tmp/usr/doc/lze-6.0
+ Cplzelzeime. wblzeime. py/usr/ZZZ/tmp/usr/bin
+ Cpinputme. deffunkey. defwbzc. dat/usr/ZZZ/tmp/etc
+ CP/usr/doc/lze-6.0/license/usr/doc/lze-6.0/readme/usr/ZZZ/tmp/usr/doc/lze-6.0
+ Exit0
Processingfiles: Lze
Findingprovides :( using/usr/lib/RPM/find-Provides )...
Findingrequires :( using/usr/lib/RPM/find-requires )...
Provides: Lze-Edit
Prereq:/bin/sh
Requires:/bin/shld-linux.so.2libc.so.6libc.so.6 (glibc_2.0) libc. so.6 (glibc_2.1)
Wrote:/usr/ZZZ/RPM/RPMS/i386/lze-6.0-2.i386.rpm
Executing: % clean
+ Umask022
+ CD/usr/ZZZ/RPM/build
+ Cdlze-6.0
+ Echo 'clean the script program (clean) and execute it after the package is created'
Run the clean script program after the package is created.
+ Exit0
$ Note: After rpm is successfully built, the/usr/ZZZ/RPM/RPMS/i386/lze-6.0-2.i386.rpm package file is generated,
Through the rpm query command, we can know that this package is exactly the same as the package content built by the Super User:
$ Rpm-qplv/usr/ZZZ/RPM/RPMS/i386/lze-6.0-2.i386.rpm
-RW-r -- fig November 6 09: 24/etc/funkey. Def
-Rwxr-xr-xrootroot250 November 6 09: 24/etc/inputme. Def
-RW-r -- rootroot813274 August 09: 24/etc/wbzc. dat
-Rwxr-xr-xrootroot408632 November 6 09: 24/usr/bin/Lze
-Rwxr-xr-xrootroot82920, May 23, November 6 09: 24/usr/bin/lzeime. py
-Rwxr-xr-xrootroot38568 August 22, November 6 09: 24/usr/bin/lzeime. WB
-RW-r -- rootroot1215 November 6 09: 24/usr/doc/lze-6.0/license
-RW-r -- rootroot3690 November 6 09: 24/usr/doc/lze-6.0/readme
$
Now we can say that common users can build various types of RPM software packages freely!
4. -- target: set the target platform
This option is used: -- Target System-platform-Operating System
Note: the default system of the software package created by rpm is i386, the platform is PC, and the operating system is Linux. If you want to change it, you need to use this option to determine, as shown in the following example:
# Rpm-BB -- targeti686-pc-solaris -- quietlze-6.0-2.spec
Create Target Platform: i686-pc-solaris
Creating target: i686-pc-solaris
#
In this example, the target platform of the RPM package is set to: i686-pc-solaris (that is, the system is i686, the platform is PC, the operating system is Solaris ). Note: You must create an i686 subdirectory in the/usr/src/Dist/RPMS directory. If the subdirectory of the system is not specified, RPM cannot generate the software package. We can query the generated software package to see its applicable system and operating system:
# Rpm-QP -- qf "archis % {arch} nosis % {OS} n"/usr/src/Dist/RPMS/i686/lze-6.0-2.i686.rpm
Archisi686
Osissolaris
#
We can see from the output that the system and operating system are exactly what we set.
5. -- Quiet: minimize information output
This option aims to reduce the output of RPM information. After this option is used, if no error occurs, RPM will not output redundant information, and the RPM is also relatively "quiet" (quiet.
$ Rpm-bl -- quietlze-6.0-2.spec
$
6. -- clean: execute file cleanup
If the cleanup section (% clean) of the package description file does not have the command to delete the temporary file, the temporary files still exist after the RPM package is created, occupying a certain amount of space. If you want RPM to automatically delete the temporary files, you can use the -- clean option when creating the package. This option executes a command, namely:
Rm-RF software name-version number
Use it to delete the "software name-version number" directory and all files under this directory. This "software name-version number" directory, that is, the default RPM directory for storing the decompressed source program.
# Rpm-bl -- cleanlze-6.0-2.spec
Processingfiles: Lze
Findingprovides :( using/usr/lib/RPM/find-Provides )...
Findingrequires :( using/usr/lib/RPM/find-requires )...
Provides: Lze-Edit
Prereq:/bin/sh
Requires:/bin/shld-linux.so.2libc.so.6libc.so.6 (glibc_2.0) libc. so.6 (glibc_2.1)
Executing: -- clean
+ Umask022
+ CD/usr/src/Dist/build
+ Rm-rflze-6.0
+ Exit0
Note: In this example, "executing: -- clean" indicates that RPM starts to clean up its own files.
7. -- rmsource: Delete the source program and description file.
This option instructs RPM to delete the software source program and package description file after creating the package. The software source program is defined by the source field in the package description file. This option can also be used independently, for example:
# Rpm -- rmsourcelze-6.0-2.spec
# Lslze-6.0-2.spec ../sources/lze-6.0-2.src.tgz
Ls: lze-6.0-2.spec: the file or directory does not exist
Ls: ../sources/lze-6.0-2.src.tgz: the file or directory does not exist
#
8. -- sign: The software package has a built-in digital signature.
This option is used to add a PGP digital signature to the software package. With the digital signature, you can verify whether the software package is original and has been modified. To use the PGP digital signature, you must first install the PGP Application and generate your own key pair. (For details about the digital signature, see>)
When you use this option to create a package, RPM requires you to enter a password. After the verification is correct, you can perform a series of operations to create the package. A digital signature is generated before the package is created, so that it can be written into the package. See the following example: (omitted many outputs)
# Rpm-BB -- signlze-6.0-2.spec
Enterpassphrase: mypass
Passphraseisgood.
Executing: % prep
......
Executing: % build
......
Executing: % install
......
Processingfiles: Lze
......
Requires:/bin/shld-linux.so.2libc.so.6
Generatingsignature: 1002
Generatingsignatureusingpgp.
Prettygoodprivacy (TM) version6.5.8
(C) 1999networkassociatesinc.
Usesthersaref (TM) Toolkit, whichiscopyrightrsadatasecurity, Inc.
Exportofthissoftwaremayberestrictedbytheu. S. Government. wrote:/root/test/RPMS/i386/lze-6.0-2.i386.rpm
Executing: % clean
......
#
Note: In this example, you need to enter the password, enter mypass, and verify the password. Then, run the RPM command to create the package. (In fact, mypass is not displayed on the screen) several lines under generatingsignature in this example are output when a digital signature is generated.
Other commands related to package Creation
There are two other commands related to package creation. They are all for source code packages in RPM format. Install the source code package before proceeding to the next step according to the package description file. 1. recompile command:
Usage: rpm -- recompilerpm source code package 1 RPM source code package 2...
For example:
Rpm -- recompilelze-6.0-2.src.rpm
When executing this command, first install the source code package, and then execute the preprocessing section (% prep) and compilation section (% build) of the software package description file in the source code package in sequence ), the script program of the installation section (% install. This command is equivalent to the following two commands:
1) rpm-ilze-6.0-2.src.rpm
2) rpm-bilze-6.0-2.spec
2. Recreate the command:
Usage: rpm -- rebuildrpm source Package 1 RPM source package 2...
For example:
Rpm -- rebuildlze-6.0-2.src.rpm
After the command is re-compiled, a new RPM package is not created. After the command is re-created, a new RPM package is created. When re-establishing the command for execution, first install the RPM source code package, and then execute the pre-processing Section (% prep), compilation section (% build) of the software package description file in the source code package in sequence ), install (% install), clear the script program of the segment (% clean), generate a new RPM execution package, and finally Delete the source package, description file and other temporary files. This command is equivalent to the following two commands:
1) rpm-ilze-6.0-2.src.rpm
2) rpm-BB -- clean -- resourcelze-6.0-2.spec