From: Chris Koeritz Date: Thu, 9 Nov 2017 16:40:37 +0000 (-0500) Subject: refactoring some good core funcs from rev control X-Git-Tag: 2.140.90~24 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=9756fee21152847f27a2514d2bac32cee03db9ac refactoring some good core funcs from rev control --- diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 45980cee..4991adf8 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -772,6 +772,27 @@ return 0 ############## + # echoes the machine's hostname. can be used like so: + # local my_host=$(get_hostname) + function get_hostname() + { + # there used to be more variation in how to do this, but adopting mingw + # and cygwin tools really helped out. + local this_host=unknown + if [ "$OS" == "Windows_NT" ]; then + this_host=$(hostname) + elif [ ! -z "$(echo $MACHTYPE | grep apple)" ]; then + this_host=$(hostname) + elif [ ! -z "$(echo $MACHTYPE | grep suse)" ]; then + this_host=$(hostname --long) + elif [ -x "$(which hostname 2>/dev/null)" ]; then + this_host=$(hostname) + fi + echo "$this_host" + } + + ############## + # NOTE: no more function definitions are allowed after this point. function function_sentinel() diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 01ca3c56..bd3f960e 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -44,21 +44,6 @@ function get_our_hostname() #echo "hostname is $this_host" } -# this function sets a variable called "home_system" to "true" if the -# machine is considered one of fred's home machines. if you are not -# fred, you may want to change the machine choices. -function is_home_system() -{ - # load up the name of the host. - get_our_hostname - # reset the variable that we'll be setting. - unset home_system - export home_system - if [[ $this_host == *.gruntose.blurgh ]]; then - home_system=true - fi -} - #hmmm: move to core. # makes sure that the "folder" is a directory and is writable. # remember that bash successful returns are zeroes...