I am trying to build an RPM but when I use this command to build it:
[root@vmdb SPEC]# rpmbuild -v -bb SPEC/supportScripts.spec
I always get this error:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.gG9C7Y
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf supportScripts-1
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/supportScripts-1.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd supportScripts-1
/var/tmp/rpm-tmp.gG9C7Y: line 34: cd: supportScripts-1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep)
I have looked on the internet as to why this error might occur and it is due to a bad argument with the macro I am using in %prep/%setup. I am not sure what I need in replacement to fix it and it is getting frustrating. This is what my spec file looks like:
Name: supportScripts
Version: 1
Release: 1
Summary: All the support scripts bundled into an RPM.
BuildArch: noarch
Group: Development/Tools
License: GPL
URL: http://localhost
Source0: supportScripts-1.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
These are all the support tools we need for new Hardware Agent builds. This will package all the scripts support uses for new builds.
%prep
%setup -q
%install
mkdir -p "$RPM_BUILD_ROOT/opt"
cp -R * "$RPM_BUILD_ROOT/opt"
%files
/opt/
%clean
rm -rf $RPM_BUILD_ROOT
%post
chown -R support:support /opt/*
chmod -R 775 /opt/
UPDATE: What is weird is that I have found the rpm completely built in /root/rpmbuild/RPMS/noarch
. I have ran command:
rpm -ivh supportScripts-1-1.noarch.rpm
to unpack all the scripts, and miraculously its there! My next question is: Should I be concerned of any mishaps with the rpmbuild command I have done?