-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_functions.brew
43 lines (39 loc) · 1.26 KB
/
.bash_functions.brew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# vim: ft=bash noet:
! declare 2>&1 | grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
function brew {
local brew="command brew"
$brew $@
rc=$?
test "$brew" && \rm -fr $($brew --prefix)/var/homebrew/locks
return $rc
}
function brewPostInstall {
echo "=> Updating homebrew ..." >&2
echo >&2
time $brew update -v
sync
echo >&2
echo "=> Adding missing taps ..." >&2
echo >&2
time for tap in homebrew/core homebrew/services homebrew/cask homebrew/cask-versions homebrew/cask-drivers homebrew/cask-fonts buo/cask-upgrade;do
$brew tap | \grep -q $tap || {
set -x
time $brew tap $tap && sync
sync
set +x
}
done
local macOS_EssentialPackages="iproute2mac"
local common_EssentialPackages="awk grep gsed coreutils findutils"
[ $osFamily = Darwin ] && $brew install $common_EssentialPackages $macOS_EssentialPackages
}
function brewServicesStatus {
if [ $osFamily = Darwin ];then
local serviceList=$@
serviceList=$(echo $serviceList | tr " " "|")
$brew services list | \egrep "$serviceList" | \egrep "started|stopped"
fi
}
set +x
test "$debug" -gt 0 && echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"