Fix R lib install

This commit is contained in:
2024-08-02 20:09:11 -04:00
parent 38f4669e43
commit 7cc0264177

View File

@@ -275,7 +275,7 @@ backup() {
}
# @description Prints a helpful message add program start
print_header() {
interactive_header() {
debug "Running: ${FUNCNAME[0]}"
cat <<-'EOF'
@@ -1643,18 +1643,6 @@ main() {
declare -g RSCRIPT="${RSCRIPT:-$(which Rscript 2>/dev/null)}"
declare -g MATLAB="${MATLAB:-$(which matlab 2>/dev/null)}"
# Use a custom R library
if [[ -z $R_LIBS_USER || $R_LIBS_USER != "$HOME/R/$SCRIPT_NAME" ]]; then
echo "This script uses a custom R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
if ((YES)) || ask "Would you like to make this library the default for your user?"; then
echo "Adding R_LIBS_USER=$HOME/R/$SCRIPT_NAME to your .bashrc"
echo "export R_LIBS_USER=$HOME/R/$SCRIPT_NAME" >> "$HOME/.bashrc"
fi
else
debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"
fi
# Global vars
SCRIPT_NAME="${BASH_SOURCE[0]}"
SCRIPT=$(realpath -s "${BASH_SOURCE[0]}")
@@ -1714,6 +1702,19 @@ main() {
fi
fi
# Ask to make our custom R library the default
if [[ -z $R_LIBS_USER || $R_LIBS_USER != "$HOME/R/$SCRIPT_NAME" ]]; then
echo "This script uses a custom R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
if ((YES)) || ask "Would you like to make this library the default for your user?"; then
echo "Adding R_LIBS_USER=$HOME/R/$SCRIPT_NAME to your .bashrc"
echo "export R_LIBS_USER=$HOME/R/$SCRIPT_NAME" >> "$HOME/.bashrc"
fi
else
debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"
fi
# Make sure we are using the absolute path
OUT_DIR=$(realpath -s "$OUT_DIR")
@@ -1725,7 +1726,7 @@ main() {
parse_input "$@" # parse arguments with getopt
print_header "$@"
interactive_header "$@"
# # Prompt user for the PROJECT if we still don't have one
# if [[ ${#PROJECTS[@]} -eq 0 ]]; then