Skip to content

Commit

Permalink
install: adapt RPM spec to install fish config snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
xdelaruelle committed May 29, 2023
1 parent 899881b commit ce78d5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Modules 5.X.Y (not yet released)
* Install: distribute ``ChangeLog`` as a zipped file to reduce installation
size. As a consequence, :command:`gzip` becomes a requirement when building
Modules from git repository.
* Install: adapt RPM spec file to install module initialization script for
fish as configuration snippet for this shell.


.. _5.3 release notes:
Expand Down
12 changes: 12 additions & 0 deletions contrib/rpm/environment-modules.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,20 @@ make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/modulefiles
mkdir -p %{buildroot}%{_datadir}/modulefiles
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
mkdir -p %{buildroot}%{_datadir}/fish/vendor_conf.d
mkdir -p %{buildroot}%{_bindir}
%if 0%{?fedora}
# setup for alternatives
touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh}
touch %{buildroot}%{_datadir}/fish/vendor_conf.d/modules.fish
touch %{buildroot}%{_bindir}/modulecmd
# remove modulecmd wrapper as it will be handled by alternatives
rm -f %{buildroot}%{_datadir}/Modules/bin/modulecmd
%else
# install profile links
ln -s %{_datadir}/Modules/init/profile.csh %{buildroot}%{_sysconfdir}/profile.d/modules.csh
ln -s %{_datadir}/Modules/init/profile.sh %{buildroot}%{_sysconfdir}/profile.d/modules.sh
ln -s %{_datadir}/Modules/init/fish %{buildroot}%{_datadir}/fish/vendor_conf.d/modules.fish
# install modulecmd wrapper script
mv %{buildroot}%{_datadir}/Modules/bin/modulecmd %{buildroot}%{_bindir}/
%endif
Expand All @@ -156,6 +159,7 @@ make test QUICKTEST=1
# Cleanup from pre-alternatives
[ ! -L %{_sysconfdir}/profile.d/modules.sh ] && rm -f %{_sysconfdir}/profile.d/modules.sh
[ ! -L %{_sysconfdir}/profile.d/modules.csh ] && rm -f %{_sysconfdir}/profile.d/modules.csh
[ ! -L %{_datadir}/fish/vendor_conf.d/modules.fish ] && rm -f %{_datadir}/fish/vendor_conf.d/modules.fish
[ ! -L %{_bindir}/modulecmd ] && rm -f %{_bindir}/modulecmd

# Migration from version 3.x to 4
Expand All @@ -166,6 +170,7 @@ fi
%{_sbindir}/update-alternatives \
--install %{_sysconfdir}/profile.d/modules.sh modules.sh %{_datadir}/Modules/init/profile.sh 40 \
--slave %{_sysconfdir}/profile.d/modules.csh modules.csh %{_datadir}/Modules/init/profile.csh \
--slave %{_datadir}/fish/vendor_conf.d/modules.fish modules.fish %{_datadir}/Modules/init/fish \
--slave %{_bindir}/modulecmd modulecmd %{_datadir}/Modules/libexec/modulecmd.tcl

%postun
Expand All @@ -183,13 +188,16 @@ fi
%endif
%doc ChangeLog.gz README NEWS.txt MIGRATING.txt INSTALL.txt CONTRIBUTING.txt changes.txt
%{_sysconfdir}/modulefiles
%dir %{_datadir}/fish/vendor_conf.d
%if 0%{?fedora}
%ghost %{_sysconfdir}/profile.d/modules.csh
%ghost %{_sysconfdir}/profile.d/modules.sh
%ghost %{_datadir}/fish/vendor_conf.d/modules.fish
%ghost %{_bindir}/modulecmd
%else
%{_sysconfdir}/profile.d/modules.csh
%{_sysconfdir}/profile.d/modules.sh
%{_datadir}/fish/vendor_conf.d/modules.fish
%{_bindir}/modulecmd
%endif
%{_bindir}/envml
Expand Down Expand Up @@ -227,6 +235,10 @@ fi


%changelog
* Sat May 27 2023 Xavier Delaruelle <xavier.delaruelle@cea.fr> - 5.3.0-2
- Install module initialization script for fish as configuration snippet for
this shell via alternatives

* Sun May 14 2023 Xavier Delaruelle <xavier.delaruelle@cea.fr> - 5.3.0-1
- Update to 5.3.0
- Migrate to SPDX license format
Expand Down

0 comments on commit ce78d5d

Please sign in to comment.