I did something similar as I install to two computers and every 6 months with multiple installs of the next version.
All I did was run the command from command line and then list history. Then copied history to bash file. Of course I had a lot of typos errors in my command line, but it let me test & verify which lines really worked.
I wanted to find some checking and add some distribution based variables. You then can add whatever works.
Code:
#!/usr/bin/env bash -x
# -x adds debugging mode set +x or set -x
# Repositoires - Normally users have the first 4 enabled - main, universe, multiverse, restricted
# Check if we are on Ubuntu
if [ "$(lsb_release -is)" != "Ubuntu" ] ; then
echo "This script is only intended to run on Ubuntu"
exit 255
fi
# Check if we are root
if [ $UID -ne 0 ] ; then
echo "Please run this as root!"
exit 255
fi
# Get distro
distro=$(lsb_release -cs)
src=/etc/apt/sources.list
#save your original sources.list file.
echo "Backing Up The sources.list"
cp -i /etc/apt/sources.list /etc/apt/sources.list_backup
#this updates everything
apt-get update
apt-get upgrade
#would upgrade you to the latest kernel in the repositories
apt-get dist-upgrade
Bookmarks