Sunday, 14 June 2015

RPM build + spec + file

Folder Structure

[root@centos64 rpmbuild]# ls
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS



Sources Files , should be placed inside SOURCES folder. The file inside tar ball would be placed on respective location , which specified in spec file

[root@centos64 rpmbuild]# cd SOURCES/
[root@centos64 SOURCES]# ls
s3fs-0.1.tar.gz


[root@centos64 SOURCES]# tar -ztvf s3fs-0.1.tar.gz

drwxr-xr-x root/root         0 2015-06-14 09:00 s3fs-0.1/
-rw-r--r-- root/root      1162 2015-06-14 10:05 s3fs-0.1/s3fsd
-rw-r--r-- root/root       738 2015-06-14 10:05 s3fs-0.1/s3fs
-rw-r--r-- root/root        36 2015-06-14 05:01 s3fs-0.1/s3fs.conf





Spec file:

[root@centos64 rpmbuild]# cat SPECS/sam.spec
Summary: s3fs manage services for mount points
Name: s3fs
Version: 0.1
Release: 1
URL:     http://samlinuxsam.blogspot.in/2015/06/s3fs-service-bash.html
License: GPL
Group: Applications/Internet
BuildRoot: %{_tmppath}/%{name}-root
Requires: bash
Source0: s3fs-%{version}.tar.gz
BuildArch: noarch

%description
s3fs manages mount points and check the mount points every 15 minutes

%prep
%setup

%build


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
mkdir -p ${RPM_BUILD_ROOT}/etc
mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
install -m 755 s3fs ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 s3fs.conf ${RPM_BUILD_ROOT}/etc/
install -m 755 s3fsd ${RPM_BUILD_ROOT}/etc/init.d/



%clean
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/s3fs
%config /etc/s3fs.conf
%config /etc/init.d/s3fsd

%changelog
* Fri Jun 12 2015 praveensams16@gmail.com
- Uberscript!





#########




Building RPM


rpmbuild --bb rpmbuild/SPECS/sam.spec



No comments:

Post a Comment