summaryrefslogtreecommitdiff
path: root/bin/rcdn.in
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2014-05-05 11:08:02 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2014-05-07 10:43:12 +0200
commit8c26bfec32441830b4a0e5938a6cc7de1a64ff99 (patch)
tree5b22c7195b76f67a79fe4bd763f02faa5bd20e39 /bin/rcdn.in
parentc9d180900a3f8e54b456c9e71bfaac930bbc2478 (diff)
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.
Diffstat (limited to 'bin/rcdn.in')
-rwxr-xr-xbin/rcdn.in7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/rcdn.in b/bin/rcdn.in
index 2ca6dae..e633f3e 100755
--- a/bin/rcdn.in
+++ b/bin/rcdn.in
@@ -37,10 +37,12 @@ handle_command_line() {
local excludes=
local includes=
local symlink_dirs=
+ local hostname=
- while getopts VqvhI:x:S:t:d: opt; do
+ while getopts VqvhI:x:S:t:d:B: opt; do
case "$opt" in
h) show_help ;;
+ B) hostname="$OPTARG" ;;
I) includes="$includes $OPTARG";;
k) run_hooks=1 ;;
K) run_hooks=0 ;;
@@ -56,6 +58,7 @@ handle_command_line() {
shift $(($OPTIND-1))
handle_common_flags rcup $version $verbosity
+ hostname="$(determine_hostname "$hostname")"
tags="${arg_tags:-$TAGS}"
dotfiles_dirs="${dotfiles_dirs:-$DOTFILES_DIRS}"
@@ -77,7 +80,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"
}