LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-26-2017, 11:06 PM   #1
nitrohuffer2001
Member
 
Registered: Apr 2006
Posts: 165

Rep: Reputation: 19
RPM Creation Help


Hello Folks,

I have been trying to create an RPM for two days now and I think I have gone retarded or something because I can not get rpmbuild to actually generate an rpm.

The RPM I want to create is really just a bunch of files that need to get placed into a directory and then have an install script ran against them.

Here is a snipit out of a script I wrote that extracts and installs the software:
Code:
     /bin/mount -t iso9660 /tmp/SecWorld-linux64-user-12.10.00.iso /mnt -o loop
                         for f in `find /mnt/linux/libc6_11/amd64/nfast/ -name '*.tar' `; do tar xvf $f; done
fi

# Move everything into the right places
/bin/mv /opt/nfast /ngs/app/nfast

# Link Everything up
/bin/ln -s /ngs/app/nfast/ /opt/nfast

# Actually install the software
/ngs/app/nfast/sbin/install
so basicly find some tars - extract them - move them to the correct location - run the installer. I would like to do this in an RPM and it seems like that should be a trivial task....not for me apparently.

Here is the latest in my endevours:

I created my env:
Code:
ls rpmbuild/
BUILD  BUILDROOT  nfast-1.0  nfast-1.0.tar.gz  RPMS  SOURCES  SPECS  SRPMS  tmp
Then:
Code:
~/rpmbuild]$ ll nfast-1.0/ngs/app/nfast/
total 68
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 bin
drwxr-xr-x 3 myuser dev-group 4096 Feb 29  2016 driver
drwxr-xr-x 3 myuser dev-group 4096 Feb 29  2016 etc
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 femcerts
drwxr-xr-x 5 myuser dev-group 4096 Feb 29  2016 java
drwxr-xr-x 5 myuser dev-group 4096 Feb 29  2016 lib
drwxr-xr-x 4 myuser dev-group 4096 Feb 29  2016 nethsm-firmware
drwxr-xr-x 3 myuser dev-group 4096 Feb 29  2016 openssl
drwxr-xr-x 9 myuser dev-group 4096 Feb 29  2016 python
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 sbin
drwxr-xr-x 8 myuser dev-group 4096 Feb 29  2016 scripts
drwxr-xr-x 5 myuser dev-group 4096 Feb 29  2016 share
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 sslclient
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 sslproxy
drwxr-xr-x 5 myuser dev-group 4096 Feb 29  2016 tcl
drwxr-xr-x 2 myuser dev-group 4096 Feb 29  2016 testdata
drwxr-xr-x 6 myuser dev-group 4096 Feb 29  2016 toolkits
Here is my spec.file
Code:
more  SPECS/nfast.spec
%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress

Summary: Sinple nFast rpm
Name: nfast
Version: 1.0
Release: 1
License: GPL+
Group: App/Tools
SOURCE0 : %{name}-%{version}.tar.gz
URL: http://no.company.com/

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
%{summary}

%prep
%setup -q

%build
# Empty section.

%install
rm -rf %{buildroot}
mkdir -p  %{buildroot}

# in builddir
cp -ar * %{buildroot}

%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{_datadir}/ngs/app/nfast
%changelog
* Thu May 26 2017  What Eva <whateva@blah.org> 1.0-1
- First Build

Then I give myself one of these:
Code:
rpmbuild -bb rpmbuild/SPECS/nfast.spec
And.....fail.

Code:
[myuser@team-server1 ~]$ rpmbuild -bb rpmbuild/SPECS/nfast.spec
Executing(%prep): /bin/sh -e /ngs/app/home/myuser/rpmbuild/tmp/rpm-tmp.WqYjas
+ umask 022
+ cd /ngs/app/home/myuser/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /ngs/app/home/myuser/rpmbuild/BUILD
+ rm -rf nfast-1.0
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /ngs/app/home/myuser/rpmbuild/SOURCES/nfast-1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd nfast-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /ngs/app/home/myuser/rpmbuild/tmp/rpm-tmp.i0P5sd
+ umask 022
+ cd /ngs/app/home/myuser/rpmbuild/BUILD
+ cd nfast-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /ngs/app/home/myuser/rpmbuild/tmp/rpm-tmp.WKUaNY
+ umask 022
+ cd /ngs/app/home/myuser/rpmbuild/BUILD
+ '[' /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64 '!=' / ']'
+ rm -rf /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
++ dirname /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
+ mkdir -p /ngs/app/home/myuser/rpmbuild/BUILDROOT
+ mkdir /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
+ cd nfast-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
+ mkdir -p /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
+ cp -ar ngs /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64
Processing files: nfast-1.0-1.x86_64
error: File not found: /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64/usr/share/ngs/app/nfast


RPM build errors:
    File not found: /ngs/app/home/myuser/rpmbuild/BUILDROOT/nfast-1.0-1.x86_64/usr/share/ngs/app/nfast
[myuser@team-server1 ~]$ rpmbuild -bb rpmbuild/SPECS/nfast.spec
Any help and or ideas would be super great. I have tried various different spec's and I am just missing something.

Thanks in advance!
 
Old 05-27-2017, 01:33 AM   #2
nitrohuffer2001
Member
 
Registered: Apr 2006
Posts: 165

Original Poster
Rep: Reputation: 19
I made a bit of progress but....

So I updated my spec file as follows:

Code:
%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress

Summary: A very simple bin rpm package
Name: nfast
Version: 1.0
Release: 1
License: GPL+
Group: Development/Tools
SOURCE0 : %{name}-%{version}.tar.gz


BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
%{summary}

%prep
%setup -q

%build
# Empty section.

%install
rm -rf %{buildroot}
mkdir -p  %{buildroot}/ngs/app/nfast




# in builddir
cp -ar *  %{buildroot}


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)

/ngs/app/nfast
And it builds the rpm, yea....but I am stil broken.

If I give an rpm -qlp /path/to/rpm it looks good:

*snipit
Code:
rpm -qlp rpmbuild/RPMS/x86_64/nfast-1.0-1.x86_64.rpm
/ngs/app/nfast
/ngs/app/nfast/bin
/ngs/app/nfast/bin/analyse-warrant
/ngs/app/nfast/bin/anonkneti
/ngs/app/nfast/bin/bulkerase
/ngs/app/nfast/bin/cardpp
/ngs/app/nfast/bin/cfg-mkcardlist
/ngs/app/nfast/bin/cfg-mkdefault
/ngs/app/nfast/bin/cfg-pushnethsm
/ngs/app/nfast/bin/cfg-remoteslots
/ngs/app/nfast/bin/cfg-reread
/ngs/app/nfast/bin/checkmod
/ngs/app/nfast/bin/chkserv
/ngs/app/nfast/bin/ckcerttool
/ngs/app/nfast/bin/ckcheckinst
/ngs/app/nfast/bin/ckimportbackend
/ngs/app/nfast/bin/ckinfo
/ngs/app/nfast/bin/cklist
When I go to install:

Code:
sudo rpm -Uvh nfast-1.0-1.x86_64.rpm

error: Failed dependencies:
	/bldstore/vines/b.1449840038.15521.56/pysrc-0.29.1/own/spec/user/python/bin/python2.7 is needed by nfast-1.0-1.x86_64
	/opt/nfast/bin/nfast-tclsh8 is needed by nfast-1.0-1.x86_64
	/opt/nfast/python/bin/python is needed by nfast-1.0-1.x86_64
	/opt/nfast/python/bin/python2.7 is needed by nfast-1.0-1.x86_64
	/usr/local/bin/python is needed by nfast-1.0-1.x86_64
	libXss.so.1()(64bit) is needed by nfast-1.0-1.x86_64
/opt/nfast is default where it wants to go so i re-rolled the tar file with the original path and ran rpmbuild again.

and it looks better:
Code:
rpm -qlp nfast-1.0-1.x86_64.rpm
/opt/nfast
/opt/nfast/bin
/opt/nfast/bin/analyse-warrant
/opt/nfast/bin/anonkneti
/opt/nfast/bin/bulkerase
/opt/nfast/bin/cardpp
/opt/nfast/bin/cfg-mkcardlist
/opt/nfast/bin/cfg-mkdefault
/opt/nfast/bin/cfg-pushnethsm
/opt/nfast/bin/cfg-remoteslots
/opt/nfast/bin/cfg-reread
/opt/nfast/bin/checkmod
/opt/nfast/bin/chkserv
/opt/nfast/bin/ckcerttool
/opt/nfast/bin/ckcheckinst
/opt/nfast/bin/ckimportbackend
Then.....
Code:
rpm -Uvh nfast-1.0-1.x86_64.rpm
error: Failed dependencies:
	/bldstore/vines/b.1449840038.15521.56/pysrc-0.29.1/own/spec/user/python/bin/python2.7 is needed by nfast-1.0-1.x86_64
	/usr/local/bin/python is needed by nfast-1.0-1.x86_64
	libXss.so.1()(64bit) is needed by nfast-1.0-1.x86_64
Not sure why I would be getting this as I am just trying to blat everything out to the /opt/nfast dir.

Ideas?

Thanks
 
Old 05-27-2017, 01:45 AM   #3
nitrohuffer2001
Member
 
Registered: Apr 2006
Posts: 165

Original Poster
Rep: Reputation: 19
Closer....

Hi,

If I run with --nodeps flag it's a winner. (sorta)

Code:
sudo rpm -Uvh nfast-1.0-1.x86_64.rpm --nodeps
Preparing...                ########################################### [100%]
   1:nfast                  ########################################### [100%]
Then...

Code:
cd /opt/
[]$ ls
nfast  rh
[]$ cd nfast
[]$ ls
bin     etc       java  nethsm-firmware  python  scripts  sslclient  tcl       toolkits
driver  femcerts  lib   openssl          sbin    share    sslproxy   testdata
Now we are getting somewhere.

I just need to have the %post run the installer!
 
Old 05-27-2017, 02:28 AM   #4
nitrohuffer2001
Member
 
Registered: Apr 2006
Posts: 165

Original Poster
Rep: Reputation: 19
Win!!!!!!

Thanks for all the help everyone! /sigh

Added this to the above spec file:
Code:
/opt/nfast

%post
/bin/mv /opt/nfast /ngs/app/nfast

/bin/ln -s /ngs/app/nfast/ /opt/nfast

/ngs/app/nfast/sbin/install

%changelog
re rpmbuild and boom! Works like a champ.

Take aways: It takes about 2 days to read all the docs and tutorials before you get a grasp of building RPM's.

Thanks for all the help everyone (satire).

Code:
/opt/nfast/bin/enquiry
Server:
 enquiry reply flags  none
 enquiry reply level  Six
 serial number
 mode                 operational
 version              3.21.3
 speed index          0
 rec. queue           2..50
 level one flags      none
 version string       3.21.3cam7,
 checked in           00000000487debd5 Wed Jul 16 12:38:45 2008
 level two flags      none
 max. write size      8192
 level three flags    none
 level four flags     ServerHasPollCmds ServerHasLongJobs ServerHasCreateClient
 module type code     0
 product name         nFast server
 device name
 EnquirySix version   4
 impath kx groups
 feature ctrl flags   none
 features enabled     none
 version serial       0
 remote server port   9004

Last edited by nitrohuffer2001; 05-27-2017 at 02:32 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy RPM Creation dadealeus Red Hat 3 01-26-2014 03:56 PM
Need help in RPM creation snaryanan@gmail.com Linux - Newbie 2 11-30-2011 08:48 AM
Creation of RPM package yashwantpinge Programming 1 03-06-2006 07:57 AM
Rpm Creation sajjadc Red Hat 1 07-10-2005 01:22 PM
rpm file creation mayankjohri Linux - Software 4 03-17-2003 07:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration