diff --git a/install.sh b/install.sh index 13edc20b..56bd67e6 100755 --- a/install.sh +++ b/install.sh @@ -76,8 +76,11 @@ if [ $upgrade -eq 1 -a $makerfaire2018 -eq 0 -a -d ${home_dir}/wm8960 ]; then echo "Updating sound driver - 2/14" > /tmp/pynab.upgrade cd ${home_dir}/wm8960 sudo chown -R ${owner} .git - pull=`git pull` - if [ "$pull" != "Already up to date." ]; then + # First we want to be sure we know everything from the remote branch status + git fetch + # Then we can check if the status considers our clone behind the remote (or not) + if git status --branch --porcelain | grep -q "\[behind"; then + git pull # Making sure we update the clone to the latest before rebuilding make && sudo make install && make clean sudo touch /tmp/pynab.upgrade.reboot fi @@ -88,8 +91,11 @@ if [ $upgrade -eq 1 ]; then if [ -d ${home_dir}/tagtagtag-ears ]; then cd ${home_dir}/tagtagtag-ears sudo chown -R ${owner} .git - pull=`git pull` - if [ "$pull" != "Already up to date." ]; then + # First we want to be sure we know everything from the remote branch status + git fetch + # Then we can check if the status considers our clone behind the remote (or not) + if git status --branch --porcelain | grep -q "\[behind"; then + git pull # Making sure we update the clone to the latest before rebuilding make && sudo make install && make clean sudo touch /tmp/pynab.upgrade.reboot fi @@ -112,8 +118,11 @@ if [ $upgrade -eq 1 ]; then if [ -d ${home_dir}/cr14 ]; then cd ${home_dir}/cr14 sudo chown -R ${owner} .git - pull=`git pull` - if [ "$pull" != "Already up to date." ]; then + # First we want to be sure we know everything from the remote branch status + git fetch + # Then we can check if the status considers our clone behind the remote (or not) + if git status --branch --porcelain | grep -q "\[behind"; then + git pull # Making sure we update the clone to the latest before rebuilding make && sudo make install && make clean sudo touch /tmp/pynab.upgrade.reboot fi @@ -136,8 +145,11 @@ if [ $upgrade -eq 1 ]; then if [ -d ${root_dir}/nabblockly ]; then cd ${root_dir}/nabblockly sudo chown -R ${owner} . - pull=`git pull` - if [ "$pull" != "Already up to date." ]; then + # First we want to be sure we know everything from the remote branch status + git fetch + # Then we can check if the status considers our clone behind the remote (or not) + if git status --branch --porcelain | grep -q "\[behind"; then + git pull # Making sure we update the clone to the latest before rebuilding ./rebar3 release fi else diff --git a/upgrade.sh b/upgrade.sh index 5a904280..33f0231f 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -25,7 +25,7 @@ case $step in done sudo systemctl stop nabd.socket || echo -n "" sudo systemctl stop nabd.service || echo -n "" - + sudo -u ${owner} touch /tmp/pynab.upgrade sudo chown ${owner} /tmp/pynab.upgrade echo "Updating code - 1/?" > /tmp/pynab.upgrade @@ -35,7 +35,7 @@ case $step in else git pull fi - + bash upgrade.sh "install" ;; "install")