Sync Preferences

Linux at SCAD SFDM for those who use it!

Sync Preferences

Postby cbanko21 on Feb 3rd, '14, 14:16

When traveling between Linux machines you may wish to retain your preferences for Maya, Houdini, or Nuke. The following code can be placed in your bash_custom without modification and do exactly such. (Explanation after the code block.)
Code: Select all
symDirectory(){
    # usage: symDirectory [original dir] [new dir]
    ORIGDIR=$1
    NEWDIR=$2

    if [ ! -d $NEWDIR ]; then
        mkdir -p $NEWDIR
    fi
    if [ -d $ORIGDIR ]; then
        rm -r $ORIGDIR
    fi
    if [ ! -L $NEWDIR ]; then
        ln -s $NEWDIR $ORIGDIR
    fi
}

symDirectory /home/$USER/maya $NETHOME/programs/maya
symDirectory /home/$USER/houdini12.5 $NETHOME/programs/houdini/12.5
symDirectory /home/$USER/houdini13.0 $NETHOME/programs/houdini/13.0
symDirectory /home/$USER/.nuke $NETHOME/programs/nuke
symDirectory /home/$USER/.hiero $NETHOME/programs/hiero
symDirectory /home/$USER/.fonts $NETHOME/other/fonts


First off, the way we are "syncing" is mostly a little cheat-y. We are creating symbolic links that cause one directory to point to another directory yet still allow calls to the original directory. The first section is a function, a reusable "mini-program", that makes our work more efficient.

    1. Check if new preferences folder exists. If not, create it.
    2. Check if original preferences folder exists. If it does, remove it.
    3. Create the symbolic link to the new directory.

Then we call the function with the appropriate arguments.
Montgomery Hall Systems Support
User avatar
cbanko21
 
Posts: 5
Joined: Apr 16th, '13, 16:09

Return to Linux

Who is online

Users browsing this forum: No registered users and 0 guests