From 8c26bfec32441830b4a0e5938a6cc7de1a64ff99 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Mon, 5 May 2014 11:08:02 +0200 Subject: Add a hostname override 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. --- bin/rcup.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/rcup.in') diff --git a/bin/rcup.in b/bin/rcup.in index 849a0f7..8e541e8 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -104,10 +104,12 @@ handle_command_line() { local includes= local always_copy=0 local symlink_dirs= + local hostname= REPLACE_ALL=0 - while getopts CVqvfhikKI:x:S:t:d: opt; do + while getopts CVqvfhikKI:x:S:t:d:B: opt; do case "$opt" in + B) hostname="$OPTARG" ;; C) always_copy=1 ;; d) dotfiles_dirs="$dotfiles_dirs $OPTARG" ;; f) REPLACE_ALL=1 ;; @@ -132,6 +134,7 @@ handle_command_line() { fi handle_common_flags rcup $version $verbosity + hostname="$(determine_hostname "$hostname")" tags="${arg_tags:-$TAGS}" DOTFILES_DIRS="${dotfiles_dirs:-$DOTFILES_DIRS}" @@ -153,7 +156,7 @@ handle_command_line() { for symlink_dir in $symlink_dirs; do LS_ARGS="$LS_ARGS -S $symlink_dir" done - LS_ARGS="$LS_ARGS $files" + LS_ARGS="$LS_ARGS -B $hostname $files" $DEBUG "LS_ARGS: $LS_ARGS" } -- cgit v1.2.3