X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcore%2Ffunctions.sh;h=9dcfce80b35a5565c50868bf5f8cecb5707b24d9;hb=7c691be10be57164d5338635245572801c8068b3;hp=45980cee8e9b77a9216635bff57b442ee257ea23;hpb=170a8e062d9283e65716e7aa55930ade13a66f7a;p=feisty_meow.git diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 45980cee..9dcfce80 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -388,6 +388,7 @@ if [ -z "$skip_all" ]; then echo "The nechung oracle program cannot be found. You may want to consider" echo "rebuilding the feisty meow applications with this command:" echo "bash $FEISTY_MEOW_SCRIPTS/generator/produce_feisty_meow.sh" + echo else $wheres_nechung fi @@ -772,6 +773,35 @@ 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" + } + + # makes sure that the provided "folder" is a directory and is writable. + function test_writeable() + { + local folder="$1"; shift + if [ ! -d "$folder" -o ! -w "$folder" ]; then return 1; fi + return 0 + } + + ############## + # NOTE: no more function definitions are allowed after this point. function function_sentinel()