diff --git a/install.sh b/install.sh index 7070b41..757e6f9 100755 --- a/install.sh +++ b/install.sh @@ -51,6 +51,19 @@ die () { exit "$st" } +############ +### Check for network connection +########### +echo -e "\nChecking for internet connection...\n" +ping -c 3 github.com +rcode=$? +if [ $? -ne 0]; then + echo "------------------------------------" + echo "Unable to detect internet connection. Please check your connectivity and try again" + exit 1 +fi +echo -e "Success!\n" + ############ ### Check whether installer is up-to-date ############ diff --git a/update-tools-repo.sh b/update-tools-repo.sh index 8656069..69e3d7c 100755 --- a/update-tools-repo.sh +++ b/update-tools-repo.sh @@ -3,11 +3,12 @@ unset CDPATH myPath="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )" cd "$myPath" +username=$(logname) active_branch=$(git symbolic-ref -q HEAD) active_branch=${active_branch##refs/heads/} -git fetch +sudo -u $username git fetch changes=$(git log HEAD..origin/"$active_branch" --oneline) if [ -z "$changes" ]; then