LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-02-2020, 06:52 PM   #1
csyinw
LQ Newbie
 
Registered: Nov 2020
Posts: 1

Rep: Reputation: Disabled
I have a question about rpm spec.


<Current spec specifications>

%define debug_package %{nil}

Name: thearmor

Version: 1.0.0

Release: 1%{?Dist}

Summary: A test package

Group: thearmor Package

License: GPL

URL: http://test.example.com

Source0: %{name}-%{version}.tar.gz

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



%Description

Demo package for deployment of one single file



%prep

%setup -q



%pre

find /home/nfs/$USER -name 'thearmor*' | xargs rm -rf



%post

find /home/$USER/Desktop -name 'thearmor*.tar.gz' -exec tar -xvf {} -C /home/nfs/$USER \;

chown -R sychungsichung /home/nfs/$USER/thearmor





%build



#configure

#make %{? _smp_mflags}





%install

cp -r thearmor $RPM_BUILD_ROOT/usr/local/bin





%clean

rm -rf $RPM_BUILD_ROOT



%files

%defattr (-,root,root,-)

#%doc

%attr(755,root,root)/usr/local/bin/thearmor



<The order of execution >

1. cd~

2. rpmbuild thearmor.spec

3. cp thearmor-1.0.tar.gz rpmbuild/SOURCES

4. cp thearmor.spec rpmbuild/SPESCS

5. cd rpmbuild/SPECS

6. rpmbuild --sign -ba thearmor.spec





<Error screen 화면

+ umask 022

+ cd /home/sychung/rpmbuild/BUILD

+ cd /home/sychung/rpmbuild/BUILD

+ rm -rf thearmor-1.0.0

+ /usr/bin/gzip -dc /home/sychung/rpmbuild/SOURCES/thearmor-1.0.0.tar.gz

+ /usr/bin/tar -xf -

+ STATUS=0

+ '[' 0 -ne 0 ']'

+ cd thearmor-1.0.0

/var/tmp/rpm-tmp.T54OBf: line 35: cd: thearmor-1.0.0: No sum file or directory

Error: Bad exit status from /var/tmp/rpm-tmp.T54OBf (%prep)

Bad exit status from /var/tmp/rpm-tmp.T54OBf (%prep)



<Purpose>

When sending the file, thearmor.tar.gz

Compression Path:/home/sychung/Desktop copy, change permissions on the copied path (/home/nfs/sychung) and create an rpm package to minimize and automatically execute this operation.

How can I make it the way I want it to?
 
Old 11-10-2020, 06:48 AM   #2
bgstack15
Member
 
Registered: Jul 2017
Distribution: korora
Posts: 90

Rep: Reputation: Disabled
The error message is a classic one where rpmbuild expects that the SOURCE0 contents are inside a directory named "%{name}-%{version}" just like the name of the tarball. You can change this behavior on the %setup macro with a -c (lowercase C as in Charlie) and a value. So:
Code:
%setup -q -c directoryname
And then your contents should be underneath directoryname. But of course it always take some experimentation. I have used "pwd ; ls -l" in my spec files before to debug where the shell is, and what it sees there.
Reference: http://ftp.rpm.org/max-rpm/s1-rpm-in...SETUP-C-OPTION

Also, in general, rpms are not the best way to manage the contents of your local user directory. Rpms are designed for controlling system packages. And wow, using rm -rf in a pre-install macro is risky! It looks like you're simply trying to replace the old "thearmor" file. Rpm will already manage the files that are deployed by the rpm that is being installed, so there is no need to delete an old file whose exact name matches one that is going to be deployed.

Also worth noting, is that the $HOME and $USER variables are interpreted by the shell, at the time the rpm is built. So that basically means that the rpm %pre will actually hard-code this value:
Code:
find /home/nfs/csyinw -name 'thearmor*' | xargs rm -rf
So even if your username is different across different systems, the rpm will still only try to delete the "thearmor" files in /home/nfs/csyinw.
 
  


Reply



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
LFS RPM SPEC files: Binutils RPM spec for x86 arch nocountryman Linux From Scratch 2 10-25-2010 09:09 AM
RPM Spec file creation, %files section question davidas Linux - Software 1 09-13-2007 02:26 AM
cannot use rpm -q in rpm spec file? Okashiiken Programming 5 06-29-2007 02:13 AM
RPM Spec file creation: %file section question davidas Linux - Newbie 0 03-16-2004 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:51 PM.

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