Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
etckeeper
#!/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
# ------- CUT HERE -------
### Remove 0000 from the following
source <ssinclude StackScriptID=&quot;45060000&quot;> # Install better common utilities
<udf name=&quot;system_use_etc_keeper&quot; label=&quot;Install Etckeeper (backs up /etc)&quot; oneof=&quot;git,darcs,hg,bzr,Skip&quot; default=&quot;git&quot; />
<udf name=&quot;system_utilities&quot; label=&quot;Choose Your Favorite Utilities&quot; manyOf=&quot;apt-file,bsd-mailx,bwm-ng,curl,htop,iotop,iozone,iperf,python-software-properties,strace,sysstat,tmux,tofrodos,wget,zsh
&quot; default=&quot;apt-file,bsd-mailx,bwm-ng,curl,htop,iotop,iozone,iperf,python-software-properties,strace,sysstat,tmux,tofrodos,wget,zsh&quot;>
if [ &quot;$SYSTEM_USE_ETC_KEEPER&quot; != &quot;Skip&quot; ] # SS4506
then
system_start_etc_dir_versioning &quot;$SYSTEM_USE_ETC_KEEPER&quot; # SS4506
fi
system_install_utils # SS4506
# ------- CUT HERE -------
DEFAULT_SYSTEM_UTILITIES=&quot;
apt-file
bsd-mailx
bwm-ng
curl
htop
iotop
iozone
iperf
python-software-properties
strace
sysstat
tmux
tofrodos
wget
zsh
&quot;
SYSTEM_UTILITIES=&quot;${SYSTEM_UTILITIES:-$DEFAULT_SYSTEM_UTILITIES}&quot;
function system_install {
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-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=&quot;${1}&quot;
case &quot;$vcs&quot; 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=&quot;${1:-git}&quot;
system_install_vcs $vcs
system_install etckeeper
sed -i &quot;s/^VCS=.*/VCS=$vcs/&quot; /etc/etckeeper/etckeeper.conf
etckeeper init
}
# call this after major changes
function system_record_etc_dir_changes {
etckeeper commit &quot;$@&quot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.