ftblog

:: widerstand zwecklos ::
email jabber gpgkey
hackergotchi

November 03, 2010

Bootstrapping new accounts

Filed under: computer -- 00:09

A few days back I've been describing a system to deploy/withdraw personal
configuration files called `dewi'. The system actually works. I'm using it
for the vast majority of my configuration files.

When I want to get my zsh config to a machine, I'm "git-cloning" the
repository and call "make deploy" in it (assuming dewi is properly set up).
But when I get access to a machine, I typically want more things set up than
just my shell. I could do all that by hand. I could. But I'm much too lazy for
that. So, I hacked up two scripts that take me from zero to hero with just a
few commands. I'm calling that procedure bootstrapping an account.

The following assumes that `dewi' is installed on the host system. Also, `git'
is required to clone some repositories.

Say, I got my user `ft' set up on a system. Its entire home-directory is empty
(except for the system's skel stuff, which happens to be some minimal bash
setup). Let's go:

% mkdir ~/etc
% cd ~/etc
% git clone git://github.com/ft/_bootstrap.git
% cd _bootstrap
% ./bootstrap.sh yes_please
% ./get_repos.pl 0x50.de _all_
% cd ..
% make -i deploy
% chsh -s /bin/zsh
% logout


And that's it. Next time I login, everything will be setup the way I'd like it
to. That's five commands. Ten if you count the chdirs and the logout. If you
can do this quicker, I'd love to see how. :-)

The interesting lines in the above list are "./bootstrap.sh yes_please" and
"./get_repos.pl 0x50.de _all_", because they do the actual bootstrapping. The
"make -i deploy" is just dewi deploying everything from `~/etc'.

What does bootstrap.sh do? Well, it calls `dewi'. It initialises `~/etc' as
my dewi-root-directory. Then it takes some files files from the `addons' and
`cfg' directories of the `_bootstrap.git' repository and deploys them into
`~/etc/.dewi' using `dewi' itself. After that the system is completely usable
with all my customisations on board.

Then, `get_repos.pl' comes into play. It's just a flexible way to clone git
repositories that contain my setup files from somewhere. (Oh yeah, sidenote:
because of the nice guys at dev.0x50.de, I got a place for my setup files,
accessible from virtually everywhere: dev.0x50.de/projects/ftdotfiles666
If you're reading this, thanks a lot again!)

That should also explain the `0x50.de'. That's what I call the source. It's
defined in a file in the `sources' directory. It maps configuration files
names to a repository. The `_all_' parameter is special. It tells the
script to just fetch all the repositories from the named source. Usually,
you'd specify one of more categories as defined by the files in the `lists'
directory. So, if you'd like to fetch the `core' and `editors' config
repositories, you'd do:

% ./get_repos.pl 0x50.de core editors


I made two special categories for types of machines, too. `remote' and
`windoze'. The former is for machines I got remote access to, the other is
for Microsoft Windows 7 machines, with which I'm stuck with at work. So, when
I get remote access to a new machine, I'm following the above listing and drop
in:

% ./get_repos.pl 0x50.de remote


...and be done with it (on Windows 7 machines that's "./get_repos.pl 0x50.de
windoze" from a cygwin prompt).

Needless to say, I'm quite happy with this right now.

Powered by zblog
valid css | valid xhtml | utf-8 encoded | best viewed with anybrowser