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 06-16-2008, 05:09 AM   #1
hans21
Member
 
Registered: Sep 2005
Location: Serbia
Distribution: Centos 5.2-x86_64, Fedora 10, RHEL 5
Posts: 60

Rep: Reputation: 15
Lynis rpmbuild


Hi folks,

I've been trying to build an rpm from lynis-1.1.5.tar.gz... I acquired a lynis.spec file, changed the version number in the file, copied lynis-1.1.5.tar.gz to /usr/src/redhat/SOURCES just as suggested in the manual and ran:

rpmbuild -ba lynis.spec

but the feedback I get is as follows:

# rpmbuild -ba lynis.spec >> lynis-rpmbuild.log
+ umask 022
+ cd /usr/src/redhat/BUILD
+ '[' /tmp/lynis-root '!=' / ']'
+ rm -rf /tmp/lynis-root
+ mkdir /tmp/lynis-root
+ cd /usr/src/redhat/BUILD
+ rm -rf lynis
+ /bin/gzip -dc /usr/src/redhat/SOURCES/lynis-1.1.5.tar.gz
+ tar -xvvf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd lynis
/var/tmp/rpm-tmp.68409: line 33: cd: lynis: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.68409 (%prep)
Bad exit status from /var/tmp/rpm-tmp.68409 (%prep)
[root@valhalla Desktop]# rm lynis-rpmbuild.log
rm: remove regular file `lynis-rpmbuild.log'? y
[root@valhalla Desktop]# rpmbuild -ba lynis.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.22926
+ umask 022
+ cd /usr/src/redhat/BUILD
+ '[' /tmp/lynis-root '!=' / ']'
+ rm -rf /tmp/lynis-root
+ mkdir /tmp/lynis-root
+ cd /usr/src/redhat/BUILD
+ rm -rf lynis
+ /bin/gzip -dc /usr/src/redhat/SOURCES/lynis-1.1.5.tar.gz
+ tar -xvvf -
-rw-r----- root/wheel 14168 2008-06-10 18:40:57 lynis-1.1.5/CHANGELOG
-rw-r----- root/wheel 3268 2008-06-10 17:41:39 lynis-1.1.5/FAQ
-rw-r----- root/wheel 1383 2008-06-10 17:39:16 lynis-1.1.5/INSTALL
-rw-r----- root/wheel 35147 2007-07-02 01:00:03 lynis-1.1.5/LICENSE
-rw-r----- root/wheel 11387 2008-06-10 17:41:09 lynis-1.1.5/README
-rw-r----- root/wheel 2511 2008-06-10 17:39:09 lynis-1.1.5/TODO
drwxr-x--- root/wheel 0 2008-01-28 21:35:05 lynis-1.1.5/contrib
drwxr-x--- root/wheel 0 2008-05-31 13:23:25 lynis-1.1.5/db
-rw-r--r-- root/wheel 19 2008-05-30 22:10:09 lynis-1.1.5/db/malware.db
-rw-r--r-- root/wheel 29 2008-05-28 21:53:43 lynis-1.1.5/db/sbl.db
-rw-r--r-- root/wheel 460 2008-05-31 13:23:24 lynis-1.1.5/db/fileperms.db
-rw-r----- root/wheel 4227 2008-06-10 17:41:27 lynis-1.1.5/default.prf
drwxr-x--- root/wheel 1 2008-04-15 20:28:59 lynis-1.1.5/dev
-rwxr-x--- root/wheel 3641 2008-04-15 21:22:12 lynis-1.1.5/dev/build-lynis.sh
drwxr-xr-x root/wheel 0 2008-04-15 20:59:40 lynis-1.1.5/dev/openbsd
-rw-r--r-- root/wheel 1971 2008-04-15 21:24:32 lynis-1.1.5/dev/files.dat
-rw-r----- root/wheel 2041 2008-04-15 20:59:40 lynis-1.1.5/dev/openbsd/+CONTENTS
drwxr-x--- root/wheel 0 2008-06-10 19:08:43 lynis-1.1.5/include
-rw-r----- root/wheel 9950 2008-06-10 18:40:25 lynis-1.1.5/include/functions
-rw-r----- root/wheel 4893 2008-06-09 23:14:29 lynis-1.1.5/include/osdetection
-rw-r----- root/wheel 3266 2008-06-10 18:29:29 lynis-1.1.5/include/consts
-rw-r----- root/wheel 2467 2008-05-31 13:16:36 lynis-1.1.5/include/parameters
-rw-r----- root/wheel 4487 2008-06-10 18:58:33 lynis-1.1.5/include/profiles
-rw-r----- root/wheel 14328 2008-06-09 21:31:31 lynis-1.1.5/include/tests_ports_packages
-rw-r----- root/wheel 3302 2008-05-31 16:22:21 lynis-1.1.5/include/tests_php
-rw-r----- root/wheel 10314 2008-06-10 17:48:49 lynis-1.1.5/include/tests_boot_services
-rw-r----- root/wheel 10245 2008-05-30 20:53:33 lynis-1.1.5/include/tests_filesystems
-rw-r----- root/wheel 10296 2008-06-10 19:07:45 lynis-1.1.5/include/tests_networking
-rw-r----- root/wheel 2874 2008-05-30 22:29:35 lynis-1.1.5/include/tests_memory_processes
-rw-r----- root/wheel 10216 2008-06-09 21:58:58 lynis-1.1.5/include/tests_kernel
-rw-r----- root/wheel 3909 2008-06-09 21:55:20 lynis-1.1.5/include/tests_logging
-rw-r----- root/wheel 10619 2008-06-10 18:03:12 lynis-1.1.5/include/tests_authentication
-rw-r----- root/wheel 4535 2008-06-09 23:04:56 lynis-1.1.5/include/tests_firewalls
-rw-r----- root/wheel 3382 2008-06-10 19:08:43 lynis-1.1.5/include/tests_homedirs
-rw-r----- root/wheel 3446 2008-06-10 19:00:38 lynis-1.1.5/include/tests_shells
-rw-r----- root/wheel 2619 2008-05-20 20:00:20 lynis-1.1.5/include/tests_printers_spools
-rw-r----- root/wheel 1557 2008-05-31 16:23:13 lynis-1.1.5/include/tests_file_integrity
-rw-r----- root/wheel 2576 2008-06-10 18:28:30 lynis-1.1.5/include/tests_accounting
-rw-r----- root/wheel 3725 2008-05-27 19:22:03 lynis-1.1.5/include/tests_banners
-rw-r----- root/wheel 3509 2008-05-19 22:41:40 lynis-1.1.5/include/tests_mail_messaging
-rw-r----- root/wheel 2819 2008-05-18 13:29:38 lynis-1.1.5/include/tests_file_permissions
-rw-r----- root/wheel 1065 2008-05-18 13:22:14 lynis-1.1.5/include/tests_nameserver
-rw-r----- root/wheel 2563 2008-05-26 22:21:09 lynis-1.1.5/include/tests_ldap
-rw-r----- root/wheel 1594 2008-05-20 20:13:39 lynis-1.1.5/include/tests_crypto
-rw-r----- root/wheel 9418 2008-06-03 22:15:49 lynis-1.1.5/include/tests_webservers
-rw-r----- root/wheel 2315 2008-05-19 22:39:55 lynis-1.1.5/include/tests_malware
-rw-r----- root/wheel 1333 2008-05-30 21:01:31 lynis-1.1.5/include/tests_storage
-rw-r----- root/wheel 2094 2008-06-08 20:20:09 lynis-1.1.5/include/tests_databases
-rwxr-x--- root/wheel 25843 2008-06-10 17:31:48 lynis-1.1.5/lynis
-rw-r----- root/wheel 2337 2008-06-10 17:41:21 lynis-1.1.5/lynis.8
drwxr-x--- root/wheel 0 2008-05-06 20:54:22 lynis-1.1.5/plugins
-rw-r----- root/wheel 48 2008-05-06 19:57:53 lynis-1.1.5/plugins/security_webvuln
-rw-r----- root/wheel 37 2008-05-06 19:58:18 lynis-1.1.5/plugins/security_rootkit
-rw-r----- root/wheel 294 2008-05-06 20:54:20 lynis-1.1.5/plugins/README
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd lynis
/var/tmp/rpm-tmp.22926: line 33: cd: lynis: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.22926 (%prep)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.22926 (%prep)


Now, I seem to remember I've even tried another way of building an RPM with rpmbuild -ta .... something like that, according to manual and it didn't work.

Any suggestions?
 
Old 06-16-2008, 05:35 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hans21 View Post
I acquired a lynis.spec file
From where? Official site or elsewhere?


Quote:
Originally Posted by hans21 View Post
copied lynis-1.1.5.tar.gz to /usr/src/redhat/SOURCES
Please don't build packages as root: there is no need for that and it reduces risks. If you need directions for building packages as unprivileged user see for instance here http://www.linuxquestions.org/questi...c-file-648210/ (few posts down) or http://www-106.ibm.com/developerworks/library/l-rpm2/ or the "Maximum RPM" site.


Quote:
Originally Posted by hans21 View Post
/var/tmp/rpm-tmp.68409: line 33: cd: lynis: No such file or directory
%setup should work in the directory "$RPM_BUILD_ROOT/lynis-1.1.5" (since that's the root of the tarball). An error in the spec (post it?).


Quote:
Originally Posted by hans21 View Post
Now, I seem to remember I've even tried another way of building an RPM with rpmbuild -ta .... something like that, according to manual and it didn't work.
Please don't say "didn't work" but provide commandline and (error) output instead.
 
Old 06-16-2008, 05:44 AM   #3
hans21
Member
 
Registered: Sep 2005
Location: Serbia
Distribution: Centos 5.2-x86_64, Fedora 10, RHEL 5
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
From where? Official site or elsewhere?
Official site, of course.


Quote:
Please don't build packages as root: there is no need for that and it reduces risks. If you need directions for building packages as unprivileged user see for instance here http://www.linuxquestions.org/questi...c-file-648210/ (few posts down) or http://www-106.ibm.com/developerworks/library/l-rpm2/ or the "Maximum RPM" site.
Thanks for the tip... since I've installed and updated all the software so far using yum, I very rarely came across the need to build an .rpm

Quote:
%setup should work in the directory "$RPM_BUILD_ROOT/lynis-1.1.5" (since that's the root of the tarball). An error in the spec (post it?).
The .spec file content:

##################################################################
#
# Lynis spec file
#
# Usage:
# - Adjust version number (Version
# - rpmbuild -ba lynis.spec
#
##################################################################

%define _includedir /usr/share/lynis/include
%define _pluginsdir /usr/share/lynis/plugins
%define _dbdir /usr/share/lynis/db
%define _bindir /usr/bin

Summary: Security and system auditing tool.
Name: lynis
Version: 1.1.5
Release: 1
License: GPL
Group: Applications/System
Source: lynis-%{version}.tar.gz
BuildRoot: /tmp/lynis-root
URL: http://www.rootkit.nl/
Vendor: Michael Boelen
Packager: Michael Boelen <michael@rootkit.nl>
BuildArch: noarch

%description
Lynis is a security and system auditing tool. It scans a system on the
most interesting parts useful for audits, like:
- Security enhancements
- Logging and auditing options
- Banner identification
- Software availability

Lynis is released as a GPL licensed project and free for everyone to use.

See http://www.rootkit.nl for a full description and documentation.

%prep
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
mkdir $RPM_BUILD_ROOT

# Make directory with our name, instead of with version
%setup -n lynis

#%patch

%build

%install
# Install profile
install -d ${RPM_BUILD_ROOT}/etc/lynis
install default.prf ${RPM_BUILD_ROOT}/etc/lynis
# Install binary
install -d ${RPM_BUILD_ROOT}/%{_bindir}
install lynis ${RPM_BUILD_ROOT}/%{_bindir}
# Install man page
install -d ${RPM_BUILD_ROOT}/%{_mandir}/man8
install lynis.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8
# Install functions/includes
install -d ${RPM_BUILD_ROOT}%{_includedir}
install include/* ${RPM_BUILD_ROOT}%{_includedir}
# Install plugins
install -d ${RPM_BUILD_ROOT}%{_pluginsdir}
install plugins/* ${RPM_BUILD_ROOT}%{_pluginsdir}
# Install database files
install -d ${RPM_BUILD_ROOT}%{_dbdir}
install db/* ${RPM_BUILD_ROOT}%{_dbdir}


# Patch default paths (not required for 1.1.2+)
#sed -i -e 's#INCLUDEDIR="include"#INCLUDEDIR="%{_includedir}"#g' ${RPM_BUILD_ROOT}/usr/bin/lynis
#sed -i -e 's#PROFILE="default.prf"#PROFILE="/etc/lynis/default.prf"#g' ${RPM_BUILD_ROOT}/usr/bin/lynis

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
# Binaries
%{_bindir}/lynis
# Man page and docs
%doc CHANGELOG FAQ LICENSE README TODO
%doc %{_mandir}/man8/lynis.8.gz
# Default profile
/etc/lynis/default.prf
# Databases, functions, plugins
%{_db}/*
%{_includedir}/*
%{_pluginsdir}/*


%changelog
* Sat May 31 2008 Michael Boelen - 1.1.4-1
- Added _dbdir

* Sun May 11 2008 Michael Boelen - 1.1.2-1
- Added _pluginsdir, disabled patches

* Sat Mar 08 2008 Michael Boelen - 1.0.8-1
- initial .spec file



Quote:
Please don't say "didn't work" but provide commandline and (error) output instead.
Sorry about this... It's been a while since I've tried this, not just before posting a problem here. I figured, I'll send the output if the first way of building a package doesn't work eventually.
 
Old 06-16-2008, 07:04 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hans21 View Post
Code:
%define _dbdir	        /usr/share/lynis/db
# ...
%{_db}/*
So this defined the database directory alright but the macro isn't used correctly in the %files section: just change the "_db" to read "_dbdir".
 
Old 06-16-2008, 07:28 AM   #5
hans21
Member
 
Registered: Sep 2005
Location: Serbia
Distribution: Centos 5.2-x86_64, Fedora 10, RHEL 5
Posts: 60

Original Poster
Rep: Reputation: 15
I'm afraid I'm still getting the same output as before, regardless of changing what you suggested:

In the %files section

%{_db}/* ---> %{_dbdir}/*

or did I misunderstood your post?
 
Old 06-16-2008, 07:47 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hans21 View Post
I'm afraid I'm still getting the same output as before
ROTFL. I forgot the %setup part. Here's the diff:

Code:
 --- lynis.orig.spec     2008-06-08 00:00:01.000000000 +0000
+++ lynis.spec     2008-06-08 00:00:02.000000000 +0000
@@ -43,7 +43,7 @@
 mkdir $RPM_BUILD_ROOT
 
 # Make directory with our name, instead of with version
-%setup -n lynis
+%setup
 
 #%patch
 
@@ -87,7 +87,7 @@
 # Default profile
 /etc/lynis/default.prf
 # Databases, functions, plugins
-%{_db}/*
+%{_dbdir}/*
 %{_includedir}/*
 %{_pluginsdir}/*

Last edited by unSpawn; 06-16-2008 at 07:49 AM.
 
Old 06-16-2008, 07:58 AM   #7
hans21
Member
 
Registered: Sep 2005
Location: Serbia
Distribution: Centos 5.2-x86_64, Fedora 10, RHEL 5
Posts: 60

Original Poster
Rep: Reputation: 15
Thank you very much... you've been very helpfull.
 
Old 06-16-2008, 08:09 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
NP, you're welcome. Maybe share the diff with the author?
 
Old 06-16-2008, 08:11 AM   #9
hans21
Member
 
Registered: Sep 2005
Location: Serbia
Distribution: Centos 5.2-x86_64, Fedora 10, RHEL 5
Posts: 60

Original Poster
Rep: Reputation: 15
Yes, of course...
 
  


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
LXer: Lynis - Security and system auditing tool LXer Syndicated Linux News 0 03-04-2008 02:20 PM
I don't have the rpmbuild combilli Linux - Software 1 02-13-2007 09:26 PM
rpmbuild ?? mickeyboa Fedora 1 07-25-2004 10:09 PM
rpmbuild linuxdev Linux - Newbie 1 02-18-2004 03:13 PM
rpmbuild linuxdev Linux - General 1 02-18-2004 03:12 PM

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

All times are GMT -5. The time now is 06:55 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