Use single script for brew periodic tasks
This commit is contained in:
committed by
T. R. Bernstein
parent
8d2b7627d1
commit
582ce875fb
@@ -120,10 +120,25 @@ function createBrewCallerScript() {
|
|||||||
umask 002
|
umask 002
|
||||||
"$(getHomebrewRepositoryPath)/bin/brew" "\$@"
|
"$(getHomebrewRepositoryPath)/bin/brew" "\$@"
|
||||||
BREWCALLER
|
BREWCALLER
|
||||||
chown ${username}:admin ${brewCallerPath}
|
chown root:admin ${brewCallerPath}
|
||||||
chmod ug+x,o-x ${brewCallerPath}
|
chmod ug+x,o-x ${brewCallerPath}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createBrewPeriodicScript() {
|
||||||
|
ensureLocalBinFolder
|
||||||
|
local scriptPath="/usr/local/bin/brew-periodic"
|
||||||
|
[ -f "${scriptPath}" ] && rm "${scriptPath}"
|
||||||
|
cat <<- BREWCALLER > ${scriptPath}
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
local brew='/usr/local/bin/brew'
|
||||||
|
\$brew update
|
||||||
|
\$brew upgrade --greedy
|
||||||
|
\$brew cleanup
|
||||||
|
BREWCALLER
|
||||||
|
chown root:admin ${scriptPath}
|
||||||
|
chmod ug=rx,o=r ${scriptPath}
|
||||||
|
}
|
||||||
|
|
||||||
function installHomebrewCore() {
|
function installHomebrewCore() {
|
||||||
export NONINTERACTIVE=1
|
export NONINTERACTIVE=1
|
||||||
[ ! -d $(getHomebrewRepositoryPath) ] || return
|
[ ! -d $(getHomebrewRepositoryPath) ] || return
|
||||||
@@ -146,8 +161,7 @@ function createLaunchDaemonsPlist() {
|
|||||||
<string>${launcherName}</string>
|
<string>${launcherName}</string>
|
||||||
<key>ProgramArguments</key>
|
<key>ProgramArguments</key>
|
||||||
<array>
|
<array>
|
||||||
<string>/usr/local/bin/brew</string>
|
<string>/usr/local/bin/brew-periodic</string>
|
||||||
<string>${brewCommand}</string>
|
|
||||||
</array>
|
</array>
|
||||||
<key>StartInterval</key>
|
<key>StartInterval</key>
|
||||||
<integer>1800</integer>
|
<integer>1800</integer>
|
||||||
@@ -166,8 +180,7 @@ function createLaunchDaemonsPlist() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function installHomebrewUpdater() {
|
function installHomebrewUpdater() {
|
||||||
createLaunchDaemonsPlist brew-updater update
|
createLaunchDaemonsPlist brew-periodic
|
||||||
createLaunchDaemonsPlist brew-upgrader upgrade
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +193,8 @@ function configure_system() {
|
|||||||
ensureHomebrewLogDirectory || return 14
|
ensureHomebrewLogDirectory || return 14
|
||||||
indicateActivity 'Install Homebrew core' installHomebrewCore || return 15
|
indicateActivity 'Install Homebrew core' installHomebrewCore || return 15
|
||||||
indicateActivity 'Create brew caller script' createBrewCallerScript || return 16
|
indicateActivity 'Create brew caller script' createBrewCallerScript || return 16
|
||||||
indicateActivity 'Install Homebrew updater' installHomebrewUpdater || return 17
|
indicateActivity 'Create brew periodic script' createBrewPeriodicScript || return 17
|
||||||
|
indicateActivity 'Install Homebrew updater' installHomebrewUpdater || return 18
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExecPrerequisites() {
|
function getExecPrerequisites() {
|
||||||
|
|||||||
Reference in New Issue
Block a user