From 090519496cdb8967b3d2fb7dd0d528486bb7877e Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Wed, 16 Nov 2011 16:52:03 +0000 Subject: [PATCH] Stow directory now defaults to STOW_DIR environment variable if set. --- ChangeLog | 4 ++++ stow.8 | 3 ++- stow.in | 5 +++-- stow.texi | 16 ++++++---------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b513c25..636c7d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,6 +49,10 @@ Sun Nov 25 19:31:32 2007 Kahlil Hodgson * stow.8: update to reflect Version 2 changes. +Sat Jan 26 16:15:21 2002 Guillaume Morin + + * stow.in: if $ENV{'STOW_DIR'} is set, this becomes the default + Stow directory. Sun Jan 06 12:18:50 2002 Guillaume Morin diff --git a/stow.8 b/stow.8 index 339531f..38de9d6 100644 --- a/stow.8 +++ b/stow.8 @@ -146,7 +146,8 @@ The target of a relative symlink is computed starting from the symlink's own directory. Stow only creates relative symlinks. .SH OPTIONS -The stow directory is assumed to be the current directory, and the +The stow directory is assumed to be the value of the 'STOW_DIR' environment +variable or if unset the current directory, and the target directory is assumed to be the parent of the current directory (so it is typical to execute .I stow diff --git a/stow.in b/stow.in index 5ddd4c1..a127a8c 100755 --- a/stow.in +++ b/stow.in @@ -358,9 +358,10 @@ sub set_stow_path { my $current_dir = getcwd(); - # default stow dir is the current directory + # default stow dir is $STOW_DIR if set, otherwise the current + # directory if (not $Option{'dir'} ) { - $Option{'dir'} = getcwd(); + $Option{'dir'} = exists $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd(); } if (not chdir($Option{'dir'})) { error("Cannot chdir to target tree: '$Option{'dir'}'"); diff --git a/stow.texi b/stow.texi index bd7ef5e..0728f3a 100644 --- a/stow.texi +++ b/stow.texi @@ -239,14 +239,10 @@ stow [@var{options}] [@var{action flag}] @var{package @dots{}} @end example @noindent -Each @var{package} is the name of a package (e.g., @samp{perl}) in the stow +Each @var{package} is the name of a package (e.g., @samp{perl}) in the stow directory that we wish to install into (or delete from) the target directory. -The default action is to install the given packages, although alternate actions +The default action is to install the given packages, although alternate actions may be specified by preceding the package name(s) with an @var{action flag}. -Unless otherwise specified, the stow directory is assumed to be -the current directory and the target directory is assumed to be the parent of -the current directory, so it is typical to execute @code{stow} from the -directory @file{/usr/local/stow}. @noindent The following options are supported: @@ -255,14 +251,14 @@ The following options are supported: @item -d @var{dir} @itemx --dir=@var{dir} -Set the stow directory to @var{dir} instead of the current directory. -This also has the effect of making the default target directory be the -parent of @var{dir}. +Set the stow directory to @var{dir}. Defaults to the value of the environment +variable @code{STOW_DIR} if set, or the current directory otherwise. @item -t @var{dir} @itemx --target=@var{dir} Set the target directory to @var{dir} instead of the parent of the stow -directory. +directory. Defaults to the parent of the stow directory, so it is typical to +execute @code{stow} from the directory @file{/usr/local/stow}. @item --ignore='' This (repeatable) option lets you suppress acting on files that match the