upgrade packages script

frankhjung
  12 years ago
  5

upgrade packages script

LinuxMint and other Debian variants have a good package management systems. However I end up doing other regular maintenance tasks to clean-up old packages, ensure all configuration has been applied and other system administration tasks. Of-course it is easy to script all this. This is the result after several years of testing:

# name: upgrade
# author: frankhjung@linux.com
echo "Sources:\n"
inxi -r
echo
echo "Configuring packages ..."
sudo dpkg --configure -a
echo
echo "Refreshing packages ..."
sudo apt-get --fix-missing --list-cleanup update
sudo apt-get dist-upgrade
sudo apt-get -f check
echo
echo "Checking for redundant packages ..."
sudo deborphan -Pz
echo
echo "Clearing packages ..."
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove

This script has the following dependencies:

apt deborphan inxi sudo

To install, use:

install -p -m 755 -o root upgrade /sbin/upgrade

Occasionally, run this to check for redundant packages:

deborphan --guess-all -Pz

And run this to clean local repository:

apt-get clean

One finally problem may be reported by gnupg about package authentication keys. To fix this, follow this example. I followed the example described here.

I recently updated this script to include the following:

sudo dpkg --configure -a

This is to complete installation of unpacked but unconfigured packages.

Comments
kaizerking 12 years ago

I am new to linux and just installed mint, I have noticed some software packages provided in community are bit old versions like Mysql,php. Iw ant to upgrade to latest versions php 5.3 etc, how do i do it?