Difference between revisions of "User:Diggernet/Sandbox"

From Gramps
Jump to: navigation, search
(Run GRAMPS from a portable drive)
(Run GRAMPS from a portable drive)
Line 1: Line 1:
 
=Run GRAMPS from a portable drive=
 
=Run GRAMPS from a portable drive=
  
Some users want to keep their GRAMPS data on a removable drive, either for portability between computers or for security.  This describes how to accomplish that, and should work whether using a floppy, a flash drive, or an external hard drive.  Unfortunately, there are not any easy instructions for installing GRAMPS and its dependencies on a removable drive, so these instructions assume and require that GRAMPS be installed on any computer to which you connect the drive.
+
Some users want to keep their GRAMPS data on a removable drive, either for portability between computers or for security.  This document describes how to accomplish that, and should work whether using a floppy, a flash drive, or an external hard drive.  Unfortunately, there are not any easy instructions for installing GRAMPS and its dependencies on a removable drive, so these instructions assume and require that GRAMPS be installed on any computer to which you connect the drive.
 +
 
 +
==How it works==
 +
The magic is done in scripts that you use to start GRAMPS.  The scripts trick GRAMPS into thinking that your user home directory is on the removable drive instead of in the usual place, so that GRAMPS will read and write its configuration and data there.  The process is mostly transparent, but you will probably need to edit the media base path each time you run GRAMPS on a different computer.  You may also need to edit some settings in the scripts for different computers.  If there are certain computers which you use regularly that need different settings in the scripts, you can easily make separate script copies for each one, to avoid the need to reedit them.
 +
 
 +
==Installation==
 +
Save the scripts in the directory you want to use as your GRAMPS home directory on the removable drive.  When run, the scripts will direct GRAMPS to the directory they are installed in.  Edit the script you will use, so that the values in the Settings section are correct for your computer.
 +
 
 +
==Windows==
 +
 
 +
==Linux==
 +
 
 +
===Maemo===
 +
If Don get GRAMPS ported to his Nokia N810, a variation of this script ought to work there, too.  That would allow keeping the data on a flash drive, and switching back and forth between PC and N810 GRAMPS.  Please, Don?  :)
 +
 
 +
==GRAMPS 2.2==
 +
 
 +
=========================
  
 
==Jim Sack==
 
==Jim Sack==

Revision as of 05:37, 19 March 2008

Run GRAMPS from a portable drive

Some users want to keep their GRAMPS data on a removable drive, either for portability between computers or for security. This document describes how to accomplish that, and should work whether using a floppy, a flash drive, or an external hard drive. Unfortunately, there are not any easy instructions for installing GRAMPS and its dependencies on a removable drive, so these instructions assume and require that GRAMPS be installed on any computer to which you connect the drive.

How it works

The magic is done in scripts that you use to start GRAMPS. The scripts trick GRAMPS into thinking that your user home directory is on the removable drive instead of in the usual place, so that GRAMPS will read and write its configuration and data there. The process is mostly transparent, but you will probably need to edit the media base path each time you run GRAMPS on a different computer. You may also need to edit some settings in the scripts for different computers. If there are certain computers which you use regularly that need different settings in the scripts, you can easily make separate script copies for each one, to avoid the need to reedit them.

Installation

Save the scripts in the directory you want to use as your GRAMPS home directory on the removable drive. When run, the scripts will direct GRAMPS to the directory they are installed in. Edit the script you will use, so that the values in the Settings section are correct for your computer.

Windows

Linux

Maemo

If Don get GRAMPS ported to his Nokia N810, a variation of this script ought to work there, too. That would allow keeping the data on a flash drive, and switching back and forth between PC and N810 GRAMPS. Please, Don?  :)

GRAMPS 2.2

=============

Jim Sack

Hmmm, have you tried something like starting gramps with some environment variable help?

In *nix, it should even work as from the command line:

HOME=/media/usb_volname/GDB gramps

Or on Windows, maybe a .bat file (some guesswork here -- not tested!)

oup=%USERPROFILE%
set USERPROFILE=e:\GDB
gramps
set USERPROFILE=%oup%

This probably needs more help. Maybe pass the drive letter as a parm.


Anyway, the idea is that the database and preferences would both be in the GDB dir of the removable device.


Dave Walton

Why no, as a matter of fact, I had NOT tried something like that. Nor would I have known which var to mess with. Thanks for the tip!

Using your Windows example as a starting point, I came up with this batch file, which I call gramps.bat:

@echo off

REM Make changes to environment variables local to this block
setlocal

REM Set USERPROFILE to the drive and path of this script
set USERPROFILE=%~dp0

REM Go to this script location for good measure
%~d0
cd "%~p0"

REM I don't know how to locate and start GRAMPS without hardcoding
REM the drive and path for it and Python.
C:\Python25\pythonw.exe "C:\Program Files\gramps\gramps.py"

REM End the local environment block
endlocal

When this script is run, it starts gramps with the profile set to the drive and directory that contains the script. So you attach the drive, double click the batch file, and gramps starts up, no matter which letter the drive got. Assuming windows gramps and all its dependencies are correctly installed on that computer, of course. If I knew how to set up those on the removable drive, too, it'd be perfect. But this path stuff was the most critical part of the problem.

Right now I'm stuck on a loaner computer, but when I get a new one set up I'll be able to do a *nix version, too. They'd also be good content for a "How do I..." on the wiki.


Jim Sack

Yea! That would be great. You might also add an expanded discussion version (or footnotes) explaining the technical/syntax details.

I await the educational opportunity.  :-)


Jim Sack

Benny Malengier wrote:

> > How do I run GRAMPS from a stick?

I think Dave will be explaining it in human language, but here it is in geek:

cp -a ~/.gramps /media/disk/
HOME=/media/disk gramps

when you plug it into someone else's machine, you have to substitute the appropriate mount point on that host for the HOME value.

To accommodate visiting relatives running Windows, you might do

cp -a ~/.gramps/* /media/disk/gramps
USERPROFILE=/media/disk gramps

Well, sorry, but that doesn't quite work in Linux -- it almost does, except for a hardcoded

DATABASE_PATH : '~/.gramps/grampsdb'

in Config/_GrampsConfigKeys.py <maybe that sh/could be fixed?>

You'll probably want to put Dave's batch file to do the trick on the actual Windows system. a dos shortcut file might actually allow the same database to work on Win and Linux. Hmmm, how does one make a shortcut file on (eg) vfat from linux?


Category:How do I...