pixel: Dreamwidth: Home is where the heart is (dw: homeis<3)
[personal profile] pixel posting in [community profile] command_liners
Using UbuntuOne to sync dotfiles across several, possibly remote machines. I don't know if this would work with say, Dropbox, because I've never used it but I guess it could be adapted to any of those cloud services if you can access them from the command line, and most importantly make a symbolic link to that directory.

The genesis for this is the fact that I like to use a)taskwarrior and b)my netbook. So I happen to have multiple computers that run Ubuntu and maybe I'm in the minority in that. I wanted my tasks to be available wherever I was. I still haven't figured out how to pull them onto my Android phone but I'll keep working on that.

Taskwarrior uses some text files stored in ~/.task/ by default. I initially attempted to just sync the directory but that won't work. At some point I asked in launchpad I think and never got an answer.


Note: I would NOT use this procedure for things like, oh, ssh keys or, password stores or anything that if somebody got a hold of, that could really mess with your world. AFAIK the UbuntOne stores are NOT encrypted in any way, even if the connection to the servers might be(?)

On my main computer with all my existing data...
Step 0:
First I created a directory in my home directory that I set up to sync to UbuntuOne. For me that was ~/Tools under that I created directories for each tool I wanted to sync, mostly for my own piece of mind/sanity. So..

mkdir ~/Tools
mkdir ~/Tools/bash
mkdir ~/Tools/task

Step 1:
There is a sync cli tool for UbuntuOne but I had enough trouble with it that I'm just going to say, you need UbuntuOne setup, and you need to 'Sync this folder.' I used Nautilus for this. Check out the wiki for more info.

Step 2:
Ok, so now you need to copy all of the dotfiles into your Tools directory. For me that looked something like:

cp ~/.bash_aliases ~/Tools/bash/bash_aliases
cp ~/.bash_logout ~/Tools/bash/bash_logout
cp ~/.bashrc ~/Tools/bash/bashrc

The important bits are that you're copying into your ~/Tools directory that will sync and you're removing the '.' prefix, so that UbuntuOne will properly sync the files. Also, if you have any other scripts that are referenced in say your .bashrc file treat those just the same, or you'll be missing them on the other end.

Step2.5:
Now, I also did this with my taskwarrior task files, this includes both a .taskrc and a .task/ directory that contains data files that I want to sync across computers. Here's how I did that:

mkdir ~/Tools/task/data
cp ~/.task/* ~/Tools/task/data/
# Get the .taskrc file too
cp ~/.taskrc ~/Tools/task/taskrc

I just used the data/ directory because it made sense to me and wasn't a hidden folder, if you want to stick with task's naming convention you can use task/task/ instead, it doesn't make much difference just remember what you did.

Step 3:
Perfect now we've got copies of all our stuff syncing on UbuntuOne, now we're gonna link the syncing files to our home directory so we always use the syncing files. I gave myself a bit of extra insurance and moved everything to a ~/tmp directory while I was doing this, just in case I screwed something up. You may also want to make copies of these commands, because you're gonna use them again on your secondary computer.

mkdir ~/tmp
mv .bash_aliases .bash_logout .bashrc ~/tmp
ln -s ~/Tools/bash/bash/bash_aliases ~/.bash_aliases
ln -s ~/Tools/bash/bash/bash_logout ~/.bash_logout
ln -s ~/Tools/bash/bash/bashrc ~/.bashrc

Cool, now do the task files...

mv .taskrc .task ~/tmp
ln -s ~/Tools/task/taskrc ~/.taskrc
ln -s ~/Tools/task/data ~/.task

And I'm back in business. Try out task, make sure it's giving me my task list, that it's not making any errors, reload bash, see that that is working properly too. Awesome.

On my secondary computer, ie. netbook/laptop/whatever...
Step 4:
Check out that the files are syncing. Make sure that you're all connected up to UbuntuOne or your service of choice. I have used it before, if you havn't then you'll need to sign in and do all that, see the wiki if you have issues here.
Once you're all synced from 'the cloud'.

Step 5:
Now it's just repeating Step 3 on your other computer.... All your original files are still stored in ~/tmp so if you need to get something from there, you can get it and edit the synced file to merge them if you need.

mkdir ~/tmp
mv .bash_aliases .bash_logout .bashrc ~/tmp
ln -s ~/Tools/bash/bash/bash_aliases ~/.bash_aliases
ln -s ~/Tools/bash/bash/bash_logout ~/.bash_logout
ln -s ~/Tools/bash/bash/bashrc ~/.bashrc
mv .taskrc .task ~/tmp
ln -s ~/Tools/task/taskrc ~/.taskrc
ln -s ~/Tools/task/data ~/.task

And you're done! Not particularly difficult actually, it just took some thought on how to get the sync properly without being able to directly sync the .dotfiles.

Now you're using the same files on both machines, helpfully synced by all that cloudy goodness, thanks UbuntuOne folks!

Now, who else wants to barf when they see those Microsoft 'to the cloud!' commercials? I'd really like to see the stats on how many cloud computers actually run Windows.

Profile

command_liners: A command line prompt with a blinking cursor after it, green against black. (Default)
Command Liners

September 2014

S M T W T F S
 123456
78910111213
1415 1617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 21st, 2017 02:50 am
Powered by Dreamwidth Studios