Skip to content

Instantly share code, notes, and snippets.

@boardstretcher
Created February 28, 2017 20:10
Show Gist options
  • Save boardstretcher/dc3808ca85e3232f9655ca7ac5a1f94d to your computer and use it in GitHub Desktop.
Save boardstretcher/dc3808ca85e3232f9655ca7ac5a1f94d to your computer and use it in GitHub Desktop.
creating an RPM
######################################################################
# CREATING THE TEST APP AND ENVIRONMENT
(Log in as a non-root user)
mkdir ~/test-1.0
cd ~/test-1.0
echo echo this is a test > test.sh
chmod +x test.sh
echo just launch the script > README
cd
mkdir -p ~/rpmbuild/SOURCES
mkdir -p ~/rpmbuild/SPECS
tar -cvzf ~/rpmbuild/SOURCES/test-1.0.tar.gz test-1.0
cp test-1.0/* ~/rpmbuild/BUILD
######################################################################
# CREATING THE SPEC FILE
vim ~/rpmbuild/SPECS/demo.spec
######################################################################
# DEMO.SPEC FILE CONTENTS
Name: test
Version: 1.0
Release: 1%{?dist}
Summary: A test package
Group: Test Packages
License: GPL
URL: http://test.example.com
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date
%description
Demo package for deployment of one single file
%prerp
%setup -q
%build
#configure
#make %{? _smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
cp test.sh $RPM_BUILD_ROOT/usr/local/bin
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(755,root,root,755)
#%doc
%attr(0755,root,root)/usr/local/bin/test.sh
%changelog
######################################################################
# BUILDING THE PACKAGE
rpmbuild -ba rpmbuild/SPECS/demo.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment