g_it/macupdater
Archived
1
0
Fork 0

Added an admin module that prompts for username / password to update the admin brew packages.

This commit is contained in:
g* 2019-04-07 22:58:58 +02:00
commit fd1ae473d1
50 changed files with 2978 additions and 143 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
macupdater-log.txt

View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMIsApplet</key>
<true/>
<key>AMStayOpen</key>
<false/>
<key>BuildMachineOSBuild</key>
<string>17A405001</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>Automator workflow file</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>Application Stub</string>
<key>CFBundleIconFile</key>
<string>AutomatorApplet</string>
<key>CFBundleIdentifier</key>
<string>com.apple.automator.macupdater-admin</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>macupdater-admin</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>444.42</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10P70r</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>10.14</string>
<key>DTSDKBuild</key>
<string>18E203</string>
<key>DTSDKName</key>
<string>macosx10.14internal</string>
<key>DTXcode</key>
<string>1020</string>
<key>DTXcodeBuild</key>
<string>10P70r</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>LSUIElement</key>
<true/>
<key>NSAppleEventsUsageDescription</key>
<string>This workflow needs to control other applications to run.</string>
<key>NSAppleMusicUsageDescription</key>
<string>This workflow needs access to your music to run.</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSCalendarsUsageDescription</key>
<string>This workflow needs access to your calendars to run.</string>
<key>NSCameraUsageDescription</key>
<string>This workflow needs access to your camera to run.</string>
<key>NSContactsUsageDescription</key>
<string>This workflow needs access to your contacts to run.</string>
<key>NSHomeKitUsageDescription</key>
<string>This workflow needs access to your HomeKit Home to run.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This workflow needs access to your microphone to run.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This workflow needs access to your photos to run.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSRemindersUsageDescription</key>
<string>This workflow needs access to your reminders to run.</string>
<key>NSServices</key>
<array/>
<key>NSSiriUsageDescription</key>
<string>This workflow needs access to Siri to run.</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>This workflow needs access to administer this system in order to run.</string>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>

Binary file not shown.

File diff suppressed because it is too large Load diff

86
macupdater-admin.sh Normal file
View file

@ -0,0 +1,86 @@
#!/bin/zsh
# This script updates brew, brew cask apps, apm packages, ruby gems, rvm, npm packages and macOS (including system software) Apps.
# Additionally, for admin, this script updates the hosts file.
# Version 6.5 (6 October, 2018)
osascript -e 'display notification "Updater starting..." with title "MacUpdater"'
# Start sudo session
sudo -v
# Update the hosts files to the latest Steven Black versions
python3 hosts/updateHostsFile.py --auto --replace --flush-dns-cache --skipstatichosts
# Replace old hosts file with new versions
sudo cp hosts/hosts /etc/
# Function: Reviews the last command for errors. Then prints update complete to log or shows error dialog. Takes section variable.
catcher () {
if [ "$?" = "0" ]; then
printf "$1 updates complete." >> ~/Projects/Programming/macupdater/macupdater-log.txt # If no error, print update complete to file.
printf "" >> ~/Projects/Programming/macupdater/macupdater-log.txt # Add a line to file.
else # If error, show a dialog stating the section where the error occurred.
osascript -e 'display notification "'$1': Script encountered errors." with title "MacUpdater"'
fi
}
# Function: Creates a horizontal line in the text file.
line () {
echo "" >> ~/Projects/Programming/macupdater/macupdater-log.txt # Starts the horizontal line on its own fresh line.
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - >> ~/logs/macupdater/macupdater-log.txt # Prints line
}
# Writes the header for the log file: Program, Version number, Date and Line.
{ echo "macupdater 6.0"; echo "Log: " `date`; line; } > ~/logs/macupdater-log.txt
# Brew update commands.
{ echo "Brew"; echo ""; brew update; brew bundle dump --force; brew bundle -verbose; brew cleanup; brew prune; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
catcher Brew
line
# Brew-cask update commands. Functionality replaced by brew bundle.
# { echo "Brew Cask"; echo ""; brew cu -ay --cleanup; brew cask cleanup; } >> ~/logs/macupdater-log.txt
# catcher Brew-cask
# line
# App Store update commands. Functionality replaced by brew bundle.
# { echo "Apps"; echo ""; mas upgrade; } >> ~/logs/macupdater-log.txt
# catcher Apps
# Node update commands.
{ echo "Node"; echo ""; npm install npm@latest -g --silent; npm update --silent; npm prune --silent; } >> ~/logs/macupdater-log.txt
catcher Node
line
# Ruby update commands. Commented out RVM update (takes too long and not necessary).
# { rvm get latest; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# rvm cleanup all (don't need this for now)
{ echo "Ruby"; echo ""; ; gem update --system; gem update; gem cleanup; } >> ~/logs/macupdater-log.txt
catcher Ruby
line
# Atom update commands.
{ echo "Atom"; echo ""; apm update; apm upgrade; apm prune; } >> ~/logs/macupdater-log.txt
catcher Atom
line
# Perl update commands. Commented out (don;t need uopdated Perl at the moment)
# { echo "Perl"; echo ""; perlbrew upgrade-perl; perlbrew self-upgrade --silent; perlbrew clean; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# catcher Perl
# line
# System software update commads.
{ echo "macOS"; echo ""; softwareupdate -ia; } >> ~/logs/macupdater-log.txt
catcher macOS
line
echo "" >> ~/logs/macupdater-log.txt
line
# Prints and shows dialog box confirming all updates are done.
printf "All updates complete. END" >> ~/logs/macupdater-log.txt
osascript -e 'display notification "All updates completed." with title "MacUpdater"'
exit 0

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>macupdater-admin</string>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,130 +0,0 @@
macupdater 6.0
Log: Sat Oct 6 13:26:11 SAST 2018
-------------------------------------------------------------------------------------
Brew
Already up-to-date.
Skipping install of buo/cask-upgrade tap. It is already installed.
Using buo/cask-upgrade
Skipping install of homebrew/bundle tap. It is already installed.
Using homebrew/bundle
Skipping install of homebrew/cask tap. It is already installed.
Using homebrew/cask
Skipping install of homebrew/cask-fonts tap. It is already installed.
Using homebrew/cask-fonts
Skipping install of homebrew/cask-versions tap. It is already installed.
Using homebrew/cask-versions
Skipping install of homebrew/core tap. It is already installed.
Using homebrew/core
Skipping install of openssl formula. It is already up-to-date.
Using openssl
Skipping install of bash formula. It is already up-to-date.
Using bash
Skipping install of bash-completion formula. It is already up-to-date.
Using bash-completion
Skipping install of bash-git-prompt formula. It is already up-to-date.
Using bash-git-prompt
Skipping install of coreutils formula. It is already up-to-date.
Using coreutils
Skipping install of curl formula. It is already up-to-date.
Using curl
Skipping install of ffmpeg formula. It is already up-to-date.
Using ffmpeg
Skipping install of freetype formula. It is already up-to-date.
Using freetype
Skipping install of git formula. It is already up-to-date.
Using git
Skipping install of gnupg formula. It is already up-to-date.
Using gnupg
Skipping install of imagemagick formula. It is already up-to-date.
Using imagemagick
Skipping install of mackup formula. It is already up-to-date.
Using mackup
Skipping install of make formula. It is already up-to-date.
Using make
Skipping install of mas formula. It is already up-to-date.
Using mas
Skipping install of nmap formula. It is already up-to-date.
Using nmap
Skipping install of node formula. It is already up-to-date.
Using node
Skipping install of openvpn formula. It is already up-to-date.
Using openvpn
Skipping install of rsync formula. It is already up-to-date.
Using rsync
Skipping install of sphinx-doc formula. It is already up-to-date.
Using sphinx-doc
Skipping install of trash formula. It is already up-to-date.
Using trash
Skipping install of tree formula. It is already up-to-date.
Using tree
Skipping install of wget formula. It is already up-to-date.
Using wget
Skipping install of wp-cli formula. It is already up-to-date.
Using wp-cli
Skipping install of youtube-dl formula. It is already up-to-date.
Using youtube-dl
Skipping install of zsh formula. It is already up-to-date.
Using zsh
Skipping install of zsh-completions formula. It is already up-to-date.
Using zsh-completions
Skipping install of zsh-git-prompt formula. It is already up-to-date.
Using zsh-git-prompt
Skipping install of zsh-syntax-highlighting formula. It is already up-to-date.
Using zsh-syntax-highlighting
Using adapter
Using android-platform-tools
Using artpip
Using atom
Using boom-3d
Using carbon-copy-cloner
Using cheatsheet
Using codekit
Using controlplane
Using cyberduck
Using darktable
Using disk-drill
Using flux
Using font-abel
Using font-aboriginal-sans
Using font-aboriginal-serif
Using font-african-sans
Using font-african-serif
Using font-anonymice-powerline
Using font-input
Using font-inter-ui
Using fork
Using hazel3
Using horndis
Using iina
Using iterm2-nightly
Using itsycal
Using knockknock
Using libreoffice
Using pdf-expert
Using platypus
Using qlcolorcode
Using qlmarkdown
Using qlprettypatch
Using qlstephen
Using quicksilver
Using signal
Using sketchup
Using soduto
Using transmission
Using vivaldi
Using ynab
Using Affinity Designer
Using Affinity Photo
Using Amphetamine
Using DaVinci Resolve
Using GarageBand
Using GIF Brewery 3
Using GIPHY CAPTURE
Using InfoSlips Viewer
Using Keynote
Using Pages
Using TokenLock
Using Xcode
Homebrew Bundle complete! 88 Brewfile dependencies now installed.

View file

@ -1,10 +1,14 @@
#!/Users/gugulethu/brew/bin/zsh
# This script updates brew, brew cask apps, apm packages, ruby gems, rvm, npm packages and macOS (including system software) Apps.
# Version 6.5 (6 October, 2018)
# This script updates brew, brew cask apps, atom packages, ruby gems, node packages and macOS (including system software) Apps.
# Version 7.0 (7 April, 2019)
osascript -e 'display notification "Updater starting..." with title "MacUpdater"'
# Export paths for appification.
export PATH="/Users/gugulethu/brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/$"
export PATH="/Users/gugulethu/brew/sbin:$PATH"
# Function: Reviews the last command for errors. Then prints update complete to log or shows error dialog. Takes section variable.
catcher () {
if [ "$?" = "0" ]; then
@ -25,18 +29,18 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - >> ~/Projects/Programmin
{ echo "macupdater 6.0"; echo "Log: " `date`; line; } > ~/Projects/Programming/macupdater/macupdater-log.txt
# Brew update commands.
{ echo "Brew"; echo ""; brew update; brew bundle dump --force; brew bundle -verbose; brew cleanup; brew prune; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
{ echo "Brew"; echo ""; brew update; brew upgrade; brew cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
catcher Brew
line
# Brew-cask update commands. Functionality replaced by brew bundle.
# { echo "Brew Cask"; echo ""; brew cu -ay --cleanup; brew cask cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# catcher Brew-cask
# line
# Brew-cask update commands.
{ echo "Brew Cask"; echo ""; brew cu -ayf --cleanup; brew cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
catcher Brew-cask
line
# App Store update commands. Functionality replaced by brew bundle.
# { echo "Apps"; echo ""; mas upgrade; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# catcher Apps
# App Store update commands.
{ echo "Apps"; echo ""; mas upgrade; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
catcher Apps
# Node update commands.
{ echo "Node"; echo ""; npm install npm@latest -g --silent; npm update --silent; npm prune --silent; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
@ -46,7 +50,7 @@ line
# Ruby update commands. Commented out RVM update (takes too long and not necessary).
# { rvm get latest; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# rvm cleanup all (don't need this for now)
{ echo "Ruby"; echo ""; ; gem update --system; gem update; gem cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
{ echo "Ruby"; echo ""; gem update --system; gem update; gem cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
catcher Ruby
line
@ -55,7 +59,7 @@ line
catcher Atom
line
# Perl update commands. Commented out (don;t need uopdated Perl at the moment)
# Perl update commands. Commented out (don't need updated Perl at the moment)
# { echo "Perl"; echo ""; perlbrew upgrade-perl; perlbrew self-upgrade --silent; perlbrew clean; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
# catcher Perl
# line
@ -71,6 +75,9 @@ line
# Prints and shows dialog box confirming all updates are done.
printf "All updates complete. END" >> ~/Projects/Programming/macupdater/macupdater-log.txt
osascript -e 'display notification "All updates completed." with title "MacUpdater"'
osascript -e 'display notification "All local updates completed." with title "MacUpdater"'
# Opens the admin updater for brew packages
open /Users/gugulethu/Applications/macupdater.app/Contents/Resources/macupdater-admin.app
exit 0