Added an expect script to login and update Admin. Also added Playtypus UI controls.
This commit is contained in:
parent
fd1ae473d1
commit
9e28dcabf1
48 changed files with 63 additions and 2984 deletions
|
|
@ -1,109 +0,0 @@
|
|||
<?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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -1,86 +0,0 @@
|
|||
#!/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
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?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.
|
Before Width: | Height: | Size: 133 KiB |
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,16 @@
|
|||
#!/Users/gugulethu/brew/bin/zsh
|
||||
|
||||
# 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)
|
||||
# Version 8.0 (19 April, 2019)
|
||||
|
||||
osascript -e 'display notification "Updater starting..." with title "MacUpdater"'
|
||||
# The below are Platypus features for managing UI
|
||||
echo "PROGRESS:0" # Show the progress bar at 0%
|
||||
echo "Script starting" # Show this message above the progress bar
|
||||
|
||||
# Set the path to the log file
|
||||
export LOG="/Users/gugulethu/Projects/Programming/push/macupdater/macupdater-log.txt"
|
||||
|
||||
echo "NOTIFICATION:Updater starting..." # Send a notification (with logo)
|
||||
|
||||
# Export paths for appification.
|
||||
export PATH="/Users/gugulethu/brew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/$"
|
||||
|
|
@ -12,72 +19,101 @@ 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
|
||||
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.
|
||||
printf "$1 updates complete." >> $LOG # If no error, print update complete to file.
|
||||
printf "" >> $LOG # Add a line to file.
|
||||
else # If error, show a dialog stating the section where the error occured.
|
||||
osascript -e 'display notification "'$1': Script encountered errors." with title "MacUpdater"'
|
||||
echo "NOTIFICATION:'$1': Updates failed." # Send a notification (with logo)
|
||||
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 ' ' - >> ~/Projects/Programming/macupdater/macupdater-log.txt # Prints line
|
||||
echo "" >> $LOG # Starts the horizontal line on its own fresh line.
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - >> $LOG # Prints line
|
||||
}
|
||||
|
||||
# Writes the header for the log file: Program, Version number, Date and Line.
|
||||
{ echo "macupdater 6.0"; echo "Log: " `date`; line; } > ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "macupdater 6.0"; echo "Log: " `date`; line; } > $LOG
|
||||
|
||||
# Brew update commands.
|
||||
{ echo "Brew"; echo ""; brew update; brew upgrade; brew cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "Brew"; echo ""; brew update; brew upgrade; brew cleanup; } >> $LOG
|
||||
catcher Brew
|
||||
line
|
||||
|
||||
echo "PROGRESS:10" # Show the progress bar at 10%
|
||||
echo "Brew updates complete" # Show this message above the progress bar
|
||||
|
||||
# Brew-cask update commands.
|
||||
{ echo "Brew Cask"; echo ""; brew cu -ayf --cleanup; brew cleanup; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "Brew Cask"; echo ""; brew cu -ayf --cleanup; } >> $LOG
|
||||
catcher Brew-cask
|
||||
line
|
||||
|
||||
echo "PROGRESS:20" # Show the progress bar at 20%
|
||||
echo "Brew cask updates complete" # Show this message above the progress bar
|
||||
|
||||
# App Store update commands.
|
||||
{ echo "Apps"; echo ""; mas upgrade; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "Apps"; echo ""; mas upgrade; } >> $LOG
|
||||
catcher Apps
|
||||
|
||||
echo "PROGRESS:30" # Show the progress bar at 60%
|
||||
echo "Mac app store updates complete" # Show this message above the progress bar
|
||||
|
||||
# Node update commands.
|
||||
{ echo "Node"; echo ""; npm install npm@latest -g --silent; npm update --silent; npm prune --silent; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "Node"; echo ""; npm install npm@latest -g --silent; npm update --silent; npm prune --silent; } >> $LOG
|
||||
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
|
||||
echo "PROGRESS:40" # Show the progress bar at 40%
|
||||
echo "Node package updates complete" # Show this message above the progress bar
|
||||
|
||||
# Ruby update commands. Commented out all as they only work in admin.
|
||||
# { rvm get latest; } >> $LOG
|
||||
# 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
|
||||
catcher Ruby
|
||||
line
|
||||
# { echo "Ruby"; echo ""; gem update --system; gem update; gem cleanup; } >> $LOG
|
||||
# catcher Ruby
|
||||
# line
|
||||
|
||||
# Atom update commands.
|
||||
{ echo "Atom"; echo ""; apm update; apm upgrade; apm prune; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "Atom"; echo ""; apm update; apm upgrade; apm prune; } >> $LOG
|
||||
catcher Atom
|
||||
line
|
||||
|
||||
echo "PROGRESS:50" # Show the progress bar at 50%
|
||||
echo "Atom package updates complete" # Show this message above the progress bar
|
||||
|
||||
# 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
|
||||
# { echo "Perl"; echo ""; perlbrew upgrade-perl; perlbrew self-upgrade --silent; perlbrew clean; } >> $LOG
|
||||
# catcher Perl
|
||||
# line
|
||||
|
||||
# System software update commads.
|
||||
{ echo "macOS"; echo ""; softwareupdate -ia; } >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
{ echo "macOS"; echo ""; softwareupdate -ia; } >> $LOG
|
||||
catcher macOS
|
||||
line
|
||||
|
||||
echo "PROGRESS:60" # Show the progress bar at 60%
|
||||
echo "macOS updates complete" # Show this message above the progress bar
|
||||
|
||||
echo "" >> ~/Projects/Programming/macupdater/macupdater-log.txt
|
||||
echo "NOTIFICATION:All local updates complete."
|
||||
|
||||
echo "PROGRESS:70" # Show the progress bar at 70%
|
||||
echo "Local updates complete" # Show this message above the progress bar
|
||||
|
||||
# Sets the password variable for the admin account
|
||||
PASSWD="$(osascript -e 'text returned of (display dialog "Please enter a password to continue" default answer "" with icon stop buttons {"Cancel", "Continue"} default button "Continue" with hidden answer)')"
|
||||
|
||||
# An expect script to log into the admin account and run brew updates
|
||||
/usr/bin/expect -c "spawn login; expect \"Login:\"; send \"mlungisi\r\"; expect \"Password:\"; send \"$PASSWD\r\"; expect \"g:~ mlungisi$\"; send \"{ gem update --system; gem update; gem cleanup; brew update; brew upgrade; brew cleanup; brew cu -ayf --cleanup; }\r\"; expect eof; end"
|
||||
catcher Admin
|
||||
|
||||
echo "" >> $LOG
|
||||
line
|
||||
|
||||
echo "PROGRESS:100" # Show the progress bar at 100%
|
||||
echo "Script complete" # Show this message above the progress bar
|
||||
echo "NOTIFICATION:All updates are complete"
|
||||
|
||||
# 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 local updates completed." with title "MacUpdater"'
|
||||
printf "All updates complete. END" >> $LOG
|
||||
|
||||
# Opens the admin updater for brew packages
|
||||
open /Users/gugulethu/Applications/macupdater.app/Contents/Resources/macupdater-admin.app
|
||||
|
||||
exit 0
|
||||
echo "QUITAPP"
|
||||
|
|
|
|||
Reference in a new issue