Reputation: 207
Have just built my first RPM-package per steps on https://tecadmin.net/create-rpm-of-your-own-script-in-centosredhat. Everything worked as described with the following output:
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
and I'd like to get rid of this part:
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
I suppose I have to change something in the spec file, which looks like:
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
but I am not sure exactly what part I should change, to what and why? Please bear with me as this is my first RPM package. Reading documentation now, but sometimes asking questions here on stackoverflow give much clearer and better answers than digging into documentation.
Upvotes: 1
Views: 2037
Reputation: 37792
In the %files
section it would suffice to write:
%files
/etc/mydumpadmin
That will already package the /etc/mydumpadmin folder recursively.
Upvotes: 3