I wanted a single, cross-platform way to say "Apply all updates in a reasonably safe and sane manner". It seems like most update commands require several discrete commands: clean up, update program database, ACTUALLY update, etc. Over the years, I've written scripts for most of the operating systems that I run at home. This is an effort to merge them into one script that can be pulled down and run from any OS that supports bash.
I wanted scripts that could be run nightly from cron on servers, and scripts that could be run by non-technical relatives on the desktop. Therefore, the emphasis is on safety rather than efficiency.
- The
bash
shell must be installed. - You must have the ability to run as root or equivalent (e.g. with
sudo
) - The
uname
command must exist git
is not required (you can download from github.com), but it's easier to stay up to date if it's installed.
- Update third-party repos or tools that run on top of the OS. Macports, etc. These are updated first because many OS updates require an immediate reboot, but it's rare for add-on packages to require a reboot.
- Run any OS cleanup, fix, or check commands. If possible, the script should abort if a problem is found and not fixed.
- Sync update databases and get list of possible updates.
- Download and apply updates. Avoid experimental or not-recommended updates.
- If reboot flag is set, reboot after 5 minutes.
- Linux variants
- CentOS
- Debian
- Fedora
- Raspbian
- Redhat
- Ubuntu
- Darwin (a.k.a. OS X)
- with or without Macports
- go to whatever directory you use to store source code.
- To pull down the repository, type
git clone https://github.com/brokengoose/update-o-matic.git
or download the filehttps://raw.githubusercontent.com/brokengoose/update-o-matic/master/update-o-matic.sh
- To run the script interactively, go to the update-o-matic directory and type
sudo bash ./update-o-matic.sh
- To run the script via cron, add something like the following to crontab
@daily /opt/update-o-matic/update-o-matic.sh >> /tmp/update-o-matic.log 2>&1
- When it's time for updates, go to the update-o-matic directory and type
git pull
or download the file from github again.
- Removed SuSE and FreeBSD support, as I no longer regularly use those operating systems.
- Added proper getopts command line flag processing
- Added help option
- Added reboot wait time option
See https://github.com/brokengoose/update-o-matic/issues