From fc648042ca2e753b8ecdabc5fa52aea5313c3b03 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Mon, 5 Aug 2013 06:15:17 +0200 Subject: 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`. --- bin/mkrc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'bin/mkrc') 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 -- cgit v1.2.3