Last active
August 15, 2019 11:23
-
-
Save dmi3mis/1635f15e74c6617b9f3bac4d6cf701a8 to your computer and use it in GitHub Desktop.
example of rpm build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpg --gen-key | |
gpg --fingerprint | |
gpg -a -o ~/RPM-GPG-KEY-developer --export 3452df23 | |
echo '%_gpg_name 3452df23' > ~/.rpmmacros | |
yum install rpm-build | |
rpmbuild test.spec | |
cp test.spec rpmbuild/SPECS | |
cp script-1.0.tar.gz rpmbuild/SOURCES | |
cd rpmbuild/SPECS | |
rpmbuild --sign -ba test.spec | |
rpm --import ~/RPM-GPG-KEY-developer | |
cd rpmbuild/RPMS/x86_64 | |
rpm -ihv test-1.0-x86-64.rpm | |
/usr/local/bin/script.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir script-1.0 | |
cat <<EOF >script-1.0/script.sh | |
#!/bin/bash | |
echo Today is `date` | |
EOF | |
tar czvf script-1.0.tar.gz script-1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name: test | |
Version: 1.0 | |
Release: 1%{?dist} | |
Summary: A test package | |
License: GPL | |
Group: Testing | |
Url: http://www.company.com/testing | |
Source: %{name}-%{version}.tar.gz | |
BuildRoot: %{mktemp -ud %{_tmppath}/%{name}-%{version}-XXXXXXX} | |
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp | |
Requires: /bin/bash,/bin/date | |
%description | |
A test package to test simple script written in bash. | |
%prep | |
%setup -q | |
%install | |
rm -rf $RPM_BUILD_ROOT | |
mkdir -p $RPM_BUILD_ROOT/usr/local/bin | |
cp script.sh $RPM_BUILD_ROOT/usr/local/bin | |
%clean | |
rm -rf $RPM_BUILD_ROOT | |
%files | |
%defattr(-,root,root,-) | |
# %doc | |
%attr(0755,root,root)/usr/local/bin/script.sh | |
%changelog | |
* Thu May 02 2014 Developer <developer@company.com> 1.0-1 | |
- Initial RPM | |
- Added /usr/local/bin/script.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment