macupdater
Search…
Variables and Sudo
Changing where the log file is stored and getting admin privileges

Variables

Log path

We set the path for the log file, which documents progress and errors during updates. If you would like to change the path where the log is stored 'export LOG=add/your/preferred/path/here'.
1
# Set the path to the log file
2
export LOG=~/Desktop/macupdater-log.txt
Copied!

Preparing for app creation

The path variable below makes the script work when we use Platypus to convert the script into an app.
1
# Export paths for appification.
2
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/quot;
Copied!

Sudo rights

Before the updates we get sudo rights and ask for the password to ensure that the processes that follow runs smoothly. Without this some package managers throw up errors when trying to install packages.
1
# Ask for the password up-front
2
sudo -v
3
4
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
5
while true; do sudo -n true; sleep 60; kill -0 "$" || exit; done 2>/dev/null &
Copied!
Last modified 1yr ago