Created
September 30, 2009 17:52
-
-
Save tdavis/198291 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
usage='bootstrap.sh -- Bootstrap a profile installation | |
Options: | |
k A key name (Default: "id_dsa") | |
u User name directory (Default: "user") | |
o User home directory (Default: "/home/$u") | |
g Version of git to download (Default: 1.6.4.4) | |
c Profile clone path | |
p URL to public key | |
r URL to private key | |
h Print this message | |
'; | |
KEYNAME=id_dsa | |
UNAME=user | |
HOME=/home/$UNAME | |
CLONE=git@server:/path/to/profile.git | |
GITVER=1.6.4.4 | |
while getopts "k:u:o:c:g:p:r:h" opt; do | |
case $opt in | |
k) | |
KEYNAME=$OPTARG;; | |
u) | |
UNAME=$OPTARG;; | |
o) | |
HOME=$OPTARG;; | |
c) | |
CLONE=$OPTARG;; | |
g) | |
GITVER=$OPTARG;; | |
p) | |
PUBKEY=$OPTARG;; | |
r) | |
PRIVKEY=$OPTARG;; | |
h) | |
echo "$usage" | |
exit;; | |
esac | |
done | |
# Basic stuff | |
apt-get -qq update | |
apt-get -qq upgrade | |
apt-get -qq install build-essential python2.5 screen bzip2 zlib1g-dev tcl | |
# Make user | |
adduser $UNAME | |
mkdir /home/$UNAME/.ssh | |
cd /tmp | |
# Git | |
wget http://kernel.org/pub/software/scm/git/git-$GITVER.tar.gz | |
tar xfz git-$GITVER.tar.gz | |
cd git-$GITVER | |
./configure | |
make | |
make install | |
rm -rf /tmp/git* | |
# Profile prep | |
SSH=$HOME/.ssh | |
if [ -n $PRIVKEY ]; then | |
wget -q $PRIVKEY -O $SSH/$KEYNAME | |
fi | |
if [ -n $PUBKEY ]; then | |
wget -q $PUBKEY -O $SSH/$KEYNAME.pub | |
cp $SSH/$KEYNAME.pub $SSH/authorized_keys | |
fi; | |
chmod -R 600 $SSH | |
chown -R $UNAME:$UNAME $SSH | |
# Keychain | |
wget -q http://agriffis.n01se.net/keychain/keychain-2.6.8.tar.bz2 | |
tar xfj keychain-2.6.8.tar.bz2 | |
install -m0755 keychain-2.6.8/keychain /usr/bin/keychain | |
rm -rf /tmp/keychain* | |
/usr/bin/keychain $HOME/.ssh/$KEYNAME | |
source $HOME/.keychain/`hostname`-sh | |
cd $HOME | |
# Clone profile | |
git clone $CLONE | |
python profile/setup-profile.py | |
chown -R $UNAME $HOME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment