From 72b576b7ad00a72033e9d871887b65c69cb44884 Mon Sep 17 00:00:00 2001 From: "haakon.soehoel" Date: Tue, 12 Nov 2024 12:58:06 +0100 Subject: [PATCH] Warn user if sourcing other tags than deprecated-rhel7 on RHEL7 from csh --- komodo/data/activator_switch.csh.tmpl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/komodo/data/activator_switch.csh.tmpl b/komodo/data/activator_switch.csh.tmpl index bfceb582..1bb6c646 100644 --- a/komodo/data/activator_switch.csh.tmpl +++ b/komodo/data/activator_switch.csh.tmpl @@ -1,13 +1,19 @@ {% if py_version == "py38" -%} if ( `uname -r` =~ *el7* ) then - setenv KOMODO_ROOT {{ prefix }} - set KOMODO_RELEASE_REAL = "{{ release }}" + # Get the last command executed wich contains the full path of the sourced script + set lastCommandExecuted = ($_) + if ( "$lastCommandExecuted" =~ "*deprecated-rhel7*" ) then + setenv KOMODO_ROOT {{ prefix }} + set KOMODO_RELEASE_REAL = "{{ release }}" - source $KOMODO_ROOT/$KOMODO_RELEASE_REAL-rhel7/enable.csh - if ( $?_KOMODO_OLD_PROMPT ) then - set prompt = "[$KOMODO_RELEASE_REAL] $_KOMODO_OLD_PROMPT" + source $KOMODO_ROOT/$KOMODO_RELEASE_REAL-rhel7/enable.csh + if ( $?_KOMODO_OLD_PROMPT ) then + set prompt = "[$KOMODO_RELEASE_REAL] $_KOMODO_OLD_PROMPT" + endif + setenv KOMODO_RELEASE $KOMODO_RELEASE_REAL + else + echo -e "{{ migration_warning }}" endif - setenv KOMODO_RELEASE $KOMODO_RELEASE_REAL else if ( `uname -r` =~ *el8* ) then setenv KOMODO_ROOT {{ prefix }} set KOMODO_RELEASE_REAL = "{{ release }}"