refactor: Use XDG compliant isolated directory structure
- Using $BOOTSTRAP_BIN, $BOOTSTRAP_OPT, etc - Add defensive fallback for undefined vars in common.sh
This commit is contained in:
@@ -7,6 +7,15 @@ if [ -n "${_LIB_COMMON_SOURCED:-}" ]; then
|
||||
fi
|
||||
_LIB_COMMON_SOURCED=1
|
||||
|
||||
# Export global environment paths with default fallbacks
|
||||
export BOOTSTRAP_DIR="${BOOTSTRAP_DIR:-$HOME/.config/bootstrap}"
|
||||
export BOOTSTRAP_DATA_DIR="${BOOTSTRAP_DATA_DIR:-$HOME/.local/share/bootstrap}"
|
||||
export BOOTSTRAP_STATE_DIR="${BOOTSTRAP_STATE_DIR:-$HOME/.local/state/bootstrap}"
|
||||
export BOOTSTRAP_CACHE_DIR="${BOOTSTRAP_CACHE_DIR:-$HOME/.cache/bootstrap}"
|
||||
export BOOTSTRAP_BIN="${BOOTSTRAP_BIN:-$BOOTSTRAP_DATA_DIR/bin}"
|
||||
export BOOTSTRAP_OPT="${BOOTSTRAP_OPT:-$BOOTSTRAP_DATA_DIR/opt}"
|
||||
export BOOTSTRAP_RUNTIMES="${BOOTSTRAP_RUNTIMES:-$BOOTSTRAP_DATA_DIR/runtimes}"
|
||||
|
||||
# Ensure running in Bash
|
||||
require_bash() {
|
||||
if [ -z "${BASH_VERSION:-}" ]; then
|
||||
@@ -88,7 +97,7 @@ version_lt() {
|
||||
download_file() {
|
||||
local url="$1"
|
||||
local dest="$2"
|
||||
local cache_dir="$HOME/.local/state/bootstrap/cache"
|
||||
local cache_dir="$BOOTSTRAP_CACHE_DIR/downloads"
|
||||
|
||||
mkdir -p "$cache_dir"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user