Use HOME env variable in brew caller scripts
This commit is contained in:
@@ -55,9 +55,17 @@ function downloadHomebrew() {
|
|||||||
popd -q
|
popd -q
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCanonicalBrewPath() {
|
||||||
|
local brewPath=${homebrew_directory}/bin/brew
|
||||||
|
if [[ $brewPath == $HOME* ]]; then
|
||||||
|
brewPath="\${HOME}${brewPath#$HOME}"
|
||||||
|
fi
|
||||||
|
echo $brewPath
|
||||||
|
}
|
||||||
|
|
||||||
function createBrewCallerScript() {
|
function createBrewCallerScript() {
|
||||||
local cmdPath=${HOME}/bin/brew
|
local cmdPath=${HOME}/bin/brew
|
||||||
local brewPath=${homebrew_directory}/bin/brew
|
local brewPath=`getCanonicalBrewPath`
|
||||||
[[ -f ${cmdPath} ]] && rm ${cmdPath}
|
[[ -f ${cmdPath} ]] && rm ${cmdPath}
|
||||||
mkdir -p ${cmdPath:h}
|
mkdir -p ${cmdPath:h}
|
||||||
cat <<- BREWCALLER > ${cmdPath}
|
cat <<- BREWCALLER > ${cmdPath}
|
||||||
@@ -74,13 +82,13 @@ function createBrewCallerScript() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createBrewPeriodicScript() {
|
function createBrewPeriodicScript() {
|
||||||
local brewCallerPath=${HOME}/bin/brew
|
local brewPath=`getCanonicalBrewPath`
|
||||||
local cmdPath=${HOME}/bin/brew-periodic
|
local cmdPath=${HOME}/bin/brew-periodic
|
||||||
[[ -f ${cmdPath} ]] && rm ${cmdPath}
|
[[ -f ${cmdPath} ]] && rm ${cmdPath}
|
||||||
mkdir -p ${cmdPath:h}
|
mkdir -p ${cmdPath:h}
|
||||||
cat <<- BREWCALLER > ${cmdPath}
|
cat <<- BREWCALLER > ${cmdPath}
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
local brew='${brewCallerPath}'
|
local brew='${brewPath}'
|
||||||
\$brew update
|
\$brew update
|
||||||
\$brew upgrade --greedy
|
\$brew upgrade --greedy
|
||||||
\$brew cleanup
|
\$brew cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user