packaging - Cannot change permissions when running rpmbuild -


currently i'm trying change spec file extracted nagios rpm package create own spec file. when trying build rpm i'm getting following error:

make[1]: entering directory /home/mockbuild/rpmbuild/build/nagios-1/base' make install-basic make[2]: entering directory /home/mockbuild/rpmbuild/build/nagios-1/base' /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/sbin /usr/bin/install: cannot change permissions of /usr/sbin': operation not permitted make[2]: **** [install-basic] error 1 make[2]: leaving directory /home/mockbuild/rpmbuild/build/nagios-1/base' make[1]: [install] error 2 make[1]: leaving directory `/home/mockbuild/rpmbuild/build/nagios-1/base' make: * [install] error 2 error: bad exit status /var/tmp/rpm-tmp.47987 (%install)

this spec file

name: nagios version: 1 release: 1 summary: host/service/network monitoring program  group: applications/system license: gplv2 url: http://www.nagios.org/ source0: http://downloads.sourceforge.net/nagios/%{name}-%{version}.tar.gz #source1: nagios.logrotate #source2: nagios.htaccess #source3: nagios.internet.cfg #source4: nagios.htpasswd #source5: nagios.upgrade_to_v3.readme #source6: nagios.upgrade_to_v3.sh # png files old nagios-0010-added-several-images-to-the-sample-config.patch   #patch1: nagios-0001-from-rpm.patch #patch2: nagios-0002-selinux-relabeling.patch # sent upstream #patch3: nagios-0003-fix-etc-init.d-nagios-status.patch # sent upstream #patch4: nagios-0004-fix-installation-of-httpd-conf.d-config-file.patch #patch5: nagios-0005-install-config-files-too.patch #patch6: nagios-0006-do-not-start-service-by-default.patch # sent upstream #patch7: nagios-0007-the-init-script-should-return-2-in-case-of-unknown-c.patch #patch8: nagios-0008-fix-path-to-cgi-executables.patch #patch9: nagios-0009-fixed-path-to-passwd-file-in-apache-s-config-file.patch #patch10: nagios-0010-added-several-images-to-the-sample-config-revb.patch #patch11: nagios-0011-fixed-strange-permissions.patch #patch12: nagios-3.4.3-httpd-2.4-and-2.2.patch #patch13: nagios-3.4.3-spaces-to-plus-signs.patch #patch14: nagios-3.5.0-conf.d-configuration-directory.patch  buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)  buildrequires: gd-devel > 1.8, mailx, libjpeg-devel, libpng-devel buildrequires: perl(cpan) buildrequires: perl(extutils::makemaker) buildrequires: perl(extutils::embed) buildrequires: perl(test::harness) %if 0%{?el6}%{?fedora} buildrequires: perl(test::html::lint) %endif buildrequires: perl(test::more) buildrequires: perl(test::simple)   requires: httpd requires: php requires: perl(:module_compat_%(eval "`%{__perl} -v:version`"; echo $version)) requires: mailx requires(preun): initscripts, chkconfig requires(post): initscripts, chkconfig requires(postun): initscripts  requires: nagios-common requires: user(nagios) requires(pre): user(nagios) requires: group(nagios) requires(pre): group(nagios)   summary: nagios monitors hosts , services , yells if somethings breaks summary(de): nagios überwacht dienste und rechner und meldet ihnen ausfälle  %description nagios program monitor hosts , services on network.  has ability send email or page alerts when problem arises , when problem resolved.  nagios written in c , designed run under linux (and other *nix variants) background process, intermittently running checks on various services specify.  actual service checks performed separate "plugin" programs return status of checks nagios. plugins available @ http://sourceforge.net/projects/nagiosplug.  package provides core program, web interface, , documentation files nagios. development files built separate package.  %description -l (de) nagios ist ein programm zum Überwachen von rechner und diensten in ihrem netzwerk. wenn etwas ausfällt, kann es sie per email oder pager benachrichtigen. nagios ist in c geschrieben und sollte auf allen unix-varianten (inklusive linux :-) laufen. es läuft als dämon und überwacht laufend alle konfigurierten dienste.  nagios überprüft die rechner und dienste nicht selber, sondern braucht dafür externe programme. viele dieser programme finden sie im paket nagios-plugins.  %package common group: applications/system summary: provides common directories, uid , gid among nagios-related packages requires(pre): shadow-utils requires(post): shadow-utils provides: user(nagios) provides: group(nagios)   %description common provides common directories, uid , gid among nagios-related packages.   %package devel group: applications/system summary: provides include files nagios-related applications may compile against requires: %{name} = %{version}-%{release}   %description devel nagios program monitor hosts , services on network. has ability email or page when problem arises , when problem resolved. nagios written in c , designed run under linux (and other *nix variants) background process, intermittently running checks on various services specify.  package provides include files nagios-related applications may compile against.   %prep %setup -q -n %{name}-%{version}  #%patch1 -p1 -b .fedora #%patch2 -p1 -b .selinux_relabel #%patch3 -p1 -b .fix_status_retcode #%patch4 -p1 -b .fix_httpd_conf_d #%patch5 -p1 -b .install_config #%patch6 -p1 -b .dont_start_by_default #%patch7 -p1 -b .return_2 #%patch8 -p1 -b .fix_path_to_cgi #%patch9 -p1 -b .fix_path_to_passwd #%patch10 -p1 -b .more_images #%patch11 -p1 -b .fix_perms #%patch12 -p1 -b .httpd_conf #%patch13 -p1 -b .plus_signs #%patch14 -p1 -b .conf_d  #install -p -m 0644 %{source10} %{source11} %{source12} html/images/logos/   %build %configure \     --prefix=%{_datadir}/%{name} \     --exec-prefix=%{_localstatedir}/lib/%{name} \     --with-init-dir=%{_initrddir} \     --with-cgiurl=/%{name}/cgi-bin/ \     --with-htmlurl=/%{name} \     --with-lockfile=%{_localstatedir}/run/%{name}.pid \     --libdir=%{_libdir}/%{name} \     --with-nagios-user=nagios \     --with-nagios-grp=nagios \     --bindir=%{_sbindir} \     --libexecdir=%{_libdir}/%{name}/plugins \     --sysconfdir=%{_sysconfdir}/%{name} \     --localstatedir=%{_localstatedir}/log/%{name} \     --datadir=%{_datadir}/%{name}/html \     --with-gd-lib=%{_libdir} \     --with-gd-inc=%{_includedir} \     --enable-embedded-perl \     --with-perlcache \     --with-template-objects \     --with-template-extinfo \     strip=/bin/true make %{?_smp_mflags}  #sed -i -e "s| package embed::persistent;|#\!%{_bindir}/perl\npackage embed::persistent;|" p1.pl sed -i -e "s|nagioscmd=/var/log/nagios/rw/nagios.cmd|nagioscmd=%{_localstatedir}/spool/%{name}/cmd/nagios.cmd|" daemon-init sed -i -e "s|resource.cfg|private/resource.cfg|" \      -e "s|command_file=/var/log/nagios/rw/nagios.cmd|command_file=%{_localstatedir}/spool/%{name}/cmd/nagios.cmd|" sample-config/nagios.cfg  #sed -e "s|/usr/lib/|%{_libdir}/|" %{source2} > %{name}.htaccess #cp -f %{source3} internet.cfg #cp -f %{source5} upgradetoversion3.readme #cp -f %{source6} upgradetoversion3.sh echo >> html/stylesheets/common.css   %install make install make install-init make install-config make install-commandmode make install-webconf make install-devel rm -rf %{buildroot} make destdir=%{buildroot} init_opts="" install_opts="" command_opts="" cgidir="%{_libdir}/%{name}/cgi-bin" cfgdir="%{_sysconfdir}/%{name}" fullinstall  # relocated sbin (fedora-specific) install -d -m 0755 %{buildroot}%{_bindir} mv %{buildroot}%{_sbindir}/nagiostats %{buildroot}%{_bindir}/nagiostats  install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/private mv %{buildroot}%{_sysconfdir}/%{name}/resource.cfg %{buildroot}%{_sysconfdir}/%{name}/private/resource.cfg  install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/conf.d/ install -d -m 0644 %{source0} %{buildroot}%{_sysconfdir}/%{name}/passwd  # install header-file install -d -m 0644 include/locations.h %{buildroot}%{_includedir}/%{name}/locations.h  # install logrotate rule install -d -m 0644 %{source0} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}  # make room event-handlers install -d -m 0755 %{buildroot}%{_libdir}/%{name}/plugins/eventhandlers  install -d -m 0775 %{buildroot}%{_localstatedir}/spool/%{name}/cmd   %clean rm -rf %{buildroot}   %pre common getent group nagios >/dev/null || groupadd -r nagios getent passwd nagios >/dev/null || useradd -r -g nagios -d %{_localstatedir}/spool/%{name} -s /sbin/nologin nagios exit 0   %preun if [ $1 = 0 ];     /sbin/service nagios stop > /dev/null 2>&1 || :     /sbin/chkconfig --del %{name} || : fi   %post %{_sbindir}/usermod -a -g %{name} apache || : /sbin/chkconfig --add %{name} || : /sbin/service httpd condrestart > /dev/null 2>&1 || :   %postun /sbin/service httpd condrestart > /dev/null 2>&1 || :   # missing buildrequires #%check #make test   %files %dir %{_libdir}/%{name}/plugins/eventhandlers %dir %{_libdir}/%{name}/cgi-bin %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/html %doc %{_datadir}/%{name}/html/docs %doc changelog installing license readme upgrading upgradetoversion3.readme upgradetoversion3.sh %doc internet.cfg %{_datadir}/%{name}/html/[^d]* %{_sbindir}/* %{_bindir}/* %{_libdir}/%{name}/cgi-bin/*cgi %{_initrddir}/nagios %config(noreplace) %{_sysconfdir}/httpd/conf.d/nagios.conf %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/%{name}/*cfg %config(noreplace) %{_sysconfdir}/%{name}/objects/*cfg %attr(0750,root,nagios) %dir %{_sysconfdir}/%{name}/private %attr(0750,root,nagios) %dir %{_sysconfdir}/%{name}/objects %attr(0750,root,nagios) %dir %{_sysconfdir}/%{name}/conf.d %attr(0640,root,nagios) %config(noreplace) %{_sysconfdir}/%{name}/private/resource.cfg %attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/passwd %attr(0640,root,apache) %config(noreplace) %{_datadir}/%{name}/html/config.inc.php %attr(2775,nagios,nagios) %dir %{_localstatedir}/spool/%{name}/cmd %attr(0750,nagios,nagios) %dir %{_localstatedir}/log/%{name} %attr(0750,nagios,nagios) %dir %{_localstatedir}/log/%{name}/archives %attr(0750,nagios,nagios) %dir %{_localstatedir}/log/%{name}/spool/ %attr(0750,nagios,nagios) %dir %{_localstatedir}/log/%{name}/spool/checkresults   %files common %dir %{_sysconfdir}/%{name} %dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/plugins %attr(0755,nagios,nagios) %dir %{_localstatedir}/spool/%{name}   %files devel %{_includedir}/%{name} 

i'm running rpmbuild -ba normal user (not root).

install-basic recipe in makefile trying change permissions of /usr/sbin/, while needs change permissions of {%buildroot}/usr/sbin/. i.e. {%buildroot} variable not getting passed there successfully.

this great example of why should build rpms non-root - if tried root account work screw existing /usr/sbin.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -