| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are several problems leading to the unintentional globbing issue:
Firstly, within `rcup` and `rcdn`, when constructing arguments to pass
to `lsrc`, the _for_ loops over the arguments do not have quoted
variables, leading to globbing. I have quoted these accordingly.
Secondly, `lsrc` is invoked as follows:
```sh
dests_and_srcs="$(lsrc $LS_ARGS)"
```
When shells use command substitution like this, they go through two stages:
- Word expansion. This is useful because it splits `LS_ARGS` back up
into its constituent strings.
- File name expansion. The side effect of this is to introduce globbing.
You can read more about how this works [here](https://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html#sect_03_04_07).
To fix this, I have passed `lsrc` and its arguments to `eval`. This
involves quoting the relevant arguments, so:
```sh
for dotfiles_dir in "$DOTFILES_DIRS"; do
LS_ARGS="$LS_ARGS -d $dotfiles_dir"
done
```
becomes
```sh
for dotfiles_dir in "$DOTFILES_DIRS"; do
LS_ARGS="$LS_ARGS -d \"$dotfiles_dir\""
done
```
Then `lsrc` is invoked as follows:
```sh
dests_and_srcs="$(eval "lsrc $LS_ARGS")"
```
There is one final non-globbing issue: the parsing of arguments can
introduce extra spaces in the variables, which then trip up the
`dotfiles_dir_excludes` function. For example:
```sh
I) includes="$includes $OPTARG";;
```
introduces a space if `includes` is empty or null.
I have introduced the function `append_variable`, which allows two
variables to be appended without introducing unnecessary whitespace.
Then the additional whitespace is never added in the first place.
Fixes #256.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a bug when calling mkrc(1) on a symlink:
```sh
mkrc ~/.vimrc # links ~/.vimrc to ~/.dotfiles/vimrc
mkrc ~/.vimrc # deletes ~/.dotfiles/vimrc
```
This catches that case ahead of time, preventing the user from running
mkrc(1) on a symlink.
Fix #144.
|
|
|
|
|
| |
Still does not expand in every usecase, possibly does not expand in all
DOTFILE_DIRS usecases.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Well, $LOGNAME is defined by POSIX (see
a801c4c58902cae7b835d890487edc39bd7da142) but it's not appearing in
reality under clean environments:
~% env -i /bin/bash
mike:/home/mike$ echo $LOGNAME
mike:/home/mike$ exit
~% env -i /bin/dash
$ echo $LOGNAME
$ exit
~% env -i /bin/ksh
$ echo $LOGNAME
$ exit
~% env -i /usr/bin/zsh
~% echo $LOGNAME
mike
~% exit
Fall back to whoami(1) when $LOGNAME is not set.
Modify one of the tests to run with a restricted environment in order to
test this. I had tried modifying the test-driver to run all tests in a
restricted environment but the test-driver script is generated by
Automake.
Closes #165.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In mkrc, separate the list of files with newlines instead of spaces.
Change the `$IFS` when iterating to handle this.
We hand the file off to rcup, which encodes the file name by replacing
spaces with the bell character (`\a`).
rcup then sends the file name off to lsrc, which decodes the bell back
into a space.
The test makes sure an `a` character is in the filename, in case some
encoding goes wrong. We use tr(1) instead of sed(1) because tr(1)
handles `\a`.
Shoutout to Sublime Text 3 for forcing this issue.
|
|
|
|
|
|
|
| |
Run the hooks in alphabetical order so that people can more predictably
manage their hooks.
While here, clean up the NEWS.md.in.
|
|
|
|
|
|
|
|
|
|
|
| |
The $USER environment variable is not guaranteed to exist, but $LOGNAME
is defined by POSIX[0] (Environment Variables, section 8.3 Other
Environment Variables). Use that instead.
Thanks to Scott Stevenson for pointing out this solution, and Debian for
raising the problem.
[0]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
|
|
|
|
|
| |
Instead of a complex graph, process everything from one Makefile.
Simplify, simplify.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calls `find(1)` with the `-exec` action just like before but instead of `run_hooks()`
letting `find` execute the hook directly it is wrapped in a shell one-liner which
changes to the hook's directory and executes the hook with "./" prepended to its
basename. These changes allow hooks to refer to dotfiles with relative paths.
For instance we can call a Makefile two directories up simply with `make -C ../..`.
Also make sure we are compatible with Solaris' Bourne shell and `find(1)`.
Closes #150. Closes #149.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Solaris 10 lacks readlink(1). Additionally, its different grep(1) and
diff(1) do not take a `-q` flag.
Use a Perl one-liner instead of readlink(1) which is missing on Solaris 10.
Also because /usr/bin/grep and diff(1) don't understand the `-q` option, make
them go quiet by redirecting stdout to `/dev/null` instead.
The Perl dependency only exists in the test suite, so it does not incur
a runtime penalty for end users.
This is to work around the fact that readlink(1) is missing on Solaris.
The tradeoff is: on Solaris, installing third-party software (readlink)
is a pain, whereas on e.g. FreeBSD installing third-party software
(Perl) is simple and common.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Based on issue #82, we now provide `-B` to override the hostname. In
particular:
- `mkrc -B foo` will enable `-o` but with the hostname set up `foo`.
- `lsrc -B foo` will work like normal `lsrc` except it treats `host-foo`
as the host-specific directory.
- `rcup -B foo` will run a normal `rcup` except `host-foo` is the
host-specific directory.
- `rcdn -B foo` is just like normal `rcdn`, but with `host-foo` as the
host-specific directory.
The `HOSTNAME` can also be set in the rcrc(5), and this is overridden by
the aforementioned `-B`.
While making this change: The `test/Makefile.am` used a mix of tabs and
spaces. Since it's a Makefile, replace it all with tabs.
|
|
|
|
| |
This is a thoughtbot project now, so assign copyright to thoughtbot.
|
|
|
|
|
|
|
|
|
| |
This allows, at least, more executables to be picked up.
It doesn't pick up group-executable scripts and ignore xattr files but
it should be better than what was there before.
Closes #80
|
|
|
|
|
| |
This uses a bit of a hack: if `$DEBUG` is set to `:`, then we are not in
debug mode.
|
|
|
|
|
|
|
|
| |
The `rcm.sh` library was treated as a script in the Makefile, which gave
it executable permissions. Treating it as data just installs it as-is.
This fixes rpmlint's `script-without-shebang /usr/share/rcm/rcm.sh`
warning.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The `-v` (verbose) flag for `cp`, `ln`, and `rm` is not standard. It is
simple to implement using shell functions, so introduce `cp_v`, `ln_v`,
and `rm_v`. These shell functions use the existing `$VERBOSE` variable
for printing, which simplifies the code and reduces the number of
variables.
Fixes #61.
|
|
|
|
|
|
| |
It's likely that while shuffling commits for the quoting of "$@" issue,
some lines were kept from both that branch and master resulting in an
invalid state.
|
|
|
|
|
|
|
|
|
| |
* http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08
Fixes #46.
This does not handle quotes around `$@`. That is taken separately in #53.
|
|
|
|
|
|
|
|
|
|
| |
The code was setting the $hook_file variable to
$dotfiles_dir/hooks/$when-$direction outside of the loop which actually
sets the $dotfiles_dir variable to each of the dotfiles directories
being processed in turn. This would lead to (for example) /hooks/post-up
which is not correct.
The fix is to move that logic into the loop.
|
|
|
|
|
|
|
|
|
|
|
| |
It introduces the `Makefile.am` from gitsh, and abstracts it a bit. This
`Makefile.am`, or most of it, could be dropped into gitsh again. How to
use it is documented in `DEVELOPERS.md`.
The whole release process is more consistent and simple: `make release`
to build a tarball, Homebrew, Arch, Debian, HTML (from manpages), and
tag it, pushed to the various repos, and with cleanup. The `release`
target is composed of smaller targets that stack well.
|
|
|
|
|
|
|
| |
We had been relying on `hooks/pre-up` and `hooks/post-up` files to
exist. This explicitly checks first.
Fixes #34.
|
|
|
|
|
|
|
|
| |
Instead of using the non-standard `-s` argument to `hostname`, use `sed`
to split out everything after the first period. This fixes lsrc(1) on
Cygwin, among others.
Fixes #28.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Typically a directory structure is copied instead of symlinked, while
files are symlinked. However, some cases require symlinked dirs: git
submodules, vim plugins, and so on.
This introduces a `SYMLINK_DIRS` option for rcrc(5) that takes a
space-separated list of "exclude patterns". Any directory matching these
patterns is symlinked.
This also introduces a `-S` argument for lsrc(1), rcup(1), and rcdn(1).
This argument takes a pattern, for one-off directory symlinking. It can
be repeated.
This also introduces `-S` and `-s` for mkrc(1). `-S` will re-install the
files as symlinks, and `-s` will not.
This does work with `-C`, though perhaps unintuitively - we don't know
what the user means in this case. However, it will not crash.
Bug: `-s` does not work right if `SYMLINK_DIRS` is set. Bug #36
addresses this.
|
|
|
|
|
| |
If the `pre-up` or `post-up` files are actually directories, run the
executable contents of them in an arbitrary order.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As reported in #23, you can trick `rcup` into installing into `.` with
this `CDPATH`:
export CDPATH=/tmp:.
As described [online][1], it is a mistake to export the `CDPATH`
environment variable to begin with. Since it is a one-liner to work
around it, though, it's worth fixing.
The workaround is to unset `CDPATH` at the beginning of the script. This
does not affect the outside environment, it only affects the script and
its functions.
[1]: http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/
|
|
|
|
|
|
|
|
|
| |
* Centralize configuration loading in rcm.sh(.in)
* Check for readability, not just existence
Add RCRC notes to all manpages. Putting the environment variables in a
table lines them up more neatly and definitively, across all output
formats, and also follows the examples used by e.g. BSD ls(1).
|
| |
|
|
|
|
|
| |
This is what FreeBSD has in its ports tree and is the latest as of 21
June 2013.
|
|
|
|
| |
Running autogen.sh changes these files. Clearly they must be important.
|
|
|
|
|
| |
The hooks can be skipped using `-K`, if needed and they can be forced
with the `-k` flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are programs that, if they exist, will run before or after the
syncronization/removal is run. Three use cases caused this:
1. The thoughtbot dotfiles will run a vundle installation set of
commands after intitial synchronization.
2. I changed the location of `.bash_history` to `.bash/history` and
wanted to move `.bash_history` to `.bash/history` after up to preserve
existing history.
3. Moving from an existing old-style custom install script to `rcup`
might require some cleanup; this happened in practice, and required a
simple script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The suite now honors the `COPY_ALWAYS` option in rcrc(5). This can be
set to a space-separated list of file globs. Any file matching a glob is
copied instead of symlinked. This is handy both for secure programs
(`netrc`, `ssh/id_*`) and for programs that oddly re-write files
(`weechat/*`).
To always copy everything, use the `*` glob.
This is reflected throughout the suite as follows:
* lsrc now has a `-F` option which shows a symbol to indicate whether it
is a symlink (`@`) or a copy (`X`).
* rcdn only removes symlinks unless the file under question matches a
`COPY_ALWAYS` glob, in which case it is removed regardless of whether
it is a symlink.
* rcup will copy instead of symlinking any file that matches any
`COPY_ALWAYS` glob.
|
|
|
|
| |
This is what is in Debian testing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some files prefer to be copies instead of symlinks---for example,
OpenSSH ignores symlinks. Add the `-C` option to mkrc(1) and rcup(1) to
handle this.
mkrc -C .ssh
rcup -C ssh
This does raise a synchronization problem that I do not yet know how to
solve; namely, what to do when the rc file changes. Perhaps a `rcsync`
command is in order; perhaps `rcup` should handle this; perhaps `rcsync`
is a better name for `rcup`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lsrc(1), rcup(1), and rcdn(1) commands now take any number of `-e`
flags, used to specify an exclusion pattern. This can also be controlled
via rcrc(5), the `EXCLUDES` variable.
An exclusion pattern specifies a file glob to skip. In the case of
lsrc(1), any file matching the glob is not listed; in rcup(1) it is not
symlinked; and in rcdn(1) it is not removed.
The file glob can be preceded by the name of a dotfiles directory
(separated from the file glob by a colon) to increase the specificity.
Useful for:
rcdn -e rcrc
rcup -d work-dotfiles -e bashrc
rcup -d ~/.dotfiles -d wife-dotfiles -d sys-dotfiles -e wife-dotfiles:tigrc
|
|
|
|
| |
I'll figure out `make release` someday.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This program will remove all your rc files that are symlinked. This can
be further controlled by `-d` and `-t`.
For example, you can feel comfortable trying new rc files because you
can quickly remove them again with `-d`.
rcup -d thoughtbot-dotfiles
rcdn -d thoughtbot-dotfiles
Likewise, when you're done with Python just drop it:
rcdn -t python
|
|
|
|
|
|
|
|
| |
To make it easier to manage host-specific rc files, `mkrc` now supports
a `-o` option. This causes the specified file to be added to the host
section named for the current machine.
This option is in conflict with the `-t` option.
|
|
|
|
|
|
| |
Pull the `-V`, `-v`, `-q`, `-t`, and `-d` out into the
`handle_common_flags` and `handle_metadata_flags` functions, shared
between the different programs.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `make release` command will build the Debian package, push the
version to a git tag on GitHub, and upload the docs to GitHub pages.
This also adds a `deb` target, along with `build-docs`, `upload-docs`,
`build-tag`, and `push-tag`.
In addition, introduce a `NEWS.md` file.
Both `rcm.sh.in` and `NEWS.md.in` will act as input files. This is to
abstract over the version number.
|
|
|
|
|
|
| |
The Makefile.in generated from automake 1.14 is backward compatible, but
not forward compatible. This allows it to build on more systems, such as
Arch and OS X.
|
|
|
|
|
|
|
|
|
| |
The following command can generate a Debian package:
debuild -us uc
The directory structure and tarball must be perfectly set up first. This
is documented in `DEVELOPERS.md`.
|
|
|
|
| |
Replace the `Makefile` with a `configure.ac` and a set of `Makefile.am`.
|
|
|
|
|
| |
The `man` and `share` directories in this project had an unnecessarily
deeply nested structure. Flatten it.
|
|
The `/usr/local/libexec` standard looks awkward on Debian, so after
careful and sad evaluation we've concluded that we do not, in fact,
execute the `rcm.sh` library. Move it to `/usr/local/share` instead.
|