Commit ef424233 authored by Spencer Bliven's avatar Spencer Bliven

Add warning in modulefile for admins

Loading anaconda as an admin on an Auristor system produces a
reminder not to install anything
parent 07246ad9
......@@ -60,8 +60,34 @@ switch [module-info mode] {
puts stdout "source \"$PREFIX/conda/etc/profile.d/\";\n"
# Activate base? No: anaconda should just provide the conda tool
# puts stdout "conda activate;\n"
#puts stdout "conda activate;\n"
# Safety check! Warn if an admin loads anaconda on an auristor system
catch {
# Check if we're running auristor
set afsversion [exec fs --version]
if [regexp -nocase {^auristor} $afsversion] {
# Admin groups for this module (regex format)
set admins {sys.modules:administrators|sys.modules:psi_python}
# Determine current user. Prefer klist, but fall back to $USER
catch {
exec klist 2>/dev/null | sed -E -n {s/.*principal: ([^@]+)(@.*)?$/\1/p};
} principal option
if { [dict get $option -code] != 0} {
set principal $::env(USER)
# Determine whether the user belongs to one of the admin groups
if [regexp $admins [exec pts mem $principal]] {
puts stderr "WARNING: You have loaded the anaconda module on an Auristor system. Do not install packages!"
"unload" -
"remove" {
# Only run this if conda is in the PATH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment