Last active
January 21, 2016 04:58
-
-
Save DennisLfromGA/e4765209db5219076c34 to your computer and use it in GitHub Desktop.
Script to install or update common software packages - as defined in $PACKAGES.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# | |
APPLICATION="${0##*/}" | |
PACKAGES="\ | |
cgpt colordiff compizconfig-settings-manager cowsay fortune-mod fortunes fortunes-debian-hints fortunes-min \ | |
fortunes-off gparted guake ppa-purge remmina remmina-common remmina-plugin-rdp remmina-plugin-vnc screen synaptic \ | |
tmux ubuntu-wallpapers unity-tweak-tool update-manager update-manager-core update-notifier update-notifier-common \ | |
update-notifier-kde vim vim-doc vim-scripts vim-addon-manager vlc vlc-data vlc-nox vlc-plugin-notify vlc-plugin-pulse wajig" | |
SUDO='' | |
# | |
# Prints out a fancy spinner that updates every time a line is fed in. | |
# $1: number of lines between each update of the spinner (default: 1) | |
# Erases the line each time, so it will always be at position 0. | |
# Either expect this and put text later in the line, or give this its own line. | |
spinner() { | |
mawk -Winteractive ' | |
BEGIN { | |
printf "\r" | |
} | |
{ | |
y = (y+1) % '"${1:-1}"' | |
if (y == 0) { | |
x = (x+1) % 4 | |
printf substr("\|/-", x+1, 1) "\r" | |
} | |
}' 1>&2 | |
} | |
# | |
echo; echo "$APPLICATION: Script to install or update the following packages:" | |
echo; echo "$PACKAGES" | |
# | |
# Need to have super-user permissions | |
if [ $(id -u) -ne 0 ]; | |
then | |
echo; echo -n "$APPLICATION: Elevating permissions to superuser - " | |
exec sudo sh -e "$0" "$@" | |
# SUDO='sudo'; sudo true | |
fi | |
# | |
echo; echo -n "##--> ${APPLICATION}: Installing 'aptitude' ..." | |
$SUDO apt-get install -y aptitude aptitude-common 2>&1 | spinner | |
# | |
echo; echo -n "##--> ${APPLICATION}: Updating packages available - be patient (~1 minute) ..." | |
$SUDO aptitude update 2>&1 | spinner | |
# | |
echo; echo -n "##--> ${APPLICATION}: Installing favorites --- be more patient (~5 minutes) .." | |
echo | |
for pkg in $PACKAGES | |
do | |
echo -n "##--> ${APPLICATION}: Package: $pkg " | |
$SUDO aptitude install -y "$pkg" | spinner && echo | |
done | |
# | |
echo; echo -n "##--> ${APPLICATION}: Cleaning up ..." | |
$SUDO wajig fixinstall 2>&1 | spinner | |
# | |
echo; echo "##--> ${APPLICATION}: Installation complete ..." | |
# | |
/usr/games/cowsay All done - now get to work ...; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment