Using Dropbox For Shell Scripts vs. Dotfiles

Published in category Project
on Christian Mayer's Weblog.

I used /usr/local/scripts to maintain my shell scripts for several years. On each working box I created a /usr/local/scripts and a /var/log/scripts directory. On each Linux box, on each Mac I own. But the problem is to keep all this scripts on each box up-to-date. Ok, you don’t need them all on all PCs/servers. But the common scripts needed to be updated on each box.

I decided to move /usr/local/scripts to ~/Dropbox/bin. On the Mac boxes it’s easy. You remove /usr/local/scripts from your PATH environment variable and replace it with ~/Dropbox/bin. But you still have the problem that your /etc/profile doesn’t update itself. So you can write a script that does this work for you. Or you create a symbolic link from ~/Dropbox/bin/.profile to ~/.profile. And you also still have the problem that ~/Dropbox/bin isn’t common on the whole system. The root user and each other user can’t access your ~/Dropbox/bin directory because ~ is the home directory of your user. Not a common directory.

So how do we solve this problem? There are several ways but I decided to create an own project: dotfiles

The idea behind this project is to maintain ALL files I need over several computers in a Git repository and overwrite the local files. Even the files for Sublime Text. So I removed the shell scripts from /usr/local/scripts and ~/Dropbox/bin to ~/bin. The real .files like .bashrc, .bash_profile, etc. are at their default paths. /etc/profile and /etc/bashrc are also unchanged defaults. When I want to change something I edit it in the repository. Once cloned/pulled I can run ./ to overwrite the local files. So on every other machines I only need to pull the changes and run the import script. If I also want to use this files for the root user I clone the project into a separated directory and execute the import script as root.

But I would like to prefer this solution only on my personal computers. On servers (for instance for clients) I would like to use an automation software system like Puppet to maintain software and scripts because dotfiles are very personal. Every programmer and system administrator has its own preferences.

More Resources

Recent Posts

About the Author

Christian is a professional software developer living in Vienna, Austria. He loves coffee and is strongly addicted to music. In his spare time he writes open source software. He is known for developing automatic data processing systems for Debian Linux.