pkb-howto
Search…
Dotfiles
If you're following One Folder, then your PKB is a great place to put your Dotfiles. Configuring a new machine can look as simple as:
  1. 1.
    Synchronize your PKB.
  2. 2.
    Deploy your dotfiles.
  3. 3.
    You're ready to be productive!
There are a variety of ways to do this, so we'll just look at a dead-simple setup, and you can add more advanced tools to your heart's content.
The idea here is pretty simple. Assuming you have a folder ~/pkb/Dotfiles/ , what we want to do is to put your actual dotfiles in this folder, and then symlink them to where the applications are expecting to find them. Here's a very crude version of what this might look like:
1
~/pkb/Dotfiles$ ls -a
2
.bash_justin install.sh git/ sublime/
Copied!
When I set up a new computer, the first thing I do is synchronize my PKB, and then I run the install.sh script above, which does the following:
install.sh
1
#!/usr/bin/sh
2
3
# link dotfiles
4
export DOTFILES_DIR=/home/justin/pkb/Dotfiles
5
ln -f -n -s $DOTFILES_DIR/git $HOME/.git
6
ln -f -s $HOME/.git/.gitconfig $HOME/.gitconfig
7
mkdir -p $HOME/.config/sublime-text-3/Packages
8
ln -f -n -s $DOTFILES_DIR/sublime $HOME/.config/sublime-text-3/Packages/User
9
10
# Add utility env-vars and utility bash aliases/functions
11
if ! grep .bash_justin ~/.bashrc ; then
12
echo "if [ -f \$DOTFILES_DIR/.bash_justin ]; then" >> ~/.bashrc
13
echo " . \$DOTFILES_DIR/.bash_justin" >> ~/.bashrc
14
echo "fi" >> ~/.bashrc
15
fi
Copied!
This is an idempotent script (the -f and -n flags are important), and so if you discover a new set of dotfiles to preserve, e.g. .my.cnf, move it into the Dotfiles folder, add the corresponding symlink command to the install script (ln -f -s $HOME/.my.cnf $DOTFILES_DIR/.my.cnf), and then re-run the install script.
Now, if any of your configurations change, they'll automatically be preserved in your PKB and propagate across all of your devices.
Copy link