From 2bbec714424be60364a62b605f64c3587bb6825c Mon Sep 17 00:00:00 2001 From: Sean Henderson Date: Sun, 19 Aug 2018 12:39:18 -0700 Subject: [PATCH] Support capital 'Darwin' $OSTYPE On some macOS environments, the `$OSTYPE` environment variable is 'Darwin' (capitalized) and not 'darwin'. This caused the install script to echo "OS Darwin is not supported!" and exit, even if everything was in fact in order. This patch uses a case-insensitive regex against a [standard bash operator](1) to allow any `$OSTYPE` that starts with 'Darwin' or 'darwin'. All other instances of conditional checks for darwin* are also patched across the code base. [1]: https://www.gnu.org/software/bash/manual/bash.html#index-_005d_005d --- bin/run | 2 +- install | 4 ++-- uninstall | 2 +- update | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/run b/bin/run index 804a137..f40b2a2 100755 --- a/bin/run +++ b/bin/run @@ -60,7 +60,7 @@ if [[ $OSTYPE == "linux-gnu" ]]; then cat $TMPFILE | xclip -selection clipboard # OSX -elif [[ $OSTYPE == "darwin"* ]]; then +elif [[ $OSTYPE =~ [Dd]+arwin[.]* ]]; then # if there is no path file, it must have been deleted or the installer failed require_file_exists $AW_PATH/.path \ "Please reinstall vim-anywhere." diff --git a/install b/install index a26dc62..6775938 100755 --- a/install +++ b/install @@ -75,7 +75,7 @@ if [[ $OSTYPE == "linux-gnu" ]]; then require_installed xclip # OSX specific checks -elif [[ $OSTYPE == "darwin"* ]]; then +elif [[ $OSTYPE =~ [Dd]+arwin[.]* ]]; then require_installed mvim 'Run `brew install macvim`.' # Unsupported OS @@ -120,7 +120,7 @@ if [[ $OSTYPE == "linux-gnu" ]]; then fi # OSX install -elif [[ $OSTYPE == "darwin"* ]]; then +elif [[ $OSTYPE =~ [Dd]+arwin[.]* ]]; then # store the absolute path to the mvim executable which mvim > $AW_PATH/.path diff --git a/uninstall b/uninstall index a9f1201..bf6725e 100755 --- a/uninstall +++ b/uninstall @@ -49,7 +49,7 @@ if [[ $OSTYPE == "linux-gnu" ]]; then fi # OSX uninstall -elif [[ $OSTYPE == "darwin"* ]]; then +elif [[ $OSTYPE =~ [Dd]+arwin[.]* ]]; then rm -rf $HOME/Library/Services/VimAnywhere.workflow fi diff --git a/update b/update index b2f244b..da77d39 100755 --- a/update +++ b/update @@ -47,7 +47,7 @@ pushd $AW_PATH popd # OSX only -if [[ $OSTYPE == "darwin"* ]]; then +if [[ $OSTYPE =~ [Dd]+arwin[.]* ]]; then cp -R $AW_PATH/VimAnywhere.workflow $HOME/Library/Services fi