Stow directory now defaults to STOW_DIR environment variable if set.

This commit is contained in:
Adam Spiers 2011-11-16 16:52:03 +00:00
parent 801446a5eb
commit 090519496c
4 changed files with 15 additions and 13 deletions

View file

@ -49,6 +49,10 @@ Sun Nov 25 19:31:32 2007 Kahlil Hodgson <kahlil@internode.con.net>
* stow.8: update to reflect Version 2 changes. * stow.8: update to reflect Version 2 changes.
Sat Jan 26 16:15:21 2002 Guillaume Morin <gmorin@gnu.org>
* stow.in: if $ENV{'STOW_DIR'} is set, this becomes the default
Stow directory.
Sun Jan 06 12:18:50 2002 Guillaume Morin <gmorin@gnu.org> Sun Jan 06 12:18:50 2002 Guillaume Morin <gmorin@gnu.org>

3
stow.8
View file

@ -146,7 +146,8 @@ The target of a relative symlink is
computed starting from the symlink's own directory. Stow only creates computed starting from the symlink's own directory. Stow only creates
relative symlinks. relative symlinks.
.SH OPTIONS .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 target directory is assumed to be the parent of the current directory
(so it is typical to execute (so it is typical to execute
.I stow .I stow

View file

@ -358,9 +358,10 @@ sub set_stow_path {
my $current_dir = getcwd(); 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'} ) { if (not $Option{'dir'} ) {
$Option{'dir'} = getcwd(); $Option{'dir'} = exists $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd();
} }
if (not chdir($Option{'dir'})) { if (not chdir($Option{'dir'})) {
error("Cannot chdir to target tree: '$Option{'dir'}'"); error("Cannot chdir to target tree: '$Option{'dir'}'");

View file

@ -243,10 +243,6 @@ 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. 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}. 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 @noindent
The following options are supported: The following options are supported:
@ -255,14 +251,14 @@ The following options are supported:
@item -d @var{dir} @item -d @var{dir}
@itemx --dir=@var{dir} @itemx --dir=@var{dir}
Set the stow directory to @var{dir} instead of the current directory. Set the stow directory to @var{dir}. Defaults to the value of the environment
This also has the effect of making the default target directory be the variable @code{STOW_DIR} if set, or the current directory otherwise.
parent of @var{dir}.
@item -t @var{dir} @item -t @var{dir}
@itemx --target=@var{dir} @itemx --target=@var{dir}
Set the target directory to @var{dir} instead of the parent of the stow 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='<regex>' @item --ignore='<regex>'
This (repeatable) option lets you suppress acting on files that match the This (repeatable) option lets you suppress acting on files that match the