DTC’s installation script October 5, 2009

Robots
I mentioned in my last post, where we built that metapackage, that I’d post our installation script.

This script is run immediately after a clean install, from CD, of Ubuntu / Kubuntu / Mint. It installs the metapackage, copies our standard settings to /etc, and installs software not available in repositories, like Komodo Edit.

Here it is, with comments.

#!/bin/bash

if [ $# -lt 1 ]
then
    echo "Usage: install "
    echo "  where  is one of 'ubuntu', 'kubuntu' or 'mint'"
    exit 1
fi

DISTRO=$1

# Find the distro architecture
ARCH=`apt-cache -v | cut -d' ' -f4`

# Configure apt to use the proxy
sudo cp ~it/install/etc/apt/apt.conf /etc/apt/

# Update software
sudo apt-get update
sudo apt-get -y dist-upgrade

# Install DTC software requirements
# (Here is the metapackage build in my previous post)
sudo dpkg -i ${DISTRO}-desktop-dtc_1.2_${ARCH}.deb

# Fix unresolved dependencies
sudo apt-get -f -y install

# Install libdvd-css
sudo ~it/install/bin/install-css.sh

# Install Komodo Edit
cd /tmp/
if [ "$ARCH" = "i386" ]
then
    tar -xzf ~it/install/Komodo-Edit-5.1.3-3592-linux-libcpp6-x86.tar.gz
    cd Komodo-Edit-5.1.3-3592-linux-libcpp6-x86/
elif [ "$ARCH" = "amd64" ]
then
    tar -xzf ~it/install/Komodo-Edit-5.1.3-3592-linux-libcpp6-x86_64.tar.gz
    cd Komodo-Edit-5.1.3-3592-linux-libcpp6-x86_64/
fi
sudo ./install.sh -I /usr/lib/komodo-edit-5
sudo ln -s "/usr/lib/komodo-edit-5/bin/komodo" /usr/bin/komodo
cd -

# Put /etc under version control
cd /etc
sudo bzr init
sudo bzr add
sudo bzr commit -m "Original config"

# Copy settings for Kerberos, LDAP, MySQL, etc.
sudo cp -a ~it/install/etc/* .

# Commit changes
sudo bzr add
sudo bzr commit -m "DTC config changes"

cd -

That’s it. Now all that remains is for me to program our team of robots to do installations all by themselves.


[2009-11-04]
The lines
sudo dpkg -i ...
sudo apt-get -f -y install

can be done more easily with
sudo gdebi

What’s more, I’m finding that messing with these meta-packages makes me think that this is a little over-engineered. It’s easier to maintain if you just use a text file (commented, if you want) of package names, and then install with:

cat | egrep -v ‘^#’ | xargs sudo apt-get -y install

(That egrep is to remove the comment lines.)

Leave a Reply