install updates
This commit is contained in:
+11
-2
@@ -1,13 +1,22 @@
|
||||
#!/bin/bash
|
||||
# This script adds the bin directory to PATH
|
||||
# This script adds the bin directory to PATH and loads environment variables from .env
|
||||
#
|
||||
# Usage:
|
||||
# Source this script in your rc:
|
||||
# source /path/to/here/install.sh
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||
BIN_DIR="$SCRIPT_DIR/bin"
|
||||
ENV_FILE="$SCRIPT_DIR/.env"
|
||||
|
||||
if [ -d "$BIN_DIR" ] && [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
|
||||
export PATH="$PATH:$BIN_DIR"
|
||||
fi
|
||||
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
while IFS='=' read -r key value; do
|
||||
if [ -n "$key" ] && [ -n "$value" ] && [[ ! "$key" =~ ^# ]]; then
|
||||
export "$key=$value"
|
||||
fi
|
||||
done < "$ENV_FILE"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user