2001-12-24 09:57:46 -05:00
|
|
|
#!@PERL@
|
|
|
|
|
2016-11-21 09:56:26 -05:00
|
|
|
# GNU Stow - manage farms of symbolic links
|
2001-12-30 12:56:45 -05:00
|
|
|
# Copyright (C) 1993, 1994, 1995, 1996 by Bob Glickstein
|
2011-11-16 09:04:03 -05:00
|
|
|
# Copyright (C) 2000, 2001 Guillaume Morin
|
|
|
|
# Copyright (C) 2007 Kahlil Hodgson
|
2011-11-24 11:52:50 -05:00
|
|
|
# Copyright (C) 2011 Adam Spiers
|
2011-11-16 09:04:03 -05:00
|
|
|
#
|
2019-06-27 09:02:19 -04:00
|
|
|
# This file is part of GNU Stow.
|
|
|
|
#
|
|
|
|
# GNU Stow is free software: you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2001-12-24 09:57:46 -05:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2019-06-27 09:02:19 -04:00
|
|
|
# GNU Stow is distributed in the hope that it will be useful, but
|
2001-12-24 09:57:46 -05:00
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
2019-06-27 09:02:19 -04:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-12-24 09:57:46 -05:00
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2019-06-27 09:02:19 -04:00
|
|
|
# along with this program. If not, see https://www.gnu.org/licenses/.
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-11-24 11:52:50 -05:00
|
|
|
=head1 NAME
|
|
|
|
|
2016-11-21 09:56:26 -05:00
|
|
|
stow - manage farms of symbolic links
|
2011-11-24 11:52:50 -05:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
stow [ options ] package ...
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2016-11-21 09:56:26 -05:00
|
|
|
This manual page describes GNU Stow @VERSION@. This is not the
|
|
|
|
definitive documentation for Stow; for that, see the accompanying info
|
|
|
|
manual, e.g. by typing C<info stow>.
|
|
|
|
|
|
|
|
Stow is a symlink farm manager which takes distinct sets of software
|
|
|
|
and/or data located in separate directories on the filesystem, and
|
|
|
|
makes them all appear to be installed in a single directory tree.
|
|
|
|
|
|
|
|
Originally Stow was born to address the need to administer, upgrade,
|
|
|
|
install, and remove files in independent software packages without
|
|
|
|
confusing them with other files sharing the same file system space.
|
|
|
|
For instance, many years ago it used to be common to compile programs
|
|
|
|
such as Perl and Emacs from source. By using Stow, F</usr/local/bin>
|
|
|
|
could contain symlinks to files within F</usr/local/stow/emacs/bin>,
|
|
|
|
F</usr/local/stow/perl/bin> etc., and likewise recursively for any
|
|
|
|
other subdirectories such as F<.../share>, F<.../man>, and so on.
|
|
|
|
|
|
|
|
While this is useful for keeping track of system-wide and per-user
|
|
|
|
installations of software built from source, in more recent times
|
|
|
|
software packages are often managed by more sophisticated package
|
|
|
|
management software such as rpm, dpkg, and Nix / GNU Guix, or
|
|
|
|
language-native package managers such as Ruby's gem, Python's pip,
|
|
|
|
Javascript's npm, and so on.
|
|
|
|
|
|
|
|
However Stow is still used not only for software package management,
|
|
|
|
but also for other purposes, such as facilitating a more controlled
|
|
|
|
approach to management of configuration files in the user's home
|
|
|
|
directory, especially when coupled with version control systems.
|
2011-11-24 11:52:50 -05:00
|
|
|
|
|
|
|
Stow was inspired by Carnegie Mellon's Depot program, but is
|
|
|
|
substantially simpler and safer. Whereas Depot required database files
|
|
|
|
to keep things in sync, Stow stores no extra state between runs, so
|
|
|
|
there's no danger (as there was in Depot) of mangling directories when
|
|
|
|
file hierarchies don't match the database. Also unlike Depot, Stow
|
|
|
|
will never delete any files, directories, or links that appear in a
|
|
|
|
Stow directory (e.g., F</usr/local/stow/emacs>), so it's always
|
|
|
|
possible to rebuild the target tree (e.g., F</usr/local>).
|
|
|
|
|
2016-11-21 09:56:26 -05:00
|
|
|
Stow is implemented as a combination of a Perl script providing a CLI
|
|
|
|
interface, and a backend Perl module which does most of the work.
|
|
|
|
|
2011-11-24 11:52:50 -05:00
|
|
|
=head1 TERMINOLOGY
|
|
|
|
|
|
|
|
A "package" is a related collection of files and directories that
|
|
|
|
you wish to administer as a unit -- e.g., Perl or Emacs -- and that
|
|
|
|
needs to be installed in a particular directory structure -- e.g.,
|
|
|
|
with F<bin>, F<lib>, and F<man> subdirectories.
|
|
|
|
|
|
|
|
A "target directory" is the root of a tree in which one or more
|
|
|
|
packages wish to B<appear> to be installed. A common, but by no means
|
|
|
|
the only such location is F</usr/local>. The examples in this manual
|
|
|
|
page will use F</usr/local> as the target directory.
|
|
|
|
|
|
|
|
A "stow directory" is the root of a tree containing separate
|
|
|
|
packages in private subtrees. When Stow runs, it uses the current
|
|
|
|
directory as the default stow directory. The examples in this manual
|
|
|
|
page will use F</usr/local/stow> as the stow directory, so that
|
|
|
|
individual packages will be, for example, F</usr/local/stow/perl> and
|
|
|
|
F</usr/local/stow/emacs>.
|
|
|
|
|
|
|
|
An "installation image" is the layout of files and directories
|
|
|
|
required by a package, relative to the target directory. Thus, the
|
|
|
|
installation image for Perl includes: a F<bin> directory containing
|
|
|
|
F<perl> and F<a2p> (among others); an F<info> directory containing
|
|
|
|
Texinfo documentation; a F<lib/perl> directory containing Perl
|
|
|
|
libraries; and a F<man/man1> directory containing man pages.
|
|
|
|
|
|
|
|
A "package directory" is the root of a tree containing the
|
|
|
|
installation image for a particular package. Each package directory
|
|
|
|
must reside in a stow directory -- e.g., the package directory
|
|
|
|
F</usr/local/stow/perl> must reside in the stow directory
|
|
|
|
F</usr/local/stow>. The "name" of a package is the name of its
|
|
|
|
directory within the stow directory -- e.g., F<perl>.
|
|
|
|
|
|
|
|
Thus, the Perl executable might reside in
|
|
|
|
F</usr/local/stow/perl/bin/perl>, where F</usr/local> is the target
|
|
|
|
directory, F</usr/local/stow> is the stow directory,
|
|
|
|
F</usr/local/stow/perl> is the package directory, and F<bin/perl>
|
|
|
|
within is part of the installation image.
|
|
|
|
|
|
|
|
A "symlink" is a symbolic link. A symlink can be "relative" or
|
|
|
|
"absolute". An absolute symlink names a full path; that is, one
|
|
|
|
starting from F</>. A relative symlink names a relative path; that
|
|
|
|
is, one not starting from F</>. The target of a relative symlink is
|
|
|
|
computed starting from the symlink's own directory. Stow only creates
|
|
|
|
relative symlinks.
|
|
|
|
|
|
|
|
=head1 OPTIONS
|
|
|
|
|
|
|
|
The stow directory is assumed to be the value of the C<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 F<stow> from the directory F</usr/local/stow>).
|
|
|
|
Each F<package> given on the command line is the name of a package in
|
|
|
|
the stow directory (e.g., F<perl>). By default, they are installed
|
|
|
|
into the target directory (but they can be deleted instead using
|
|
|
|
C<-D>).
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item -n
|
|
|
|
|
|
|
|
=item --no
|
|
|
|
|
|
|
|
Do not perform any operations that modify the filesystem; merely show
|
2011-11-24 15:47:39 -05:00
|
|
|
what would happen.
|
2011-11-24 11:52:50 -05:00
|
|
|
|
|
|
|
=item -d DIR
|
|
|
|
|
|
|
|
=item --dir=DIR
|
|
|
|
|
|
|
|
Set the stow directory to C<DIR> instead of the current directory.
|
|
|
|
This also has the effect of making the default target directory be the
|
|
|
|
parent of C<DIR>.
|
|
|
|
|
|
|
|
=item -t DIR
|
|
|
|
|
|
|
|
=item --target=DIR
|
|
|
|
|
|
|
|
Set the target directory to C<DIR> instead of the parent of the stow
|
|
|
|
directory.
|
|
|
|
|
|
|
|
=item -v
|
|
|
|
|
|
|
|
=item --verbose[=N]
|
|
|
|
|
|
|
|
Send verbose output to standard error describing what Stow is
|
2016-12-18 18:10:13 -05:00
|
|
|
doing. Verbosity levels are from 0 to 5; 0 is the default.
|
2011-11-24 11:52:50 -05:00
|
|
|
Using C<-v> or C<--verbose> increases the verbosity by one; using
|
|
|
|
`--verbose=N' sets it to N.
|
|
|
|
|
|
|
|
=item -S
|
|
|
|
|
|
|
|
=item --stow
|
|
|
|
|
|
|
|
Stow the packages that follow this option into the target directory.
|
|
|
|
This is the default action and so can be omitted if you are only
|
|
|
|
stowing packages rather than performing a mixture of
|
|
|
|
stow/delete/restow actions.
|
|
|
|
|
|
|
|
=item -D
|
|
|
|
|
|
|
|
=item --delete
|
|
|
|
|
|
|
|
Unstow the packages that follow this option from the target directory rather
|
|
|
|
than installing them.
|
|
|
|
|
|
|
|
=item -R
|
|
|
|
|
|
|
|
=item --restow
|
|
|
|
|
|
|
|
Restow packages (first unstow, then stow again). This is useful
|
|
|
|
for pruning obsolete symlinks from the target tree after updating
|
|
|
|
the software in a package.
|
|
|
|
|
2012-01-09 16:25:35 -05:00
|
|
|
=item --adopt
|
|
|
|
|
|
|
|
B<Warning!> This behaviour is specifically intended to alter the
|
|
|
|
contents of your stow directory. If you do not want that, this option
|
|
|
|
is not for you.
|
|
|
|
|
|
|
|
When stowing, if a target is encountered which already exists but is a
|
|
|
|
plain file (and hence not owned by any existing stow package), then
|
|
|
|
normally Stow will register this as a conflict and refuse to proceed.
|
|
|
|
This option changes that behaviour so that the file is moved to the
|
|
|
|
same relative place within the package's installation image within the
|
|
|
|
stow directory, and then stowing proceeds as before. So effectively,
|
|
|
|
the file becomes adopted by the stow package, without its contents
|
|
|
|
changing.
|
|
|
|
|
2012-02-18 15:13:32 -05:00
|
|
|
=item --no-folding
|
|
|
|
|
|
|
|
Disable folding of newly stowed directories when stowing, and
|
|
|
|
refolding of newly foldable directories when unstowing.
|
|
|
|
|
2011-11-24 11:52:50 -05:00
|
|
|
=item --ignore=REGEX
|
|
|
|
|
|
|
|
Ignore files ending in this Perl regex.
|
|
|
|
|
|
|
|
=item --defer=REGEX
|
|
|
|
|
|
|
|
Don't stow files beginning with this Perl regex if the file is already
|
|
|
|
stowed to another package.
|
|
|
|
|
|
|
|
=item --override=REGEX
|
|
|
|
|
|
|
|
Force stowing files beginning with this Perl regex if the file is
|
|
|
|
already stowed to another package.
|
|
|
|
|
2016-07-31 16:55:55 -04:00
|
|
|
=item --dotfiles
|
|
|
|
|
|
|
|
Enable special handling for "dotfiles" (files or folders whose name
|
|
|
|
begins with a period) in the package directory. If this option is
|
|
|
|
enabled, Stow will add a preprocessing step for each file or folder
|
|
|
|
whose name begins with "dot-", and replace the "dot-" prefix in the
|
|
|
|
name by a period (.). This is useful when Stow is used to manage
|
|
|
|
collections of dotfiles, to avoid having a package directory full of
|
|
|
|
hidden files.
|
|
|
|
|
|
|
|
For example, suppose we have a package containing two files,
|
|
|
|
F<stow/dot-bashrc> and F<stow/dot-emacs.d/init.el>. With this option,
|
|
|
|
Stow will create symlinks from F<.bashrc> to F<stow/dot-bashrc> and
|
|
|
|
from F<.emacs.d/init.el> to F<stow/dot-emacs.d/init.el>. Any other
|
|
|
|
files, whose name does not begin with "dot-", will be processed as usual.
|
|
|
|
|
2011-11-24 11:52:50 -05:00
|
|
|
=item -V
|
|
|
|
|
|
|
|
=item --version
|
|
|
|
|
|
|
|
Show Stow version number, and exit.
|
|
|
|
|
|
|
|
=item -h
|
|
|
|
|
|
|
|
=item --help
|
|
|
|
|
|
|
|
Show Stow command syntax, and exit.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 INSTALLING PACKAGES
|
|
|
|
|
|
|
|
The default action of Stow is to install a package. This means
|
|
|
|
creating symlinks in the target tree that point into the package tree.
|
|
|
|
Stow attempts to do this with as few symlinks as possible; in other
|
|
|
|
words, if Stow can create a single symlink that points to an entire
|
|
|
|
subtree within the package tree, it will choose to do that rather than
|
|
|
|
create a directory in the target tree and populate it with symlinks.
|
|
|
|
|
|
|
|
For example, suppose that no packages have yet been installed in
|
|
|
|
F</usr/local>; it's completely empty (except for the F<stow>
|
|
|
|
subdirectory, of course). Now suppose the Perl package is installed.
|
|
|
|
Recall that it includes the following directories in its installation
|
|
|
|
image: F<bin>; F<info>; F<lib/perl>; F<man/man1>. Rather than
|
|
|
|
creating the directory F</usr/local/bin> and populating it with
|
|
|
|
symlinks to F<../stow/perl/bin/perl> and F<../stow/perl/bin/a2p> (and
|
|
|
|
so on), Stow will create a single symlink, F</usr/local/bin>, which
|
|
|
|
points to F<stow/perl/bin>. In this way, it still works to refer to
|
|
|
|
F</usr/local/bin/perl> and F</usr/local/bin/a2p>, and fewer symlinks
|
|
|
|
have been created. This is called "tree folding", since an entire
|
|
|
|
subtree is "folded" into a single symlink.
|
|
|
|
|
|
|
|
To complete this example, Stow will also create the symlink
|
|
|
|
F</usr/local/info> pointing to F<stow/perl/info>; the symlink
|
|
|
|
F</usr/local/lib> pointing to F<stow/perl/lib>; and the symlink
|
|
|
|
F</usr/local/man> pointing to F<stow/perl/man>.
|
|
|
|
|
|
|
|
Now suppose that instead of installing the Perl package into an empty
|
|
|
|
target tree, the target tree is not empty to begin with. Instead, it
|
|
|
|
contains several files and directories installed under a different
|
|
|
|
system-administration philosophy. In particular, F</usr/local/bin>
|
|
|
|
already exists and is a directory, as are F</usr/local/lib> and
|
|
|
|
F</usr/local/man/man1>. In this case, Stow will descend into
|
|
|
|
F</usr/local/bin> and create symlinks to F<../stow/perl/bin/perl> and
|
|
|
|
F<../stow/perl/bin/a2p> (etc.), and it will descend into
|
|
|
|
F</usr/local/lib> and create the tree-folding symlink F<perl> pointing
|
|
|
|
to F<../stow/perl/lib/perl>, and so on. As a rule, Stow only descends
|
|
|
|
as far as necessary into the target tree when it can create a
|
|
|
|
tree-folding symlink.
|
|
|
|
|
|
|
|
The time often comes when a tree-folding symlink has to be undone
|
|
|
|
because another package uses one or more of the folded subdirectories
|
|
|
|
in its installation image. This operation is called "splitting open"
|
|
|
|
a folded tree. It involves removing the original symlink from the
|
|
|
|
target tree, creating a true directory in its place, and then
|
|
|
|
populating the new directory with symlinks to the newly-installed
|
|
|
|
package B<and> to the old package that used the old symlink. For
|
|
|
|
example, suppose that after installing Perl into an empty
|
|
|
|
F</usr/local>, we wish to install Emacs. Emacs's installation image
|
|
|
|
includes a F<bin> directory containing the F<emacs> and F<etags>
|
|
|
|
executables, among others. Stow must make these files appear to be
|
|
|
|
installed in F</usr/local/bin>, but presently F</usr/local/bin> is a
|
|
|
|
symlink to F<stow/perl/bin>. Stow therefore takes the following
|
|
|
|
steps: the symlink F</usr/local/bin> is deleted; the directory
|
|
|
|
F</usr/local/bin> is created; links are made from F</usr/local/bin> to
|
|
|
|
F<../stow/emacs/bin/emacs> and F<../stow/emacs/bin/etags>; and links
|
|
|
|
are made from F</usr/local/bin> to F<../stow/perl/bin/perl> and
|
|
|
|
F<../stow/perl/bin/a2p>.
|
|
|
|
|
|
|
|
When splitting open a folded tree, Stow makes sure that the symlink
|
|
|
|
it is about to remove points inside a valid package in the current stow
|
|
|
|
directory.
|
|
|
|
|
|
|
|
=head2 Stow will never delete anything that it doesn't own.
|
|
|
|
|
|
|
|
Stow "owns" everything living in the target tree that points into a
|
|
|
|
package in the stow directory. Anything Stow owns, it can recompute if
|
|
|
|
lost. Note that by this definition, Stow doesn't "own" anything
|
|
|
|
B<in> the stow directory or in any of the packages.
|
|
|
|
|
|
|
|
If Stow needs to create a directory or a symlink in the target tree
|
|
|
|
and it cannot because that name is already in use and is not owned by
|
|
|
|
Stow, then a conflict has arisen. See the "Conflicts" section in the
|
|
|
|
info manual.
|
|
|
|
|
|
|
|
=head1 DELETING PACKAGES
|
|
|
|
|
|
|
|
When the C<-D> option is given, the action of Stow is to delete a
|
|
|
|
package from the target tree. Note that Stow will not delete anything
|
|
|
|
it doesn't "own". Deleting a package does B<not> mean removing it from
|
|
|
|
the stow directory or discarding the package tree.
|
|
|
|
|
|
|
|
To delete a package, Stow recursively scans the target tree, skipping
|
|
|
|
over the stow directory (since that is usually a subdirectory of the
|
|
|
|
target tree) and any other stow directories it encounters (see
|
|
|
|
"Multiple stow directories" in the info manual). Any symlink it
|
|
|
|
finds that points into the package being deleted is removed. Any
|
|
|
|
directory that contained only symlinks to the package being deleted is
|
|
|
|
removed. Any directory that, after removing symlinks and empty
|
|
|
|
subdirectories, contains only symlinks to a single other package, is
|
|
|
|
considered to be a previously "folded" tree that was "split open."
|
|
|
|
Stow will re-fold the tree by removing the symlinks to the surviving
|
|
|
|
package, removing the directory, then linking the directory back to
|
|
|
|
the surviving package.
|
|
|
|
|
2016-07-14 15:48:40 -04:00
|
|
|
=head1 RESOURCE FILES
|
|
|
|
|
|
|
|
F<Stow> searches for default command line options at F<.stowrc> (current
|
|
|
|
directory) and F<~/.stowrc> (home directory) in that order. If both
|
|
|
|
locations are present, the files are effectively appended together.
|
|
|
|
|
|
|
|
The effect of options in the resource file is similar to simply prepending
|
|
|
|
the options to the command line. For options that provide a single value,
|
|
|
|
such as F<--target> or F<--dir>, the command line option will overwrite any
|
|
|
|
options in the resource file. For options that can be given more than once,
|
|
|
|
F<--ignore> for example, command line options and resource options are
|
|
|
|
appended together.
|
|
|
|
|
|
|
|
Environment variables and the tilde character (F<~>) will be expanded for
|
|
|
|
options that take a file path.
|
|
|
|
|
|
|
|
The options F<-D>, F<-R>, F<-S>, and any packages listed in the resource
|
|
|
|
file are ignored.
|
|
|
|
|
|
|
|
See the info manual for more information on how stow handles resource
|
|
|
|
file.
|
|
|
|
|
2011-11-24 11:52:50 -05:00
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
The full documentation for F<stow> is maintained as a Texinfo manual.
|
|
|
|
If the F<info> and F<stow> programs are properly installed at your site, the command
|
|
|
|
|
|
|
|
info stow
|
|
|
|
|
|
|
|
should give you access to the complete manual.
|
|
|
|
|
|
|
|
=head1 BUGS
|
|
|
|
|
|
|
|
Please report bugs in Stow using the Debian bug tracking system.
|
|
|
|
|
|
|
|
Currently known bugs include:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item * The empty-directory problem.
|
|
|
|
|
|
|
|
If package F<foo> includes an empty directory -- say, F<foo/bar> --
|
|
|
|
then if no other package has a F<bar> subdirectory, everything's fine.
|
|
|
|
If another stowed package F<quux>, has a F<bar> subdirectory, then
|
|
|
|
when stowing, F<targetdir/bar> will be "split open" and the contents
|
|
|
|
of F<quux/bar> will be individually stowed. So far, so good. But when
|
|
|
|
unstowing F<quux>, F<targetdir/bar> will be removed, even though
|
|
|
|
F<foo/bar> needs it to remain. A workaround for this problem is to
|
|
|
|
create a file in F<foo/bar> as a placeholder. If you name that file
|
|
|
|
F<.placeholder>, it will be easy to find and remove such files when
|
|
|
|
this bug is fixed.
|
|
|
|
|
|
|
|
=item *
|
|
|
|
|
|
|
|
When using multiple stow directories (see "Multiple stow directories"
|
|
|
|
in the info manual), Stow fails to "split open" tree-folding symlinks
|
|
|
|
(see "Installing packages" in the info manual) that point into a stow
|
|
|
|
directory which is not the one in use by the current Stow
|
|
|
|
command. Before failing, it should search the target of the link to
|
|
|
|
see whether any element of the path contains a F<.stow> file. If it
|
|
|
|
finds one, it can "learn" about the cooperating stow directory to
|
|
|
|
short-circuit the F<.stow> search the next time it encounters a
|
|
|
|
tree-folding symlink.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
This man page was originally constructed by Charles Briscoe-Smith from
|
|
|
|
parts of Stow's info manual, and then converted to POD format by Adam
|
|
|
|
Spiers. The info manual contains the following notice, which, as it
|
|
|
|
says, applies to this manual page, too. The text of the section
|
|
|
|
entitled "GNU General Public License" can be found in the file
|
|
|
|
F</usr/share/common-licenses/GPL> on any Debian GNU/Linux system. If
|
|
|
|
you don't have access to a Debian system, or the GPL is not there,
|
|
|
|
write to the Free Software Foundation, Inc., 59 Temple Place, Suite
|
|
|
|
330, Boston, MA, 02111-1307, USA.
|
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
|
|
|
Copyright (C)
|
|
|
|
1993, 1994, 1995, 1996 by Bob Glickstein <bobg+stow@zanshin.com>;
|
|
|
|
2000, 2001 by Guillaume Morin;
|
|
|
|
2007 by Kahlil Hodgson;
|
|
|
|
2011 by Adam Spiers;
|
|
|
|
and others.
|
|
|
|
|
|
|
|
Permission is granted to make and distribute verbatim copies of this
|
|
|
|
manual provided the copyright notice and this permission notice are
|
|
|
|
preserved on all copies.
|
|
|
|
|
|
|
|
Permission is granted to copy and distribute modified versions of this
|
|
|
|
manual under the conditions for verbatim copying, provided also that
|
|
|
|
the section entitled "GNU General Public License" is included with the
|
|
|
|
modified manual, and provided that the entire resulting derived work
|
|
|
|
is distributed under the terms of a permission notice identical to
|
|
|
|
this one.
|
|
|
|
|
|
|
|
Permission is granted to copy and distribute translations of this
|
|
|
|
manual into another language, under the above conditions for modified
|
|
|
|
versions, except that this permission notice may be stated in a
|
|
|
|
translation approved by the Free Software Foundation.
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2001-12-24 09:57:46 -05:00
|
|
|
|
2012-05-16 06:00:38 -04:00
|
|
|
require 5.006_001;
|
2011-11-16 10:22:12 -05:00
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
use POSIX qw(getcwd);
|
2016-06-24 17:34:13 -04:00
|
|
|
use Getopt::Long qw(GetOptionsFromArray);
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-12-07 15:28:28 -05:00
|
|
|
@USE_LIB_PMDIR@
|
2011-11-24 11:28:09 -05:00
|
|
|
use Stow;
|
2012-07-08 20:05:27 -04:00
|
|
|
use Stow::Util qw(parent error);
|
2011-11-24 11:28:09 -05:00
|
|
|
|
2016-07-01 21:07:28 -04:00
|
|
|
use Hash::Merge qw( merge );
|
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
my $ProgramName = $0;
|
|
|
|
$ProgramName =~ s{.*/}{};
|
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
main() unless caller();
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
sub main {
|
|
|
|
my ($options, $pkgs_to_unstow, $pkgs_to_stow) = process_options();
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
my $stow = new Stow(%$options);
|
2011-11-16 09:04:03 -05:00
|
|
|
# current dir is now the target directory
|
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
$stow->plan_unstow(@$pkgs_to_unstow);
|
|
|
|
$stow->plan_stow (@$pkgs_to_stow);
|
|
|
|
|
2011-11-24 17:49:22 -05:00
|
|
|
my %conflicts = $stow->get_conflicts;
|
|
|
|
|
|
|
|
if (%conflicts) {
|
|
|
|
foreach my $action ('unstow', 'stow') {
|
|
|
|
next unless $conflicts{$action};
|
|
|
|
foreach my $package (sort keys %{ $conflicts{$action} }) {
|
|
|
|
warn "WARNING! ${action}ing $package would cause conflicts:\n";
|
|
|
|
#if $stow->get_action_count > 1;
|
|
|
|
foreach my $message (sort @{ $conflicts{$action}{$package} }) {
|
|
|
|
warn " * $message\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
warn "All operations aborted.\n";
|
2011-11-24 15:47:39 -05:00
|
|
|
exit 1;
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
else {
|
2011-11-24 15:47:39 -05:00
|
|
|
if ($options->{simulate}) {
|
|
|
|
warn "WARNING: in simulation mode so not modifying filesystem.\n";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
$stow->process_tasks();
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
2001-12-24 09:57:46 -05:00
|
|
|
}
|
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
|
|
|
|
#===== SUBROUTINE ===========================================================
|
|
|
|
# Name : process_options()
|
2016-06-24 17:34:13 -04:00
|
|
|
# Purpose : Parse and process command line and .stowrc file options
|
2011-11-16 09:04:03 -05:00
|
|
|
# Parameters: none
|
2011-11-24 11:28:09 -05:00
|
|
|
# Returns : (\%options, \@pkgs_to_unstow, \@pkgs_to_stow)
|
2016-06-24 17:34:13 -04:00
|
|
|
# Throws : a fatal error if a bad option is given
|
2011-11-16 09:04:03 -05:00
|
|
|
# Comments : checks @ARGV for valid package names
|
|
|
|
#============================================================================
|
|
|
|
sub process_options {
|
2016-07-01 21:07:28 -04:00
|
|
|
# Get cli options.
|
|
|
|
my ($cli_options,
|
2016-06-24 17:34:13 -04:00
|
|
|
$pkgs_to_unstow,
|
|
|
|
$pkgs_to_stow) = parse_options(@ARGV);
|
|
|
|
|
2016-07-01 21:07:28 -04:00
|
|
|
# Get the .stowrc options.
|
|
|
|
# Note that rc_pkgs_to_unstow and rc_pkgs_to_stow are ignored.
|
|
|
|
my ($rc_options,
|
|
|
|
$rc_pkgs_to_unstow,
|
|
|
|
$rc_pkgs_to_stow) = get_config_file_options();
|
|
|
|
|
|
|
|
# Merge .stowrc and command line options.
|
|
|
|
# Preference is given to cli options.
|
|
|
|
# rc options come first in merged arrays.
|
|
|
|
# cli options overwrite conflicting rc options.
|
|
|
|
Hash::Merge::set_behavior('RIGHT_PRECEDENT');
|
|
|
|
my $options = merge($rc_options, $cli_options);
|
|
|
|
|
|
|
|
# Run checks on the merged options.
|
2016-06-24 17:34:13 -04:00
|
|
|
sanitize_path_options($options);
|
|
|
|
check_packages($pkgs_to_unstow, $pkgs_to_stow);
|
|
|
|
|
2016-07-01 21:07:28 -04:00
|
|
|
# Return merged and processed options.
|
2016-06-24 17:34:13 -04:00
|
|
|
return ($options, $pkgs_to_unstow, $pkgs_to_stow);
|
|
|
|
}
|
|
|
|
|
|
|
|
#===== SUBROUTINE ===========================================================
|
|
|
|
# Name : parse_options()
|
|
|
|
# Purpose : parse command line options
|
|
|
|
# Parameters: @arg_array => array of options to parse
|
|
|
|
# Example: parse_options(@ARGV)
|
|
|
|
# Returns : (\%options, \@pkgs_to_unstow, \@pkgs_to_stow)
|
|
|
|
# Throws : a fatal error if a bad command line option is given
|
|
|
|
# Comments : Used for parsing both command line options and rc file. Used
|
|
|
|
# for parsing only. Sanity checks and post-processing belong in
|
|
|
|
# process_options().
|
|
|
|
#============================================================================
|
|
|
|
sub parse_options {
|
2011-11-24 11:28:09 -05:00
|
|
|
my %options = ();
|
|
|
|
my @pkgs_to_unstow = ();
|
|
|
|
my @pkgs_to_stow = ();
|
|
|
|
my $action = 'stow';
|
|
|
|
|
2016-06-24 17:34:13 -04:00
|
|
|
#$,="\n"; print @_,"\n"; # for debugging rc file
|
2011-11-16 09:04:03 -05:00
|
|
|
|
|
|
|
Getopt::Long::config('no_ignore_case', 'bundling', 'permute');
|
2016-06-24 17:34:13 -04:00
|
|
|
GetOptionsFromArray(
|
|
|
|
\@_,
|
2011-11-24 11:28:09 -05:00
|
|
|
\%options,
|
2011-11-24 15:47:39 -05:00
|
|
|
'verbose|v:+', 'help|h', 'simulate|n|no',
|
2011-11-17 09:12:12 -05:00
|
|
|
'version|V', 'compat|p', 'dir|d=s', 'target|t=s',
|
2016-07-31 16:55:55 -04:00
|
|
|
'adopt', 'no-folding', 'dotfiles',
|
2011-11-16 09:04:03 -05:00
|
|
|
|
|
|
|
# clean and pre-compile any regex's at parse time
|
2011-11-21 08:59:36 -05:00
|
|
|
'ignore=s' =>
|
2011-11-24 11:28:09 -05:00
|
|
|
sub {
|
2011-11-26 11:32:25 -05:00
|
|
|
my $regex = $_[1];
|
2011-11-23 19:45:29 -05:00
|
|
|
push @{$options{ignore}}, qr($regex\z);
|
2011-11-16 09:04:03 -05:00
|
|
|
},
|
|
|
|
|
2011-11-21 08:59:36 -05:00
|
|
|
'override=s' =>
|
|
|
|
sub {
|
2011-11-26 11:32:25 -05:00
|
|
|
my $regex = $_[1];
|
2011-11-23 19:45:29 -05:00
|
|
|
push @{$options{override}}, qr(\A$regex);
|
2011-11-16 09:04:03 -05:00
|
|
|
},
|
|
|
|
|
2011-11-21 08:59:36 -05:00
|
|
|
'defer=s' =>
|
|
|
|
sub {
|
2011-11-26 11:32:25 -05:00
|
|
|
my $regex = $_[1];
|
2011-11-23 19:45:29 -05:00
|
|
|
push @{$options{defer}}, qr(\A$regex);
|
2011-11-16 09:04:03 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
# a little craziness so we can do different actions on the same line:
|
2011-11-21 08:59:36 -05:00
|
|
|
# a -D, -S, or -R changes the action that will be performed on the
|
2011-11-16 09:04:03 -05:00
|
|
|
# package arguments that follow it.
|
2011-11-24 11:28:09 -05:00
|
|
|
'D|delete' => sub { $action = 'unstow' },
|
|
|
|
'S|stow' => sub { $action = 'stow' },
|
|
|
|
'R|restow' => sub { $action = 'restow' },
|
|
|
|
|
|
|
|
# Handler for non-option arguments
|
2011-11-21 08:59:36 -05:00
|
|
|
'<>' =>
|
2011-11-16 09:04:03 -05:00
|
|
|
sub {
|
2011-11-24 11:28:09 -05:00
|
|
|
if ($action eq 'restow') {
|
|
|
|
push @pkgs_to_unstow, $_[0];
|
|
|
|
push @pkgs_to_stow, $_[0];
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
2011-11-24 11:28:09 -05:00
|
|
|
elsif ($action eq 'unstow') {
|
|
|
|
push @pkgs_to_unstow, $_[0];
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
else {
|
2011-11-24 11:28:09 -05:00
|
|
|
push @pkgs_to_stow, $_[0];
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
},
|
2019-06-25 08:44:35 -04:00
|
|
|
) or usage('');
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-11-23 19:45:29 -05:00
|
|
|
usage() if $options{help};
|
|
|
|
version() if $options{version};
|
2011-11-24 11:28:09 -05:00
|
|
|
|
|
|
|
return (\%options, \@pkgs_to_unstow, \@pkgs_to_stow);
|
|
|
|
}
|
|
|
|
sub sanitize_path_options {
|
|
|
|
my ($options) = @_;
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2015-11-12 23:57:21 -05:00
|
|
|
unless (exists $options->{dir}) {
|
2015-11-11 07:25:19 -05:00
|
|
|
$options->{dir} = length $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd();
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
|
2015-11-11 07:25:19 -05:00
|
|
|
usage("--dir value '$options->{dir}' is not a valid directory")
|
|
|
|
unless -d $options->{dir};
|
|
|
|
|
2011-11-23 19:45:29 -05:00
|
|
|
if (exists $options->{target}) {
|
2015-11-11 07:25:19 -05:00
|
|
|
usage("--target value '$options->{target}' is not a valid directory")
|
|
|
|
unless -d $options->{target};
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
2011-11-24 11:28:09 -05:00
|
|
|
else {
|
2011-12-01 11:23:04 -05:00
|
|
|
$options->{target} = parent($options->{dir}) || '.';
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
2011-11-24 11:28:09 -05:00
|
|
|
}
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
sub check_packages {
|
|
|
|
my ($pkgs_to_stow, $pkgs_to_unstow) = @_;
|
|
|
|
|
|
|
|
if (not @$pkgs_to_stow and not @$pkgs_to_unstow) {
|
|
|
|
usage("No packages to stow or unstow");
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# check package arguments
|
2011-11-24 11:28:09 -05:00
|
|
|
for my $package (@$pkgs_to_stow, @$pkgs_to_unstow) {
|
2011-11-16 09:04:03 -05:00
|
|
|
$package =~ s{/+$}{}; # delete trailing slashes
|
2011-11-17 09:17:24 -05:00
|
|
|
if ($package =~ m{/}) {
|
2011-11-16 09:04:03 -05:00
|
|
|
error("Slashes are not permitted in package names");
|
|
|
|
}
|
|
|
|
}
|
2001-12-24 09:57:46 -05:00
|
|
|
}
|
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
#===== SUBROUTINE ============================================================
|
2011-11-21 08:59:36 -05:00
|
|
|
# Name : get_config_file_options()
|
2011-11-24 11:28:09 -05:00
|
|
|
# Purpose : search for default settings in any .stowrc files
|
2011-11-16 09:04:03 -05:00
|
|
|
# Parameters: none
|
2016-07-01 21:07:28 -04:00
|
|
|
# Returns : (\%rc_options, \@rc_pkgs_to_unstow, \@rc_pkgs_to_stow)
|
|
|
|
# Throws : a fatal error if a bad option is given
|
|
|
|
# Comments : Parses the contents of '~/.stowrc' and '.stowrc' with the same
|
2016-07-14 12:37:42 -04:00
|
|
|
# parser as the command line options. Additionally expands any
|
2016-07-14 15:48:40 -04:00
|
|
|
# environment variables or ~ character in --target or --dir
|
|
|
|
# options.
|
2011-11-16 09:04:03 -05:00
|
|
|
#=============================================================================
|
2011-11-24 11:28:09 -05:00
|
|
|
sub get_config_file_options {
|
2011-11-16 09:04:03 -05:00
|
|
|
my @defaults = ();
|
2019-04-03 11:48:15 -04:00
|
|
|
my @dirlist = ('.stowrc');
|
|
|
|
if (defined($ENV{HOME})) {
|
|
|
|
unshift(@dirlist, "$ENV{HOME}/.stowrc");
|
|
|
|
}
|
|
|
|
for my $file (@dirlist) {
|
2011-11-17 09:17:24 -05:00
|
|
|
if (-r $file) {
|
2011-11-21 08:59:36 -05:00
|
|
|
open my $FILE, '<', $file
|
2011-11-16 09:04:03 -05:00
|
|
|
or die "Could not open $file for reading\n";
|
2011-11-17 09:17:24 -05:00
|
|
|
while (my $line = <$FILE>){
|
2011-11-16 09:04:03 -05:00
|
|
|
chomp $line;
|
|
|
|
push @defaults, split " ", $line;
|
|
|
|
}
|
|
|
|
close $FILE or die "Could not close open file: $file\n";
|
|
|
|
}
|
|
|
|
}
|
2016-07-14 12:37:42 -04:00
|
|
|
|
|
|
|
# Parse the options
|
|
|
|
my ($rc_options, $rc_pkgs_to_unstow, $rc_pkgs_to_stow) = parse_options(@defaults);
|
|
|
|
|
|
|
|
# Expand environment variables and glob characters.
|
|
|
|
if (exists $rc_options->{target}) {
|
|
|
|
$rc_options->{target} =
|
2016-07-14 15:48:40 -04:00
|
|
|
expand_filepath($rc_options->{target}, '--target option');
|
2016-07-14 12:37:42 -04:00
|
|
|
}
|
|
|
|
if (exists $rc_options->{dir}) {
|
|
|
|
$rc_options->{dir} =
|
2016-07-14 15:48:40 -04:00
|
|
|
expand_filepath($rc_options->{dir}, '--dir option');
|
2016-07-14 12:37:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($rc_options, $rc_pkgs_to_unstow, $rc_pkgs_to_stow);
|
|
|
|
}
|
|
|
|
|
2016-07-14 15:48:40 -04:00
|
|
|
#===== SUBROUTINE ============================================================
|
|
|
|
# Name : expand_filepath()
|
|
|
|
# Purpose : Handles expansions that need to be applied to
|
|
|
|
# : file paths. Currently expands environment
|
|
|
|
# : variables and the tilde.
|
|
|
|
# Parameters: $path => string to perform expansion on.
|
|
|
|
# : $source => where the string came from
|
|
|
|
# Returns : String with replacements performed.
|
|
|
|
# Throws : n/a
|
|
|
|
# Comments : n/a
|
|
|
|
#=============================================================================
|
|
|
|
sub expand_filepath {
|
|
|
|
my ($path, $source) = @_;
|
|
|
|
|
|
|
|
$path = expand_environment($path, $source);
|
|
|
|
$path = expand_tilde($path);
|
|
|
|
|
|
|
|
return $path;
|
|
|
|
}
|
|
|
|
|
2016-07-14 12:37:42 -04:00
|
|
|
#===== SUBROUTINE ============================================================
|
|
|
|
# Name : expand_environment()
|
|
|
|
# Purpose : Expands evironment variables.
|
|
|
|
# Parameters: $path => string to perform expansion on.
|
|
|
|
# : $source => where the string came from
|
|
|
|
# Returns : String with replacements performed.
|
|
|
|
# Throws : n/a
|
|
|
|
# Comments : Variable replacement mostly based on SO answer
|
|
|
|
# : http://stackoverflow.com/a/24675093/558820
|
|
|
|
#=============================================================================
|
|
|
|
sub expand_environment {
|
|
|
|
my ($path, $source) = @_;
|
|
|
|
# Replace non-escaped $VAR and ${VAR} with $ENV{VAR}
|
|
|
|
# If $ENV{VAR} does not exist, perl will raise a warning
|
|
|
|
# and then happily treat it as an empty string.
|
|
|
|
$path =~ s/(?<!\\)\$\{((?:\w|\s)+)\}/
|
|
|
|
_safe_expand_env_var($1, $source)
|
|
|
|
/ge;
|
|
|
|
$path =~ s/(?<!\\)\$(\w+)/
|
|
|
|
_safe_expand_env_var($1, $source)
|
|
|
|
/ge;
|
|
|
|
# Remove \$ escapes.
|
|
|
|
$path =~ s/\\\$/\$/g;
|
|
|
|
return $path;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub _safe_expand_env_var {
|
|
|
|
my ($var, $source) = @_;
|
|
|
|
unless (exists $ENV{$var}) {
|
|
|
|
die "$source references undefined environment variable \$$var; " .
|
|
|
|
"aborting!\n";
|
|
|
|
}
|
|
|
|
return $ENV{$var};
|
2011-11-21 08:59:36 -05:00
|
|
|
}
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2016-07-14 15:48:40 -04:00
|
|
|
#===== SUBROUTINE ============================================================
|
|
|
|
# Name : expand_tilde()
|
|
|
|
# Purpose : Expands tilde to user's home directory path.
|
|
|
|
# Parameters: $path => string to perform expansion on.
|
|
|
|
# Returns : String with replacements performed.
|
|
|
|
# Throws : n/a
|
|
|
|
# Comments : http://docstore.mik.ua/orelly/perl4/cook/ch07_04.htm
|
|
|
|
#=============================================================================
|
|
|
|
sub expand_tilde {
|
|
|
|
my ($path) = @_;
|
|
|
|
# Replace tilde with home path.
|
|
|
|
$path =~ s{ ^ ~ ( [^/]* ) }
|
|
|
|
{ $1
|
|
|
|
? (getpwnam($1))[7]
|
|
|
|
: ( $ENV{HOME} || $ENV{LOGDIR}
|
|
|
|
|| (getpwuid($<))[7]
|
|
|
|
)
|
|
|
|
}ex;
|
|
|
|
# Replace espaced tilde with regular tilde.
|
|
|
|
$path =~ s/\\~/~/g;
|
|
|
|
return $path
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-16 09:04:03 -05:00
|
|
|
#===== SUBROUTINE ===========================================================
|
|
|
|
# Name : usage()
|
|
|
|
# Purpose : print program usage message and exit
|
2011-11-17 11:35:57 -05:00
|
|
|
# Parameters: $msg => string to prepend to the usage message
|
2011-11-21 08:59:36 -05:00
|
|
|
# Returns : n/a
|
2011-11-16 09:04:03 -05:00
|
|
|
# Throws : n/a
|
|
|
|
# Comments : if 'msg' is given, then exit with non-zero status
|
|
|
|
#============================================================================
|
2001-12-24 09:57:46 -05:00
|
|
|
sub usage {
|
2011-11-16 09:04:03 -05:00
|
|
|
my ($msg) = @_;
|
|
|
|
|
|
|
|
if ($msg) {
|
2016-07-01 21:07:28 -04:00
|
|
|
warn "$ProgramName: $msg\n\n";
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
print <<"EOT";
|
2011-11-24 11:28:09 -05:00
|
|
|
$ProgramName (GNU Stow) version $Stow::VERSION
|
2011-11-16 09:04:03 -05:00
|
|
|
|
|
|
|
SYNOPSIS:
|
|
|
|
|
|
|
|
$ProgramName [OPTION ...] [-D|-S|-R] PACKAGE ... [-D|-S|-R] PACKAGE ...
|
|
|
|
|
|
|
|
OPTIONS:
|
|
|
|
|
|
|
|
-d DIR, --dir=DIR Set stow dir to DIR (default is current dir)
|
|
|
|
-t DIR, --target=DIR Set target to DIR (default is parent of stow dir)
|
|
|
|
|
|
|
|
-S, --stow Stow the package names that follow this option
|
|
|
|
-D, --delete Unstow the package names that follow this option
|
|
|
|
-R, --restow Restow (like stow -D followed by stow -S)
|
|
|
|
|
2011-12-06 20:20:07 -05:00
|
|
|
--ignore=REGEX Ignore files ending in this Perl regex
|
|
|
|
--defer=REGEX Don't stow files beginning with this Perl regex
|
2011-11-16 09:04:03 -05:00
|
|
|
if the file is already stowed to another package
|
2011-12-06 20:20:07 -05:00
|
|
|
--override=REGEX Force stowing files beginning with this Perl regex
|
2011-11-16 09:04:03 -05:00
|
|
|
if the file is already stowed to another package
|
2012-02-18 09:20:07 -05:00
|
|
|
--adopt (Use with care!) Import existing files into stow package
|
2012-02-18 09:15:14 -05:00
|
|
|
from target. Please read docs before using.
|
2012-02-18 09:11:33 -05:00
|
|
|
-p, --compat Use legacy algorithm for unstowing
|
|
|
|
|
|
|
|
-n, --no, --simulate Do not actually make any filesystem changes
|
2016-12-18 18:10:13 -05:00
|
|
|
-v, --verbose[=N] Increase verbosity (levels are from 0 to 5;
|
2012-02-18 09:11:33 -05:00
|
|
|
-v or --verbose adds 1; --verbose=N sets level)
|
2011-11-16 09:04:03 -05:00
|
|
|
-V, --version Show stow version number
|
|
|
|
-h, --help Show this help
|
2011-12-06 10:41:33 -05:00
|
|
|
|
|
|
|
Report bugs to: bug-stow\@gnu.org
|
|
|
|
Stow home page: <http://www.gnu.org/software/stow/>
|
|
|
|
General help using GNU software: <http://www.gnu.org/gethelp/>
|
2001-12-24 09:57:46 -05:00
|
|
|
EOT
|
2011-11-24 11:28:09 -05:00
|
|
|
exit defined $msg ? 1 : 0;
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
|
2011-11-24 11:28:09 -05:00
|
|
|
sub version {
|
|
|
|
print "$ProgramName (GNU Stow) version $Stow::VERSION\n";
|
|
|
|
exit 0;
|
2011-11-16 09:04:03 -05:00
|
|
|
}
|
|
|
|
|
2011-12-11 08:23:37 -05:00
|
|
|
1; # This file is required by t/stow.t
|
2011-11-16 09:04:03 -05:00
|
|
|
|
2001-12-24 09:57:46 -05:00
|
|
|
# Local variables:
|
|
|
|
# mode: perl
|
2011-11-17 09:12:14 -05:00
|
|
|
# cperl-indent-level: 4
|
|
|
|
# end:
|
2011-11-16 09:04:03 -05:00
|
|
|
# vim: ft=perl
|