USB Pen Drive User

Tim Writer tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Tue Jun 1 14:03:43 UTC 2004


Scott Elcomb <Scott.Elcomb-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org> writes:

> Hello to all!
> 
> I'm not entirely certain this is possible, but I'd like to try an
> experiment - carry my user id on a pen drive.
> 
> I've got a growing number of systems where I'm duplicating my
> configurations, so the idea occurred to me to store my profiles (and
> whatever other configuration files) on the drive and just carry them
> with me.  :)
> 
> The only part that I'm pretty sure I've got down is this (sorry about
> the perl, but I find it much easier to describe with :)
> 
> #Start -> ~/.bash_profile (or ~/.bashrc) calls ~/bin/mobile_user.pl
> 
> # Mobile_user.pl
> #!/usr/bin/perl
> my @conf_files = qw(~/.bashrc ~/.bash_profile ~/.procmailrc);    #etc.
> my $pd_connected = get_pendrive_mount_point() || 0;
> if($pd_connected) {
> 	backup_configs(@conf_files);
> 	create_symlinks(@conf_files, $pd_connected);
> }
> # funcs ...

Why don't you just mount your pen drive on your home?  IOW,

    # mount /dev/sda1 /home/scott

assuming your pen drive shows up as sda and has a single partition.  With
this approach, there's no need to copy any files back and forth, they're just
there.

For this to work well, you will need to put a real file system on the pen
drive, i.e. ext2, ext3, reiserfs, etc. instead of msdos.

If you're worried your pen drive isn't large enough for your home, break your
home into two logical areas, namely configuration (which you want everywhere)
and local working space.  For example, put all your config files (and
anything else you want to carry with you such as your address book, calendar,
etc.) in /home/scott.  Put all your working files in /ws/scott (where /ws is
either a separate workspace partition or a symlink to a suitable location
with free space).

Of course, this approach is only workable if you have administrative control
over the systems in question.  If you don't, you can still benefit from
separating configuration from the rest of your home.  The approach I've taken
is to move all my config files into an sub-directory of my home which I've
called "rc".  I then do one of three (application dependent) things, in order
of preference:

    o   Set an environment variable to tell the application where to
        find it's config file, e.g. screen uses SCREENRC so I have:

            SCREENRC=$HOME/rc/screenrc

    o   Create a symlink from my home into rc for the relevant config
        file, e.g.:

            % cd
            % ln -s rc/zshenv .zshenv

    o   Copy (or rsync) files from rc to my home.  I do this with my ssh keys
        because of permission issues over how I manage rc which I won't get
        into here.

I'm slowly automating all this so that when I login, I can just:

    % cd rc
    % make

Anyway, if you reorganize your home in this way, you can now just put rc on
your pen drive.  You can either mount it directly:

    # mount /dev/sda1 /home/scott/rc

or just rsync or copy it.

FWIW, like Fraser, I manage my home via version control but I use Perforce
instead of Subversion.  Together with the above techniques, it works quite
well.

-- 
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org>                                  starnix inc.
905.771.0017 ext. 225                           thornhill, ontario, canada
http://www.starnix.com              professional linux services & products
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list