User Tools

Site Tools


scripts:custom_install

Custom_Install

Introduction

The custom install script is simply meant to make install packages that you use on many systems easier. Especially for those of us that re-install often. It can be made to install anything you want, and even be used for non-debian systems if the user makes it so.

It is a simple Bash script, so should be able to run on any mainstream Distro.

The script currently is built to run under oneiric or Ubuntu 11.10 by default.

Known issues

It likes to add the Virtualbox repo even if no is replied, that will be fixed in a future release.

Roadmap

It is planned to add a PPA example. It is also going to be updated to work with 12.04 on release day.

Changelog

V 0.1 - Initial release. Still buggy, but the framework is here, and it runs.

V 0.2 - Removed OS check for making sure it is “supported”. Also, Virtualbox is now just an example of adding a repository.

V 0.3 - Moved BIT into /dev/null since it is irrelevant. (BIT set was removed from the script.)

The Code

custom_install.sh
#!/bin/bash
##  This is a script adpated by Jonathan Garbee from an older version of Perfectbuntu
##  ( http://perfectbuntu.category5.tv ) written by Robbie Ferguson.  
####
# Do NOT ask for software to be added into the main script.  What is provided is
# only to be used as a framework for your customization.
## 
 
# Script start
echo
echo Custom Install Script
echo Version 0.3
echo
echo
echo "Starting the script"
sleep 2s
# If you are needing to do something that requires your username as you run the script,
# use MAIN_USER to insert that name, since if things are done as super-user it then
# is root vs your actual username.  The next snippit of code gets your user, and sets
# it to MAIN_USER for use even as root.
echo "Getting and storing the current username."
MAIN_USER="$USER"
echo
sleep 3s
echo "Checking for super-user access"
#sleep 5
sudo echo "Access Granted."
echo
echo "Time for install"
echo
sleep 2s
 
# Ask if they want to install their stuff
echo -en
read -p "Do you want to update your system? (Y/N)"
echo -en
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ] ; then
UPDATE="1"
fi
echo
echo
echo -en
read -p "Do you want to install apps that you have set from the default repositories? (Y/N)"
echo -en
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ] ; then
CUSTOM="1"
fi
echo
echo
echo -en
read -p "Do you want to install Virtualbox from their repository? (Y/N)"
echo -en
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ] ; then
VIRTUALBOX="1"
fi 
 
 
# Now that selections are made, lets add any needed repositories.
 
echo
touch /tmp/custom_install_sources
 
 
# This is an example of a Repository that requires it manually be added.
## This is not meant to be run twice.  Otherwise it will keep adding extra lines in /etc/apt/sources.list.
## If you re-run, either comment this area out or delete the line(s) added from /etc/apt/sources.list.
 
if [ "$VIRTUALBOX" = "1" ]; then
echo -e "\n \n ##Oracle Virtualbox Repository \n deb http://download.virtualbox.org/virtualbox/debian oneiric contrib" >> /tmp/custom_install_sources
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
fi
fi
 
cat /tmp/custom_install_sources | sudo tee -a /etc/apt/sources.list
 
sudo apt-get update
 
 
# Time to install the packages
 
# Update the system
if [ "$UPDATE" = "1" ]; then
echo "Updating your base system."
sudo apt-get update && sudo apt-get -y dist-upgrade
echo Done.
fi
 
# Install the users custom software packages from the main repository
# This is the command to edit for your software packages.  Simply remove
# everything after "install" in the sudo apt-get line (as if you are actually
# installing by hand).  This line will auto-install all the software specified
# without asking.
###  I prefer not to add things from other repositories in this area since they
###  could require extra stuff, like Virtualbox.  You *can* though and have no
###  problems.
if [ "$CUSTOM" = "1" ]; then
echo "Installing your stuff"
sleep 3s
sudo apt-get --force-yes -y -f -m install ubuntu-restricted-extras filezilla putty gufw preload gimp gimp-data-extras gimp-plugin-registry shutter
echo Done.
fi
 
# Install Virtualbox from Oracles Repository
if [ "$VIRTUALBOX" = "1" ]; then
echo "Virtualbox eh?..."
sleep 3s
sudo apt-get --force-yes -y -f -m install build-essential virtualbox-4.1
sudo usermod -G vboxusers -a $MAIN_USER
echo "You will need to logout before you can fully use Virtualbox."
sleep 4s
fi
 
#  Cleaning the packages out of the cache.
echo "Cleaning some packages out of the cache."
sudo apt-get clean
 
# Script end.
echo Done.
echo
echo "All done.  Wasn't that painless?"
sleep 5s
You could leave a comment if you were logged in.
scripts/custom_install.txt · Last modified: 2012/03/27 05:46 by garbee