Home create var files under with "/" with rpmbuild
Reply: 1

create var files under with "/" with rpmbuild

Das D
1#
Das D Published in 2018-02-13 17:10:18Z

I'm new to the rpmbuild, googled and copy one spec file paramenters and created rpm successfully when i ran it the rpm nothing is creating

var.tar.gz -- this is my tar file. it has
var/
var/www/
var/www/html/index.html

My spec file

[root@kaka1 SPECS]# vi var.spec 

Name:           var
Version:        1
Release:        0
Summary:        Xiph Streaming media server that supports multiple formats.
Group:          Applications/Multimedia
License:        GPL
URL:            http################
Source:         var-1.0.tar.gz
Prefix:         %{_prefix}
Packager:       Sukama
BuildRoot:      %{_tmppath}/%{name}-root

%description
easily and supports open standards for commuincation and interaction.

%prep
rm -rf /root/rpmbuild/BUILD/*

%setup -n var


gzip -dc /root/rpmbuild/SOURCES/var-1.0.tar.gz| tar -xvvf  -
if [ $? -ne 0 ]; then
  exit $?
fi

could you help me where can i should mention my files to create under root?

iamauser
2#
iamauser Reply to 2018-02-14 14:56:03Z

First, don't use name like var, usr as package name, use that's more relevant to what the package may represent. Here is a simple spec file that should install index.html into the /var/www directory.

%define debug_package %{nil}
Summary: Simple SPEC
Name: simple
Version: 0
Release: 1
License: NONE # Use your suitable license
Group: NONE
URL: NONE
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

## Following lines are commented out, but that's the way to go 
#BuildRequires: httpd  # This needs https RPM during your build
#Requires: httpd  # This would require httpd to be installed for this RPM 

%description

%prep
%setup -q  # This untars the source

%build  # currently empty

%install  # This moves into the source directory "simple-0" (see below)
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/var/www
install -m 0644 index.html %{buildroot}/var/www/index.html

%clean
rm -rf $RPM_BUILD_ROOT

%post


%files
%defattr(-,root,root,-)
%doc
/var/www/index.html  # Your packages owns the file, but not the directories


%changelog
* Web Feb 14 2018 <user@localhost> - 0.0
- Initial build.

For the above .spec file, one would need a tarball named simple-0.tar.gz. This maps to the Source0 name that is used inside the .spec. The content in this case would be a directory and a file: simple-0/index.html.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.366165 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO