+function whichable()
+{
+ local to_find="$1";
+ shift;
+ local WHICHER="$(/usr/bin/which which 2>/dev/null)";
+ if [ $? -ne 0 ]; then
+ echo;
+ return 2;
+ fi;
+ local sporkenz;
+ sporkenz=$($WHICHER "$to_find" 2>/dev/null);
+ local err=$?;
+ echo $sporkenz;
+ return $err
+}
+
+####
+
+#hmmm: copy to mainline scripts.
+function apt_cyg_finder()
+{
+ if whichable apt-cyg; then
+ return 0 # success.
+#hmmm: is that the right syntax for bash?
+ else
+ echo "
+The apt-cyg tool does not seem to be available for cygwin.
+Please follow the install instructions at:
+ https://github.com/transcode-open/apt-cyg
+"
+ return 13 # not found.
+ fi
+}
+
+####
+
+#hmmm: copy to mainline scripts also.
+# figures out what kind of installation packager application is
+# used on this machine and invokes it to install the list of
+# packages provided as parameters.
+function install_system_package()
+{
+ local packages=("${@}")
+ # pull out the array of packages from the command line.
+ if [ ! -z "$IS_DARWIN" ]; then
+ # macos based...
+echo "installing for darwin"
+ if ! whichable brew; then
+ echo "Could not locate the brew installation system."
+ echo "Please install brew, which is required for MacOS feisty meow installs."
+ return 1
+ fi
+ brew install "${packages[@]}"
+ return $?
+ elif whichable apt; then
+ # ubuntu or debian or other apt-based OSes...
+echo "installing for apt"
+ sudo apt install "${packages[@]}"
+ return $?
+ elif whichable yum; then
+ # rpm based with yum available...
+echo "installing for yum"
+ sudo yum install "${packages[@]}"
+ return $?
+ elif [ "$OS" == "Windows_NT" ]; then
+ # windows-based with cygwin (or we'll fail out currently).
+echo "installing for apt-cyg"
+ if apt_cyg_finder; then
+ apt-cyg install perl-File-Which perl-Text-Diff
+ return $?
+ else
+ echo "apt-cyg is not currently available on this system. please install cygwin and apt-cyg."
+ return 1
+ fi
+ else
+ echo "Unknown installer application for this platform."
+ return 1
+ fi
+}
+
+####
+