Centos
src.rpm 和 rpm 文件提取和壓縮
我下載這個文件 util-linux-2.23.2-65.el7_9.1.src.rpm
我使用這個命令提取它上面的所有文件
rpm2cpio ./util-linux-2.23.2-65.el7_9.1.src.rpm | cpio -idmv
這是提取的所有文件
[root@vps8865 SPECS]# ls 0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch 0061-libmount-be-more-restrictive-about-valid-tag-names.patch 0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch 0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch 0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch 0065-hwclock-change-audit-message.patch 0066-su-clean-up-groups-initialization.patch 0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch 0068-lscpu-use-cpu-and-revision-tag-if-available.patch 0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch 0070-libblkid-fix-memory-leak-in-blkid_parse_tag_string.patch 0071-findmnt-don-t-rely-on-st_dev-for-target.patch 0072-libmount-cleanup-fs-root-detection-code.patch 0073-libmount-mark-overlay-as-pseudo-FS.patch 0074-logger-be-more-precise-about-port-description.patch 0075-libfdisk-gpt-be-more-careful-with-64bit-constants.patch 0076-lsns-backport-new-command.patch 0077-lib-strutils-make-strmode-more-generic.patch 0078-lsipc-backport-new-command.patch 0079-blkdiscard-backport-zeroout-support.patch 0080-sulogin-and-agetty-virtual-consoles-support-xvc-and-.patch 0081-chrt-backport-DEADLINE-scheduler-support.patch 0082-fdisk-backport-DOS-logical-partitions-chain-reorder.patch 0083-tests-cleanup-tests.patch 0084-libmount-add-support-for-bind-ro.patch 0085-libblkid-store-only-canonical-devnames-to-the-cache.patch 0086-libblkid-avoid-recursion-in-EBR.patch 0087-findmnt-fix-target-behaviour.patch 0088-su-properly-clear-child-PID.patch 0089-fdisk-fix-Blocks-column-calculation.patch 0090-fdisk-fix-menu-for-GPT.patch 0091-logger-backport-size.patch 0092-fdisk-print-header-UUID-for-GPT.patch 0093-fdisk-improve-l-error-handling.patch 0094-losetup-improve-man-page-SYNOPSIS.patch 0095-libblkid-fix-potential-bufer-overflows.patch 0096-umount-fix-obsolete-info-about-loop-in-umount.8.patch 0097-mount-fix-all-and-nofail-return-code.patch 0098-umount-exclude-selinuxfs-from-all.patch 0099-sfdisk-remove-useless-CDROM-detection-for-s.patch 0100-more-fix-repeat-search-crash.patch 0101-more-avoid-double-free-on-exit.patch 0102-ipcs-show-gid-instead-of-uid.patch 0103-ipcs-fix-JP-status-message.patch 0104-swapon-fix-discard-option-parsing.patch 0105-fallocate-Added-posix_fallocate-support.patch 0106-zramctl-backport-from-v2.29.patch 0107-libblkid-zfs-let-s-keep-compiler-happy.patch 0108-blkid-make-zfs-detection-more-robust.patch 0109-zfs-make-less-syscalls.patch 0110-libblkid-zfs-keep-bufferes-read-only.patch 0111-libblkid-don-t-mark-zfs-as-RAID.patch 0112-tests-update-ZFS-test.patch 0113-libblkid-zfs-add-cast-to-fix-UB-cppcheck.patch 0114-libblkid-Avoid-OOB-access-on-illegal-ZFS-superblocks.patch 0115-lscpu-backport-from-v2.29.patch 0116-fdisk-use-sysfs_devno_is_wholedisk.patch 0117-zramctl-add-bash-completion.patch 0118-zramctl-make-mm_stat-parser-more-robust.patch 0119-fdisk-improve-menu-and-u-for-GPT.patch 0120-tests-update-for-RHEL7.4-changes.patch 0121-zramctl-be-more-specific-about-default-output.patch 0122-libfdisk-gpt-fix-UUID-printing.patch 0123-libblkid-Add-metadata-signature-check-for-IMSM-on-4K.patch 0124-lscpu-use-sysfs-for-table-access-if-available.patch 0125-lscpu-improve-for-offline-CPUs-on-AMD.patch 0126-libmount-use-eacess-rather-than-open-to-check-mtab-u.patch 0127-agetty-fix-etc-os-release-parsing.patch 0128-fdisk-remove-obsolete-info-about-GPT-from-man-page.patch 0129-libfdisk-gpt-sync-type-UUIDs-with-upstream.patch 0130-lscpu-cleanup-DMI-detection-return-codes.patch 0131-flock-zero-timeout-is-valid.patch 0132-logger-add-man-page-note-about-the-default-tag.patch 0133-script-use-all-io-to-write.patch 0134-logger-do-not-rely-only-getlogin-3-telling-who-ran-t.patch 0135-login-use-IPv4-on-IPv4-mapping-to-IPv6.patch 0136-blkid-update-man-page-about-lsblk-and-ambivalent-pro.patch 0137-wipefs-fix-t-filter.patch 0138-tests-backport-new-ts_scsi_debug_init.patch 0139-tests-ts_scsi_debug_init-must-not-run-in-a-subshell.patch 0140-tests-cleanup-fdisk-outputs.patch 0141-tests-check-for-mdadm.patch 0142-lsmem-chmem-backport-new-commands.patch 0143-lsmem-make-split-optional-follow-output-by-default.patch 0144-libmount-fix-access-utab-write-test.patch 0145-login-add-LOGIN_PLAIN_PROMPT-to-login.defs.patch 0146-libblkid-Add-VDO-superblock-information-into-blkid.patch 0147-include-debug-don-t-print-pointer-address-for-SUID-p.patch 0148-mkswap-tolerate-ENOTSUP-when-failing-to-relabel.patch 0149-libmount-fix-debug-message.patch 0150-lsns-missing-ns-name-is-not-error.patch 0151-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch 0152-libsmartcols-add-basic-tools-necessary-for-new-versi.patch 0153-libsmartcols-backport-upstream-version-v2.32-158-gc0.patch 0154-tests-backport-libsmartcols-tests.patch 0155-lslogins-fix-password-verification.patch 0156-umount-add-note-about-lazy.patch 0157-losetup-add-info-about-lazy-detach-to-manpage.patch 0158-setarch-Fix-ppc64le-architectures.patch 0159-fallocate-backport-v2.32-164-g641af90dc.patch 0160-libmount-fix-mnt_table_is_fs_mounted-for-rbind.patch 0161-mount-add-ext4-to-some-places-in-man-page.patch 0162-agetty-keep-c_iflags-unmodified-on-autologin.patch 0163-sulogin-don-t-use-strcpy-enlarge-pwd-line-buffer.patch 0164-sulogin-improve-support-for-locked-root-account.patch 0165-sulogin-Always-make-echo-work-after-performing-getpa.patch 0166-sulogin-make-getpasswd-.-return-NULL-on-D.patch 0167-sulogin-bail-out-from-getpasswd-.-on-timeout.patch 0168-losetup-keep-f-and-devname-mutually-exclusive.patch 0169-lscpu-fix-mzx-min-MHz-reporting.patch 0170-chcpu-cleanup-return-codes.patch 0171-chcpu-cleanup-stdout-stderr-usage.patch 0172-lscpu-chcpu-Avoid-use-of-the-old-CPU-macros.patch 0173-chcpu-Fix-maximal-number-of-CPUs.patch 0174-libblkid-minix-Match-minix-superblock-types.patch 0175-libblkid-minix-Sanity-check-superblock-s_state-for-v.patch 0176-libblkid-minix-Use-same-checks-for-version-3.patch 0177-mount-append-inverting-options-for-mount.-type-on-us.patch 0178-sulogin-backport-RHEL-8-version.patch 0179-agetty-backport-RHEL-8-version.patch 0180-swapon-mkswap-sync-man-page-with-upstream.patch 0181-libblkid-zeroize-errno-on-blkid_probe_get_buffer-suc.patch 0182-libmount-fix-mount-a-for-cifs.patch 0183-agetty-fix-man-page-formatting.patch 0184-build-sys-add-missing-open_memstream-test.patch 0185-lib-canonicalize-make-DM-canonicalization-more-robus.patch 0186-libblkid-fix-file-descriptor-leak-in-blkid_verify.patch 0187-misc-cleanup-size_t-vs.-int-for-string_add_to_idarra.patch 0188-setarch-use-personality-system-call-when-it-is-avail.patch 0189-setarch-fix-personality-syscall-return-code-check.patch 0190-build-sys-check-for-librtas.patch 0191-setarch-prefer-preprocessor-rather-than-autotools-ch.patch 0192-libmount-Preserve-empty-string-value-in-optstr-parsi.patch 0193-tests-accept-empty-values.patch 0194-liblkid-Add-length-check-in-probe_nilfs2-before-crc3.patch 0195-libmount-fix-is-mounted-check-for-btrfs.patch 0196-libmount-fix-uid-and-gid-translation.patch 0197-col-make-flush_line-a-little-bit-robust.patch 0198-libmount-fix-mount-a-EBUSY-for-cifs.patch 0199-chrt-follow-nice-setting-prefer-sched_setscheduler.patch 0200-chrt-default-to-SCHED_RR-policy.patch 0201-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch 2.17-kill-strtol.patch 2.23-login-lastlog-create.patch 2.24-agetty-clocal.patch 2.24-agetty-etc-os-release.patch 2.24-blockdev-setbsz-hint.patch 2.24-fsck-fstab.patch 2.24-libfdisk-fix-SIGFPE.patch 2.24-libmount-3.14.patch 2.24-libmount-canonicalize-for-conversion-from-loopdev.patch 2.24-libmount-mem.patch 2.24-losetup-add-device.patch 2.24-losetup-offset.patch 2.24-partx-update.patch 2.24-sfdisk-y-n-miscmatch.patch 2.24-su-fix-lastlog-and-btmp-logging.patch 2.24-su-suppress-PAM-info-messages.patch 2.24-tests-portability.patch 2.24-unshare-mount-fork.patch 2.24-utmpdump-ipv6.patch 2.25-blockdev-geom.patch 2.25-dmesg-w.patch 2.25-flock-nfs4.patch 2.25-fsck-nohelper.patch 2.25-fstrim-all.patch 2.25-hwclock-hang.patch 2.25-lib-add-path_strdup.patch 2.25-libblkid-detect-alone-PMBR.patch 2.25-libblkid-gpt-512.patch 2.25-libblkid-Identify-extN-file-system-properly.patch 2.25-libblkid-io-errors.patch 2.25-libblkid-no-more-probe-for-btrfs-backup-superblock.patch 2.25-libblkid-return-codes.patch 2.25-libblkid-thinpool.patch 2.25-libblkid-xfs-log.patch 2.25-libblkid-xfs.patch 2.25-lscpu-discontinuous-NUMA-nodes.patch 2.25-lscpu-d_type.patch 2.25-lscpu-sort-NUMA.patch 2.25-mount-man-default.patch 2.25-mount-man-xfs.patch 2.25-swapon-discard.patch 2.25-taskset-man-fix-permissions.patch 2.25-uuidd-timeout.patch 2.25-wipefs-call-BLKRRPART-when-erase-partition-table.patch 2.25-wipefs-nested-pt.patch 2.26-blkdiscard.patch 2.26-libblkid-fat.patch 2.26-libsmartcols.patch 2.26-logger-man-kern.patch 2.26-login-SIGXFSZ.patch 2.26-lsblk-mpath.patch 2.26-lslogins.patch 2.26-mount-man-move.patch 2.26-raw-stat.patch 2.26-su-coredump-message.patch 2.26-unshare-rebase.patch 2.27-libblkid-xfs-log.patch 2.28-lslogins-rebase.patch nologin.8 nologin.c rhel7.0-unshare-user.patch util-linux-2.23.2.tar.xz util-linux-60-raw.rules util-linux-chsh-chfn.pamd util-linux-login.pamd util-linux-remote.pamd util-linux-runuser-l.pamd util-linux-runuser.pamd util-linux.spec util-linux-su-l.pamd util-linux-su.pamd v2.26-nsenter-selinux.patch
我編輯了一些文件
現在我需要幫助如何將所有提取的文件壓縮為 rpm 文件。或 src.rpm 文件
這樣我就可以重新安裝修改後的包
安裝 rpmbuild 以建構 rpm 包
yum install rpm-build
提取源 rpm 時有一個目錄 SPECS。使用其中的規範文件像這樣重建包
rpmbuild -ba ~/rpmbuild/SPECS/package.spec