Skip to content

Instantly share code, notes, and snippets.

@dupuy
Last active December 16, 2015 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dupuy/5418227 to your computer and use it in GitHub Desktop.
Save dupuy/5418227 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Install better common utilities
#
# Copyright (c) 2012 Barry Allard <barry.allard@gmail.com>
#
# Also available at: https://gist.github.com/3452111
# UDF template for including in other scripts
DEFAULT_SYSTEM_UTILITIES="
apt-file
bsd-mailx
bwm-ng
curl
htop
iotop
iozone3
iperf
python-software-properties
strace
sysstat
tmux
tofrodos
wget
zsh
"
SYSTEM_UTILITIES="${SYSTEM_UTILITIES:-$DEFAULT_SYSTEM_UTILITIES}"
function system_install {
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends $@
}
function system_install_utils {
system_install ${SYSTEM_UTILITIES}
echo $SYSTEM_UTILITIES | grep -qs sysstat && \
echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
}
function system_install_build {
system_install build-essential bison flex
}
function system_install_subversion {
system_install subversion
}
function system_install_git {
system_install git-core
}
function system_install_mercurial {
system_install mercurial
}
function system_install_bazaar {
system_install bzr
}
function system_install_darcs {
system_install darcs
}
function system_install_subversion {
system_install subversion
}
function system_install_vcs {
local vcs="${1}"
case "$vcs" in
darcs) system_install_darcs ;;
baazar|bzr) system_install_bazaar ;;
mercurial|hg) system_install_mercurial ;;
git) system_install_git ;;
subversion|svn) system_install_subversion
esac
}
function system_start_etc_dir_versioning {
local vcs="${1:-git}"
system_install_vcs $vcs
system_install etckeeper
sed -i "s/^VCS=.*/VCS=$vcs/" /etc/etckeeper/etckeeper.conf
etckeeper init
}
# call this after major changes
function system_record_etc_dir_changes {
# make a change in /etc/ in case apt run has committed everything already
(TZ=UTC date +%Y-%m-%dT%H:%M:%SZ; echo "$@") >> /etc/etckeeper/etckeeper.log
etckeeper commit "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment