Opravy z macos

This commit is contained in:
lachtan obecny
2026-07-13 06:06:18 +02:00
parent a2441cf23b
commit b3026487f0
5 changed files with 34 additions and 16 deletions

1
bashrc
View File

@@ -22,4 +22,5 @@ source_directory_sh "$HOME/.bashrc.d"
append_path "$LWS/bin" append_path "$LWS/bin"
append_path "$LWS/opt/bin" append_path "$LWS/opt/bin"
set_system_paths
set_uniq_path set_uniq_path

View File

@@ -60,6 +60,12 @@ function append_path() {
fi fi
} }
function append_path_to_end() {
local path="$1"
remove_path "$path"
append_path "$path"
}
function append_path_try() { function append_path_try() {
if [[ -e "$1" ]]; then if [[ -e "$1" ]]; then
append_path "$1" append_path "$1"
@@ -79,7 +85,14 @@ function prepend_path_try() {
} }
function remove_path() { function remove_path() {
PATH=$(path | grep -v "$1" | tr "\n" ":") PATH=$(path | grep -v "^$1$" | tr "\n" ":")
}
function set_system_paths() {
append_path_to_end /usr/bin
append_path_to_end /bin
append_path_to_end /usr/sbin
append_path_to_end /sbin
} }
function uniq_path() { function uniq_path() {

View File

@@ -1,12 +1,14 @@
# Terminal colors if [[ -n "${TERM:-}" ]] && can_run tput; then
LWS_RED=$(tput setaf 1) # Terminal colors
LWS_GREEN=$(tput setaf 2) LWS_RED=$(tput setaf 1)
LWS_CYAN=$(tput setaf 6) LWS_GREEN=$(tput setaf 2)
LWS_COLOR_RESET=$(tput sgr0) LWS_CYAN=$(tput setaf 6)
LWS_COLOR_RESET=$(tput sgr0)
# Bash prompt escape sequences # Bash prompt escape sequences
LWS_PS1_USER='\u' LWS_PS1_USER='\u'
LWS_PS1_HOST='\h' LWS_PS1_HOST='\h'
LWS_PS1_DIR='\w' LWS_PS1_DIR='\w'
LWS_PS1_TYPE='\$' LWS_PS1_TYPE='\$'
LWS_PS1_USER_HOST="${LWS_GREEN}${LWS_PS1_USER}@${LWS_PS1_HOST}${LWS_COLOR_RESET}:${LWS_CYAN}${LWS_PS1_DIR}${LWS_COLOR_RESET}" LWS_PS1_USER_HOST="${LWS_GREEN}${LWS_PS1_USER}@${LWS_PS1_HOST}${LWS_COLOR_RESET}:${LWS_CYAN}${LWS_PS1_DIR}${LWS_COLOR_RESET}"
fi

View File

@@ -1,9 +1,11 @@
# Homebrew initialization # Homebrew initialization
# Can set BREW_HOME in advance # Can set BREW_HOME in advance
xlog "Homebrew initialization" xlog "Homebrew/Linuxbrew initialization"
BREW_LOCATIONS=( BREW_LOCATIONS=(
"/opt/homebrew"
"/usr/local/Homebrew"
"$HOME/.local/share/linuxbrew" "$HOME/.local/share/linuxbrew"
"$HOME/.linuxbrew" "$HOME/.linuxbrew"
"/home/linuxbrew/.linuxbrew" "/home/linuxbrew/.linuxbrew"
@@ -28,8 +30,8 @@ if [[ -e "$BREW" ]]; then
eval "$($BREW shellenv)" eval "$($BREW shellenv)"
PATH="$path_backup" PATH="$path_backup"
append_path "$HOMEBREW_PREFIX/bin" prepend_path "$HOMEBREW_PREFIX/bin"
append_path "$HOMEBREW_PREFIX/sbin" prepend_path "$HOMEBREW_PREFIX/sbin"
fi fi
unset BREW unset BREW

View File

@@ -1,4 +1,4 @@
nop "${SDKMAN_DIR:=$HOME/.sdkman}" : "${SDKMAN_DIR:=$HOME/.sdkman}"
if [[ -d $SDKMAN_DIR ]]; then if [[ -d $SDKMAN_DIR ]]; then
export SDKMAN_DIR export SDKMAN_DIR
source_try "$SDKMAN_DIR/bin/sdkman-init.sh" source_try "$SDKMAN_DIR/bin/sdkman-init.sh"