summaryrefslogtreecommitdiff
path: root/bin/mkrc
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2013-08-05 06:15:17 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2013-08-05 06:15:17 +0200
commitfc648042ca2e753b8ecdabc5fa52aea5313c3b03 (patch)
treee69c2dba330066ef1ddc5725d97ab0b336ef5783 /bin/mkrc
parent122bbf0c6da226fc7e8a7e2a8d173b3e6259f7cf (diff)
Add -C for copying files
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`.
Diffstat (limited to 'bin/mkrc')
-rwxr-xr-xbin/mkrc20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/mkrc b/bin/mkrc
index d3effb8..d8ed478 100755
--- a/bin/mkrc
+++ b/bin/mkrc
@@ -35,15 +35,17 @@ tag=
verbosity=0
in_host=0
version=0
+always_copy=0
-while getopts Vvqot:d: opt; do
+while getopts CVvqot:d: opt; do
case "$opt" in
- t) tag=$OPTARG;;
- v) verbosity=$(($verbosity + 1));;
- q) verbosity=$(($verbosity - 1));;
- o) in_host=1;;
- d) DOTFILES_DIR=$OPTARG;;
- V) version=1
+ C) always_copy=1 ;;
+ t) tag=$OPTARG ;;
+ v) verbosity=$(($verbosity + 1)) ;;
+ q) verbosity=$(($verbosity - 1)) ;;
+ o) in_host=1 ;;
+ d) DOTFILES_DIR=$OPTARG ;;
+ V) version=1 ;;
esac
done
shift $(($OPTIND-1))
@@ -54,6 +56,10 @@ if [ $in_host -eq 1 -a "x$tag" != "x" ]; then
$ERROR 1 "Cannot specify both -o and -t"
fi
+if [ $always_copy -eq 1 ]; then
+ INSTALL="$INSTALL -C"
+fi
+
files=$@
for file in $files; do