Skip to content

Commit

Permalink
rpm: explicit piddir,statedir,storedir in spec
Browse files Browse the repository at this point in the history
Define rpm variables and explicitly pass them to configure to
simplify an override to use /run instead of /var/run default.
  • Loading branch information
mtomaschewski committed Apr 17, 2014
1 parent 6590c39 commit 95a4266
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions wicked.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Requires: %{name}-service = %{version}
PreReq: %fillup_prereq %insserv_prereq
%endif
%endif
%define wicked_piddir %_localstatedir/run/%{name}
%define wicked_statedir %_localstatedir/run/%{name}
%define wicked_storedir %_localstatedir/lib/%{name}

%description
Wicked is a network configuration infrastructure incorporating a number
Expand Down Expand Up @@ -145,6 +148,9 @@ This package provides the wicked shared library.
test -x ./configure || autoreconf --force --install
export CFLAGS="$RPM_OPT_FLAGS"
%configure \
--with-piddir=%{wicked_piddir} \
--with-statedir=%{wicked_statedir}\
--with-storedir=%{wicked_storedir}\
--with-compat=suse \
%if %{with systemd}
--enable-systemd \
Expand All @@ -169,8 +175,13 @@ make install DESTDIR=${RPM_BUILD_ROOT}
%__ln_s %_sbindir/ifup ${RPM_BUILD_ROOT}/sbin/ifprobe
# remove libwicked.a and la
%__rm -f ${RPM_BUILD_ROOT}%_libdir/libwicked*.*a
# create ghost directory
%__mkdir_p -m 0750 ${RPM_BUILD_ROOT}%_localstatedir/run/wicked
# create reboot-persistent (leases) store directory
%__mkdir_p -m 0750 ${RPM_BUILD_ROOT}%{wicked_storedir}
# create restart-persistent ghost state directory
%__mkdir_p -m 0750 ${RPM_BUILD_ROOT}%{wicked_statedir}
%if "%wicked_statedir" != "%wicked_piddir"
%__mkdir_p -m 0750 ${RPM_BUILD_ROOT}%{wicked_piddir}
%endif
%if %{with systemd}
ln -sf %_sbindir/service ${RPM_BUILD_ROOT}%_sbindir/rcwicked
ln -sf %_sbindir/service ${RPM_BUILD_ROOT}%_sbindir/rcwickedd
Expand Down Expand Up @@ -250,7 +261,10 @@ fi
/sbin/ldconfig

%post
%__mkdir_p -m 0750 %_localstatedir/run/wicked
%__mkdir_p -m 0750 %{wicked_statedir}
%if "%wicked_statedir" != "%wicked_piddir"
%__mkdir_p -m 0750 %{wicked_piddir}
%endif

%files
%defattr (-,root,root)
Expand Down Expand Up @@ -297,7 +311,11 @@ fi
%_mandir/man8/ifdown.8*
%_mandir/man8/ifstatus.8*
%_mandir/man8/ifup.8*
%attr(0750,root,root) %dir %ghost %_localstatedir/run/wicked
%attr(0750,root,root) %dir %wicked_storedir
%attr(0750,root,root) %dir %ghost %wicked_statedir
%if "%wicked_statedir" != "%wicked_piddir"
%attr(0750,root,root) %dir %ghost %wicked_piddir
%endif

%if %{with systemd}

Expand Down

0 comments on commit 95a4266

Please sign in to comment.