Commit 0818edd9 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] do not execute sudo commands if not needed

parent 18e5a916
#!/bin/bash
if [ ! -z `which ruby` > /dev/null ]
if [ -z `which scss-lint` > /dev/null ]
then
echo -e "\033[0;34mInstall scss-lint\033[0m";
if [ $OSTYPE == "msys" ]
if [ ! -z `which ruby` > /dev/null ]
then
gem install scss_lint
echo -e "\033[0;34mInstall scss-lint\033[0m";
if [ $OSTYPE == "msys" ]
then
gem install scss_lint
else
sudo gem install scss_lint
fi
else
sudo gem install scss_lint
echo -e "\n\033[0;31mYou need to have ruby installed on your machine in order for scss-lint to work!\033[0m\n";
fi
else
echo -e "\n\033[0;31mYou need to have ruby installed on your machine in order for scss-lint to work!\033[0m\n";
echo -e "\033[0;32mscss-lint already installed ✓\033[0m\n"
fi
......@@ -78,30 +78,35 @@ if [ "$1" == "--local" ]; then
echo -e "\033[0;34mInstall sgc\033[0m";
cp ./core/sgc ../sgc
else
# install cli globally
echo -e "\033[0;34mInstall sgc\033[0m";
if [ $OSTYPE == "msys" ]
if [ -z `which sgc` > /dev/null ]
then
cp ./core/sgc /c/Windows/System32
else
echo -e "\033[0;34mYou need to grant permission in order to install the sgc command\033[0m";
if [ ! -e /usr/local/bin ]
then
sudo mkdir -p /usr/local/bin
fi
sudo cp ./core/sgc /usr/local/bin
if [ -e /etc/bash_completion.d ]
then
# linux autocompletion path
sudo cp ./core/autocompletion.sh /etc/bash_completion.d/sgc
autocompletePath="/etc/bash_completion.d/sgc"
elif [ -e /usr/local/etc/bash_completion.d ]
# install cli globally
echo -e "\033[0;34mInstall sgc\033[0m";
if [ $OSTYPE == "msys" ]
then
# osx autocompletion path; if bash completion is installed
sudo cp ./core/autocompletion.sh /usr/local/etc/bash_completion.d/sgc
autocompletePath="/usr/local/etc/bash_completion.d/sgc"
cp ./core/sgc /c/Windows/System32
else
echo -e "\033[0;34mYou need to grant permission in order to install the sgc command\033[0m";
if [ ! -e /usr/local/bin ]
then
sudo mkdir -p /usr/local/bin
fi
sudo cp ./core/sgc /usr/local/bin
if [ -e /etc/bash_completion.d ]
then
# linux autocompletion path
sudo cp ./core/autocompletion.sh /etc/bash_completion.d/sgc
autocompletePath="/etc/bash_completion.d/sgc"
elif [ -e /usr/local/etc/bash_completion.d ]
then
# osx autocompletion path; if bash completion is installed
sudo cp ./core/autocompletion.sh /usr/local/etc/bash_completion.d/sgc
autocompletePath="/usr/local/etc/bash_completion.d/sgc"
fi
fi
else
echo -e "\033[0;32msgc is already installed globally ✓\033[0m\n"
fi
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment