diff --git a/environment-modules.spec b/environment-modules.spec index d9b81bd..ad630f7 100644 --- a/environment-modules.spec +++ b/environment-modules.spec @@ -1,6 +1,8 @@ +%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) + Name: environment-modules Version: 3.2.10 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Provides dynamic modification of a user's environment Group: System Environment/Base @@ -10,6 +12,7 @@ Source0: http://downloads.sourceforge.net/modules/modules-%{version}.tar. Source1: modules.sh Source2: createmodule.sh Source3: createmodule.py +Source4: macros.%{name} Patch0: environment-modules-3.2.7-bindir.patch # Comment out stray module use in modules file when not using versioning # https://bugzilla.redhat.com/show_bug.cgi?id=895555 @@ -29,6 +32,9 @@ BuildRequires: dejagnu BuildRequires: man #For ps in startup script Requires: procps +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +Provides: environment(modules) %description The Environment Modules package provides for the dynamic modification of @@ -69,7 +75,7 @@ have access to the module alias. --prefix=%{_datadir} \ --exec-prefix=%{_datadir}/Modules \ --with-man-path=$(manpath) \ - --with-module-path=%{_sysconfdir}/modulefiles + --with-module-path=%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles # --with-debug=42 --with-log-facility-debug=stderr make %{?_smp_mflags} @@ -77,20 +83,36 @@ make %{?_smp_mflags} %install make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d -cp -p %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/modules.sh +touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh} +cp -p %SOURCE1 $RPM_BUILD_ROOT%{_datadir}/Modules/init/modules.sh cp -p %SOURCE2 %SOURCE3 $RPM_BUILD_ROOT%{_datadir}/Modules/bin -ln -s %{_datadir}/Modules/init/csh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/modules.csh -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles \ + $RPM_BUILD_ROOT%{_datadir}/modulefiles +# Install the rpm config file +install -Dpm 644 %{SOURCE4} %{buildroot}/%{macrosdir}/macros.%{name} %check make test +%post +# Cleanup from pre-alternatives +[ ! -L %{_bindir}/modules.sh ] && rm -f %{_sysconfdir}/profile.d/modules.sh +%{_sbindir}/update-alternatives --install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/Modules/init/modules.sh 40 \ + --slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/Modules/init/csh + +%postun +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove modules.sh %{_datadir}/Modules/init/modules.sh +fi + + %files %doc LICENSE.GPL README TODO %{_sysconfdir}/modulefiles -%config(noreplace) %{_sysconfdir}/profile.d/* +%ghost %{_sysconfdir}/profile.d/modules.csh +%ghost %{_sysconfdir}/profile.d/modules.sh %{_bindir}/modulecmd %dir %{_datadir}/Modules %{_datadir}/Modules/bin/ @@ -98,11 +120,18 @@ make test %config(noreplace) %{_datadir}/Modules/init/* %config(noreplace) %{_datadir}/Modules/init/.modulespath %{_datadir}/Modules/modulefiles +%{_datadir}/modulefiles %{_mandir}/man1/module.1.gz %{_mandir}/man4/modulefile.4.gz +%{macrosdir}/macros.%{name} %changelog +* Mon Apr 14 2014 Orion Poplawski - 3.2.10-9 +- Use alternatives for /etc/profile.d/modules.{csh,sh} +- Add /usr/share/modulefiles to MODULEPATH +- Add rpm macro to define %%_modulesdir + * Mon Dec 23 2013 Orion Poplawski - 3.2.10-8 - Fix -Werror=format-security (bug #1037053) diff --git a/macros.environment-modules b/macros.environment-modules new file mode 100644 index 0000000..e3592a8 --- /dev/null +++ b/macros.environment-modules @@ -0,0 +1,3 @@ +# RPM macros for environment modules + +%_modulesdir %{_datadir}/modulefiles