Skip to content

Instantly share code, notes, and snippets.

@revmischa
Created September 21, 2011 18:39
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 revmischa/1232929 to your computer and use it in GitHub Desktop.
Save revmischa/1232929 to your computer and use it in GitHub Desktop.
Bootstrap a brand new debian system
#!/bin/bash
PUPPET_HOST="ebola.int80.biz"
function set_hostname {
echo "Hostname: "
read hostname
echo "$hostname" > /etc/hostname
echo "127.0.1.1 $hostname" >> /etc/hosts
hostname "$hostname"
}
function add_puppet_host {
echo "START=yes" > /etc/default/puppet
echo "DAEMON_OPTS=\"--server $PUPPET_HOST\"" >> /etc/default/puppet
}
function install_cpanm {
curl -L http://cpanmin.us | perl - --self-upgrade
}
function apt_init {
aptitude update
aptitude install -y puppet emacs23-nox screen git-core bash-completion \
curl sudo build-essential
}
function create_bobo {
# add bobo account, generate key
useradd -m bobo
usermod -G sudo bobo
chsh -s /bin/bash bobo
su - bobo -c ssh-keygen
}
function add_deploy_key {
# add ssh as a deployment key for home repo
hostname=`hostname -v`
key=`cat /home/bobo/.ssh/id_rsa.pub`
params="{'title':'bobo_$hostname','key':'$key'}"
echo $params
echo "GitHub password:"
read pw
curl -i -X POST -d "{\"title\":\"bobo_$hostname\",\"key\":\"$key\"}" -u "revmischa:$pw" https://api.github.com/repos/revmischa/home/keys
echo ""
}
function init_bobo_home {
su - bobo -c "cd ~; git init; git remote add origin git@github.com:revmischa/home.git; git pull -u origin master"
cp -rp ~bobo/.emacs* ~/
cp ~bobo/.screenrc ~/
cp ~bobo/.bashrc ~/
cp ~bobo/.bash_profile ~/
cp ~bobo/.git-completion.bash ~/
cp ~bobo/.gitconfig ~/
}
apt_init
set_hostname
add_puppet_host
create_bobo
add_deploy_key
init_bobo_home
install_cpanm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment