| 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.
|
|
|
|
| |
This commit fixes #197.
|
|
|
|
|
|
|
|
|
|
|
| |
The `[` command, which is a builtin for dash, does not understand the
`==` operator; this should be `=` instead.
While here, more quotes in more places, including around `$*`.
`CONFIG_SHELL=/bin/dash ./configure && make check` reports no failed test.
Closes #200.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Edge case: a file is a copy of a dotfile but is not linked. In this case
we should link it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
- Make sure IFS in rcup and rcdn isn't left in an incorrect state when
the output of lsrc is empty.
- Add tests to check that hooks run on rcdn and rcup by default.
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the `-U` option to lsrc(1), rcup(1), and rcdn(1) commands; its
argument is an exclusion pattern. Any file matching this pattern is
symlinked without the leading dot.
There is also a `-u` option to undo a `-U`. The `UNDOTTED` setting in
rcrc(5) can be used to set it permanently.
The mkrc(1) command has `-U` and `-u` flags. They take no argument.
|
|
|
|
|
|
|
|
| |
Various flags were missing from usage messages across the system; `-g`
and `-s` were the most notable ones. Add them to the appropriate usage
messages.
Spotted by Christopher Koch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds a `-g` flag to rcup(1) to generate a standalone shell
script. This shell script can then be run again, even on different
computers, to recreate the symlinks.
This allows people to recreate the "download my dotfiles and run
./install.sh" instructions, but with generated code that they do not
need to maintain.
This provides us more freedom with lsrc(1): since rcm can be used to
generate a universal shell script, lsrc(1) now can be harder to install
-- it can depend on a compiler, for example -- because you only need to
install it on one machine.
The generated script is rather limited; this can be improved in future
commits, as desired.
|
|
|
|
|
|
|
|
| |
This adds a `-s` that can be used to override the `SYMLINK_DIRS` config,
or the `-S` flag, to lsrc(1), mkrc(1), rcup(1), and rcdn(1).
The `-s` flag is the opposite of -S: any argument, if it is a directory,
is not symlinked but instead recurred down.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lsrc(1), mkrc(1), rcup(1), and rcdn(1) commands will now print a
usage message and exit immediately (with 64, `EX_USAGE`) when given an
option it does not understand.
This includes `--version` and `--help`.
Normal `-h` will print usage and exit successfully, as normal.
Closes #59.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New flags have accumulated without proper care for the usage
instructions or man pages.
I manually went through each program and verified its usage instruction
against its `getopts`, then I alphabeticalized the usage message.
Based on the usage message, I then verified the synposis in the manpage.
Then, based on the synposis, I alphabeticalized the detailed listing of
the arguments and filled in the missing pieces. The `-h` and `-V`
arguments were missing from all manpages.
In the future we will need to be more careful about this. It would be
good to automate a checker that refuses to build unless the docs have
all the flags mentioned.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
Under Solaris, use ksh instead of `/bin/sh`.
This uses `$SHELL` as a POSIX shell, coupled with a `configure` check
that sets it correctly.
Note that the POSIX shell might end up being bash, so this actually
introduces more fragmentation than it reduces.
Taken from https://github.com/freedreno/mesa/blob/master/configure.ac
|