diff --git a/Makefile b/Makefile index 2f2eadd2..297bf2ce 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ FL_PREFIX ?= /usr/local export FL_PREFIX +.PHONY: everything install libbuild libinstall pdlMakefile pdlbuild pdltest pdlinstall clean realclean uninstall condaflux condainstall condacompile condatest condaenv condauninstall + everything: libbuild install install: libinstall pdlbuild pdltest pdlinstall @@ -45,6 +47,23 @@ realclean: clean uninstall: @echo "\nUninstalling FLUX..."; - @-rm -rf $(FL_PREFIX)/lib/libflux.a || true; - @-rm -rf $(FL_PREFIX)/include/flux || true; + @rm -rf $(FL_PREFIX)/lib/libflux.a + @rm -rf $(FL_PREFIX)/include/flux @echo "\tFlux uninstall complete.\n"; + +# ------------ CONDA INSTALLATION ------------ # + +condaflux: condainstall + +condainstall: condauninstall condaenv condacompile + +condacompile: everything condaenv condatest + +condatest: + @/bin/sh -c 'cd lib; source test_condaFlux.sh'; + +condaenv: + @/bin/sh -c 'cd lib; source set_condaFlux_paths.sh'; + +condauninstall: uninstall realclean + @/bin/sh -c 'cd lib; source uninstall_condaflux.sh' diff --git a/doc/install-linux.md b/doc/install-linux.md index f49cf0cb..2d3a6899 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -1,63 +1,116 @@ -# Linux Installation +# Linux Installation Instructions -To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. +These instructions were created by installing FLUX on two different linux servers running AlmaLinux. Please let us know if anything breaks! Extra troubleshooting steps are listed at the bottom. -Here we'll outline steps for installing on a Linux system - notably tested on an Ubuntu system. The broad steps can be applied for other flavors of Linux. +## 1. Get Conda Environment Manager -## Perl installation +```sh +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +bash Miniconda3-latest-Linux-x86_64.sh +``` + +Follow the prompts: +- Hold down the arrow key and then accept terms. +- Accept Conda activation at startup. +- Exit and reconnect to the SSH session/ shell session. + +## 2. Create Conda Environment and Get Dependencies -First, use apt-get to install cpanminus, an easier tool to use for installing perl packages. -```shell -sudo apt-get install cpanminus +```sh +conda create -n fluxenv +conda activate fluxenv +conda install -c conda-forge gcc gxx binutils c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite ``` -Install PDL using cpanminus, forcing to bypass any dependency warnings. -```shell -sudo cpanm --force PDL +Confirm installation by typing `y` when prompted. + +## 3. Install the Perl Data Language (PDL) and Dependencies + +```sh +cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib ``` -If problems are encountered with that PDL installation route, one can install an older version of PDL using apt-get. This may run into code compilation issues down the road. -```shell -sudo apt-get install pdl +If the system struggles with `File::Map`, try: + +```sh +export LDFLAGS="" +export CFLAGS="-O2" +export PERL_LDFLAGS="" +export PERL_CFLAGS="-O2" +export LD=x86_64-conda-linux-gnu-gcc +export CC=x86_64-conda-linux-gnu-gcc ``` -Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. -```shell -push(@INC, "/usr/local/lib/aarch64-linux-gnu/perl/5.38.2"); +If `Inline::C` isn't found, run: -require('PDL/default.perldlrc'); +```sh +cpanm Inline::C +``` -use PDL::AutoLoader; -$PDL::AutoLoader::Rescan=1; +## 4. Get FLUX -1; +Clone and install Flux: +```sh +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd +make condaflux ``` +## 5. Get Fluxpype Wrapper (To run FLUX with) -A few other packages of note will be needed for the later fluxon-mhd install. -```shell -sudo cpanm File::ShareDir -sudo cpanm Math::RungeKutta -sudo cpanm Term::ReadKey +```sh +cd .. +git clone https://github.com/GillySpace27/fluxpype.git +cd fluxpype +pip install -e . ``` -Optionally, if you need graphics, install gnuplot -```shell -sudo apt-get install gnuplot -sudo cpanm PDL::Graphics::Gnuplot +If the GCC version is too old, fix it with: + +```sh +export CC=$(which gcc) +export CXX=$(which g++) ``` -## FLUX installation +## 6. Configure the `config.ini` File -To build some of the C code, make sure you have a compiler installed. -```shell -sudo apt-get install gcc +```sh +nano fluxpype/config.ini ``` -If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. -```shell -git clone https://github.com/lowderchris/fluxon-mhd.git -cd fluxon-mhd +Set the code to do your desired run using the documentation (TBD) +Run the configuration run script: + +```sh +python fluxpype/config_runner.py +``` +- For the paths to work out, the config runner must be called from one directory above the file. + + +## FAQs & Troubleshooting +- If gnuplot is not detected correctly in PDL, try the following, and if it works, put this line into either the conda activation script or the bashrc file: + - ```export GNUPLOT_BINARY=$(realpath $(which gnuplot))``` + +- If GSL is not found, use + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + +- If Flux.pm isn't found at the end of the flux install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB make everything ``` + +- To manually set the prefixes for a conda installation before using the makefile: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +``` +- To confirm installation success: + +```sh +perl -e "use Flux;" +``` \ No newline at end of file diff --git a/doc/install-macos.md b/doc/install-macos.md index 5d82aeac..780c0269 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -1,92 +1,150 @@ -# macOS Installation +# macOS Installation Instructions -To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. +These instructions were created by adapting the linux conda install to macOS. Please let us know if anything breaks! +Extra troubleshooting steps are listed at the bottom. -Homebrew and the base perl installation will be installed as a user that has full system access, with further packages and flux itself installed locally. This provides both a buffer if the system perl is updated, and also allows regular access for users who do not have regular administrative privileges. Note that if you have an admin user account, you can also install everything within the homebrew perl library directory, updating paths below accordingly. +## 1. Get Conda Environment Manager +Depending on your mac's architecture, either get +```sh +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh +bash ~/Miniconda3-latest-MacOSX-arm64.sh +``` -## Perl installation +or -First, install the homebrew package, which will require being logged in as an admin user. Follow through the installation process. -```shell -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` sh +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh +bash ~/Miniconda3-latest-MacOSX-x86_64.sh ``` -Make sure at the end of this to follow the instructions for adding homebrew to your path -```shell -(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users//.zprofile -eval "$(/opt/homebrew) -``` +Follow the prompts: +- Hold down the arrow key and then accept terms. +- Accept Conda activation at startup. +- Exit and reconnect to the SSH session/ shell session. -Next, use homebrew as an admin user to install perl. -```shell -brew install perl -``` +## 2. Create Conda Environment and Get Dependencies -If you plan on using homebrew for other packages, and would like to keep perl from updating alongside other packages, the installation can be frozen. -```shell -brew pin perl +```sh +conda create -n fluxenv +conda activate fluxenv +conda install -c conda-forge c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite rich timeout-decorator ``` -Two more homebrew packages will be needed later, which can also be installed via an admin user. -```shell -brew install gnuplot -brew install fftw +Confirm installation by typing `y` when prompted. + +## 3. Install the Perl Data Language (PDL) and Dependencies + +```sh +cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib ``` -The final suggested step as an admin user is to setup the cpanminus tool for installing perl packages. -```shell -brew install cpanminus +If the system struggles with `File`, try: + +```sh +export LDFLAGS="" +export CFLAGS="-O2" +export PERL_LDFLAGS="" +export PERL_CFLAGS="-O2" +export LD=clang +export CC=clang ``` -Set perl to install packages to a local library directory. Here we've chosen to use a perl5 directory inside the ~/Library folder, but this could be anywhere your user has permissions. This is then stored to automatically update in a .zprofile startup script for Zsh - modify if using a different shell. -```shell -PERL_MM_OPT="INSTALL_BASE=~/Library/perl5" cpanm --local-lib=~/Library/perl5 local::lib -echo 'eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`' >> ~/.zprofile -source ~/.zprofile +If `Inline::C` isn’t found, run: + +```sh +cpanm Inline::C ``` -Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. -```shell -push(@INC, "/Users//Library/perl5/lib/perl5/5.38.2"); +## 4. Get FLUX -require('PDL/default.perldlrc'); +Clone and configure Flux: -use PDL::AutoLoader; -$PDL::AutoLoader::Rescan=1; +```sh +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd +make condaflux +``` -1; +## 5. Get Fluxpype Wrapper (To run FLUX with) +```sh +cd .. +git clone https://github.com/GillySpace27/fluxpype.git +cd fluxpype +pip install -e . ``` -## Perl Data Language (PDL) installation +If the GCC version is too old, fix it with: -Using cpanm, install PDL and required depedencies. -```shell -cpanm PDL +```sh +export CC=$(which gcc) +export CXX=$(which g++) ``` -A few other packages of note will be needed for the later fluxon-mhd install. -```shell -cpanm File::ShareDir -cpanm PDL::Graphics::Gnuplot -cpanm Math::RungeKutta -cpanm Term::ReadKey +## 6. Configure the `config.ini` File + +```sh +nano fluxpype/config.ini ``` -## FLUX installation +Set the code to do your desired run using the documentation (TBD) -Finally, for the first install, and for future recompilations, set the perl and flux prefix paths. -```shell -export PL_PREFIX='/Users//Library/perl5' -export FL_PREFIX='/Users//Library/flux' +Execute the configuration run script: + +```sh +python fluxpype/config_runner.py ``` +- For the paths to work out, the config runner must be called from one directory above the file. -If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. -```shell -git clone https://github.com/lowderchris/fluxon-mhd.git -cd fluxon-mhd +## FAQs & Troubleshooting +- If an error says that a perl file cannot be found, make sure there isn't a syntax error somewhere in that file, because it will say it cannot find it when it means it cannot compile it. + +- If gnuplot is not detected correctly in PDL, try the following, and if it works, put this line into either the conda activation script or the bashrc file: + - ```export GNUPLOT_BINARY=$(realpath $(which gnuplot))``` + +- If GSL is not found, use + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + +- If net-SSLeay fails to install, try this + - ```conda install openssl=1.1.1``` + - ```cpanm PDL::Graphics::Gnuplot``` + +- If Math::GSL::Alien fails to install, try + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + +- if the wrong cpanm is getting in the way, delete it using the wrong path as follows + - ```export PATH=$(echo "$PATH" | sed 's|/Users/cgilbert/perl5/perlbrew/bin:||')``` + - then try to use the huge cpanm installation command above + - then run the set_paths.sh file + - activate the environment + - make condainstall + +- if the paths seem completely wrong, try this in the fluxon-mhd directory + - ```make condainstall``` + +- if the error is: Can't locate Alien/Gnuplot.pm in @INC + - ```cpanm Alien::Gnuplot``` + +- if fluxpype cannot find the run file, check the paths at the top of ```config.ini``` to make sure that the path is correct. + +- If Flux.pm isn't found at the end of the flux install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB make everything ``` -After this, make sure to follow the printed instructions for appending your PDLLIB path, and .perldlrc file. +- To manually set the prefixes for a conda installation before using the makefile: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +``` +- To confirm installation success: + +```sh +perl -e "use Flux;" +``` diff --git a/doc/old/install-linux-sudo.md b/doc/old/install-linux-sudo.md new file mode 100644 index 00000000..f49cf0cb --- /dev/null +++ b/doc/old/install-linux-sudo.md @@ -0,0 +1,63 @@ +# Linux Installation + +To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. + +Here we'll outline steps for installing on a Linux system - notably tested on an Ubuntu system. The broad steps can be applied for other flavors of Linux. + +## Perl installation + +First, use apt-get to install cpanminus, an easier tool to use for installing perl packages. +```shell +sudo apt-get install cpanminus +``` + +Install PDL using cpanminus, forcing to bypass any dependency warnings. +```shell +sudo cpanm --force PDL +``` + +If problems are encountered with that PDL installation route, one can install an older version of PDL using apt-get. This may run into code compilation issues down the road. +```shell +sudo apt-get install pdl +``` + +Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. +```shell +push(@INC, "/usr/local/lib/aarch64-linux-gnu/perl/5.38.2"); + +require('PDL/default.perldlrc'); + +use PDL::AutoLoader; +$PDL::AutoLoader::Rescan=1; + +1; + +``` + +A few other packages of note will be needed for the later fluxon-mhd install. +```shell +sudo cpanm File::ShareDir +sudo cpanm Math::RungeKutta +sudo cpanm Term::ReadKey +``` + +Optionally, if you need graphics, install gnuplot +```shell +sudo apt-get install gnuplot +sudo cpanm PDL::Graphics::Gnuplot +``` + +## FLUX installation + +To build some of the C code, make sure you have a compiler installed. +```shell +sudo apt-get install gcc +``` + +If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. +```shell +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd + +make everything +``` diff --git a/doc/old/install-macos-brew.md b/doc/old/install-macos-brew.md new file mode 100644 index 00000000..5d82aeac --- /dev/null +++ b/doc/old/install-macos-brew.md @@ -0,0 +1,92 @@ +# macOS Installation + +To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. + +Homebrew and the base perl installation will be installed as a user that has full system access, with further packages and flux itself installed locally. This provides both a buffer if the system perl is updated, and also allows regular access for users who do not have regular administrative privileges. Note that if you have an admin user account, you can also install everything within the homebrew perl library directory, updating paths below accordingly. + +## Perl installation + +First, install the homebrew package, which will require being logged in as an admin user. Follow through the installation process. +```shell +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +Make sure at the end of this to follow the instructions for adding homebrew to your path +```shell +(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users//.zprofile +eval "$(/opt/homebrew) +``` + +Next, use homebrew as an admin user to install perl. +```shell +brew install perl +``` + +If you plan on using homebrew for other packages, and would like to keep perl from updating alongside other packages, the installation can be frozen. +```shell +brew pin perl +``` + +Two more homebrew packages will be needed later, which can also be installed via an admin user. +```shell +brew install gnuplot +brew install fftw +``` + +The final suggested step as an admin user is to setup the cpanminus tool for installing perl packages. +```shell +brew install cpanminus +``` + +Set perl to install packages to a local library directory. Here we've chosen to use a perl5 directory inside the ~/Library folder, but this could be anywhere your user has permissions. This is then stored to automatically update in a .zprofile startup script for Zsh - modify if using a different shell. +```shell +PERL_MM_OPT="INSTALL_BASE=~/Library/perl5" cpanm --local-lib=~/Library/perl5 local::lib +echo 'eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`' >> ~/.zprofile +source ~/.zprofile +``` + +Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. +```shell +push(@INC, "/Users//Library/perl5/lib/perl5/5.38.2"); + +require('PDL/default.perldlrc'); + +use PDL::AutoLoader; +$PDL::AutoLoader::Rescan=1; + +1; + +``` + +## Perl Data Language (PDL) installation + +Using cpanm, install PDL and required depedencies. +```shell +cpanm PDL +``` + +A few other packages of note will be needed for the later fluxon-mhd install. +```shell +cpanm File::ShareDir +cpanm PDL::Graphics::Gnuplot +cpanm Math::RungeKutta +cpanm Term::ReadKey +``` + +## FLUX installation + +Finally, for the first install, and for future recompilations, set the perl and flux prefix paths. +```shell +export PL_PREFIX='/Users//Library/perl5' +export FL_PREFIX='/Users//Library/flux' +``` + +If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. +```shell +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd + +make everything +``` + +After this, make sure to follow the printed instructions for appending your PDLLIB path, and .perldlrc file. diff --git a/lib/set_condaFlux_paths.sh b/lib/set_condaFlux_paths.sh new file mode 100644 index 00000000..7d1d4004 --- /dev/null +++ b/lib/set_condaFlux_paths.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# Source conda's initialization script to enable conda commands. +source "$(conda info --base)/etc/profile.d/conda.sh" + +# Activate the conda environment 'fluxenv' +conda activate fluxenv + +# Required content for the ~/.perldlrc file +required_content=$(cat <<'EOF' +require(q|PDL/default.perldlrc|); +use PDL::AutoLoader; +$PDL::AutoLoader::Rescan=1; +1; +EOF +) + +# Path to the ~/.perldlrc file +perldlrc="$HOME/.perldlrc" + +# Check if the required content is already in the ~/.perldlrc file +if [ -e "$perldlrc" ]; then + file_content=$(cat "$perldlrc") + if [[ "$file_content" == *"$required_content"* ]]; then + echo "Content already exists in ~/.perldlrc" + else + echo "$required_content" >> "$perldlrc" + echo "Appended required content to ~/.perldlrc" + fi +else + echo "$required_content" > "$perldlrc" + echo "Created ~/.perldlrc and added required content" +fi + +if [ -z "$CONDA_PREFIX" ]; then + echo "Error: \$CONDA_PREFIX is not set" >&2 + return 1 +fi + +# Create activate.d directory if it doesn't exist +mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" + +# Create the environment variable setup script (activation script) +cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" </dev/null | grep "/share/dist/" | awk 'NR==1') +# echo "Found PDLLIB: \$PDLLIB" + +# Set the FLUX prefixes for future recompiling +export PL_PREFIX="\$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="\$CONDA_PREFIX" + +# Print the environment variables for verification +echo "FL_PREFIX is set to: \$FL_PREFIX" +echo "PL_PREFIX is set to: \$PL_PREFIX" +echo "PERL5LIB is set to: \$PERL5LIB" +echo "PDLLIB is set to: \$PDLLIB" \n +EOL + +# Make the activation script executable +chmod +x "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" + +# Create the deactivation script directory +mkdir -p "$CONDA_PREFIX/etc/conda/deactivate.d" + +# Create deactivation script for restoring original environment variables +cat > "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" <<'EOL' +#!/bin/bash + +# Deactivation script for restoring original environment variables + + unset PERL5LIB + unset PDLLIB + unset PL_PREFIX + unset FL_PREFIX + +# Inform the user +echo "Deactivation: Environment variables have been unset. \n" +EOL + +# Make the deactivation script executable +chmod +x "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" + + +# Confirmation message +echo "Activation and deactivation scripts created successfully. Environment variables will be managed upon conda activation/deactivation. \n" diff --git a/lib/test_condaFlux.sh b/lib/test_condaFlux.sh new file mode 100755 index 00000000..e249119f --- /dev/null +++ b/lib/test_condaFlux.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Test if Flux is installed by trying to load it with Perl. +if perl -e "use Flux;" ; then + echo "\nCondaFlux is installed and working!\n" +else + echo "\nCondaFlux is NOT installed!\n" +fi + +# Abort if the correct conda environment isn't active +if [[ "$CONDA_PREFIX" != "$FL_PREFIX" ]]; then + echo "Error: This script must be run from within the 'fluxenv' conda environment." >&2 + echo " Run 'conda activate fluxenv' and try again.\n" >&2 + exit 1 +fi \ No newline at end of file diff --git a/lib/uninstall_condaflux.sh b/lib/uninstall_condaflux.sh new file mode 100755 index 00000000..3d63e1f5 --- /dev/null +++ b/lib/uninstall_condaflux.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +echo "Uninstalling condaFLUX..." +# Source conda's initialization script to enable conda commands. +source "$(conda info --base)/etc/profile.d/conda.sh" + +# Activate the conda environment 'fluxenv' +conda activate fluxenv + +# Remove specific FLUX files and directories. +rm -rf "${FL_PREFIX}/lib/libflux.a" +rm -rf "${FL_PREFIX}/include/flux" + +# Remove the first directory in PDLLIB if it contains "flux". +d_pdllib=$(echo "$PDLLIB" | awk -F: '{print $1}') +if echo "$d_pdllib" | grep -qi flux; then + echo "Deleting $d_pdllib" + rm -rf "$d_pdllib" +else + echo "Skipping deletion of PDLLIB directory: $d_pdllib (does not contain 'flux')" +fi + +# Remove the first directory in PERL5LIB if it contains "flux". +d_perl5lib=$(echo "$PERL5LIB" | awk -F: '{print $1}') +if echo "$d_perl5lib" | grep -qi flux; then + rm -rf "$d_perl5lib" +else + echo "Skipping deletion of PERL5LIB directory: $d_perl5lib (does not contain 'flux')\n" +fi + +# Run test_conda.sh from the lib directory if it exists. +if [ -e "test_condaFlux.sh" ]; then + (source test_condaFlux.sh) +fi + +echo "\ncondaFlux uninstall complete. \n" \ No newline at end of file