summaryrefslogtreecommitdiff
path: root/bin/mkrc.in
diff options
context:
space:
mode:
authorGravatar Christopher Koch <ckoch@cs.nmt.edu>2014-07-23 00:03:27 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2014-11-19 15:20:30 -0800
commit8d6bc1fc7b14d26589a4789dc9da291ef404bd61 (patch)
tree9429cd6340cd0436bb678a6ab16ed882aac6fef2 /bin/mkrc.in
parent6f011c7fab8d407ec0cd091e9cbeb03c276372ce (diff)
Support rc files without leading dots
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.
Diffstat (limited to 'bin/mkrc.in')
-rwxr-xr-xbin/mkrc.in20
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/mkrc.in b/bin/mkrc.in
index 8932926..da22a63 100755
--- a/bin/mkrc.in
+++ b/bin/mkrc.in
@@ -23,7 +23,7 @@ destination() {
show_help() {
local exit_code=${1:-0}
- $PRINT "Usage: mkrc [-ChSsVvqo] [-t TAG] [-d DIR] [-B HOSTNAME] FILES ..."
+ $PRINT "Usage: mkrc [-ChSsUuVvqo] [-t TAG] [-d DIR] [-B HOSTNAME] FILES ..."
$PRINT "see mkrc(1) and rcm(7) for more details"
exit $exit_code
@@ -44,9 +44,10 @@ in_host=0
version=0
always_copy=0
force_symlink=50
+undotted=50
install_args=
-while getopts :ChSsVvqot:d:B: opt; do
+while getopts :ChSsUuVvqot:d:B: opt; do
case "$opt" in
C) always_copy=1 ;;
h) show_help ;;
@@ -58,6 +59,8 @@ while getopts :ChSsVvqot:d:B: opt; do
V) version=1 ;;
S) force_symlink=1 ;;
s) force_symlink=0 ;;
+ U) undotted=1 ;;
+ u) undotted=0 ;;
B)
in_host=1
hostname="$OPTARG"
@@ -93,11 +96,24 @@ elif [ $force_symlink -eq 0 ]; then
done
fi
+if [ $undotted -eq 1 ]; then
+ for file in $files; do
+ dedotted="$(de_dot "$file")"
+ INSTALL="$INSTALL -U $dedotted"
+ done
+elif [ $undotted -eq 0 ]; then
+ for file in $files; do
+ dedotted="$(de_dot "$file")"
+ INSTALL="$INSTALL -u $dedotted"
+ done
+fi
+
for file in $files; do
case "$file" in
/*) : ;;
*) [ -e "$PWD/$file" ] && file="$PWD/$file" ;;
esac
+
dotless="$(de_dot "$file")"
dest="$(destination "$DOTFILES_DIR" "$dotless" $in_host "$tag")"
mkdir -p "$dest/$(dirname "$dotless")"