刚刚在https://tecadmin.net/create-rpm-of-your-own-script-in-centosredhat上按步骤构建了我的第一个RPM软件包。一切都按以下输出描述工作:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.vxrO2S
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf mydumpadmin-1
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/mydumpadmin-1.tgz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mydumpadmin-1
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.B4VPI0
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd mydumpadmin-1
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.HOCtq8
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64
++ dirname /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64
+ cd mydumpadmin-1
+ install -m 0755 -d /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64/etc/mydumpadmin
+ install -m 0600 credentials.txt /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64/etc/mydumpadmin/credentials.txt
+ install -m 0755 mysql-dump.sh /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64/etc/mydumpadmin/mysql-dump.sh
+ install -m 0644 README.md /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64/etc/mydumpadmin/README.md
+ install -m 0644 settings.conf /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64/etc/mydumpadmin/settings.conf
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /root/rpmbuild/BUILD/mydumpadmin-1
/usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 0 CRC32s did match.
+ '[' noarch = noarch ']'
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: mydumpadmin-1-0.noarch
warning: File listed twice: /etc/mydumpadmin/README.md
warning: File listed twice: /etc/mydumpadmin/credentials.txt
warning: File listed twice: /etc/mydumpadmin/mysql-dump.sh
warning: File listed twice: /etc/mydumpadmin/settings.conf
Provides: mydumpadmin = 1-0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64
Wrote: /root/rpmbuild/SRPMS/mydumpadmin-1-0.src.rpm
Wrote: /root/rpmbuild/RPMS/noarch/mydumpadmin-1-0.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.AhzeJw
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd mydumpadmin-1
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/mydumpadmin-1-0.x86_64
+ exit 0
我想摆脱这一部分:
warning: File listed twice: /etc/mydumpadmin/README.md
warning: File listed twice: /etc/mydumpadmin/credentials.txt
warning: File listed twice: /etc/mydumpadmin/mysql-dump.sh
warning: File listed twice: /etc/mydumpadmin/settings.conf
我想我必须在spec文件中更改一些内容,
Name: mydumpadmin
Version: 1
Release: 0
Summary: An Advance Bash Script for MySQL Database Backup
Group: TecAdmin
BuildArch: noarch
License: GPL
URL: https://github.com/tecrahul/mydumpadmin.git
Source0: mydumpadmin-1.tgz
%description
Write some description about your package here
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/etc/mydumpadmin
install -m 0600 credentials.txt $RPM_BUILD_ROOT/etc/mydumpadmin/credentials.txt
install -m 0755 mysql-dump.sh $RPM_BUILD_ROOT/etc/mydumpadmin/mysql-dump.sh
install -m 0644 README.md $RPM_BUILD_ROOT/etc/mydumpadmin/README.md
install -m 0644 settings.conf $RPM_BUILD_ROOT/etc/mydumpadmin/settings.conf
%files
/etc/mydumpadmin
/etc/mydumpadmin/credentials.txt
/etc/mydumpadmin/mysql-dump.sh
/etc/mydumpadmin/README.md
/etc/mydumpadmin/settings.conf
%changelog
* Tue Oct 24 2017 Rahul Kumar 1.0.0
- Initial rpm release
但是我不确定应该更改哪个部分,更改为什么以及为什么更改?请忍受,因为这是我的第一个RPM软件包。现在正在阅读文档,但是有时在这里对stackoverflow提出问题会比深入研究文档提供更清晰,更好的答案。
答案 0 :(得分:2)
在%files
部分中,只需编写:
%files
/etc/mydumpadmin
这将已经递归打包/ etc / mydumpadmin文件夹。