@@ -12,7 +12,6 @@ YELLOW='\033[0;33m'
1212RED=' \033[0;31m'
1313NC=' \033[0m' # No Color
1414
15- _AUTO_UPDATE_=N
1615_NEED_INSTALL_=0
1716_PLUGINS_CHANGE_=0
1817
@@ -345,10 +344,10 @@ function startupNode() {
345344function checkAndCleanAutoUpdate() {
346345 ps -ef | grep " $IOTEX_HOME /bin/auto-update" | grep -v grep > /dev/null 2>&1
347346 if [ $? -eq 0 ]; then
347+ echo -e " ${YELLOW} ****** Detect the auto-update is running , it will stop and clean ******* ${NC} "
348348 pid=$( ps -ef | grep " $IOTEX_HOME /bin/auto-update" | grep -v grep | awk ' {print $2}' )
349349 kill -9 $pid > /dev/null 2>&1
350350 rm -f $IOTEX_HOME /bin/auto-update $IOTEX_HOME /bin/update_silence.sh
351- _AUTO_UPDATE_=Y
352351 fi
353352}
354353
@@ -382,16 +381,6 @@ function main() {
382381
383382 # Interactive setup phase
384383 read -p " Do you want to monitor the status of the node [Y/N] (Default: N)? " wantmonitor
385- if [ " ${_AUTO_UPDATE_} X" != " YX" ]; then
386- read -p " Do you want to auto update the node [Y/N] (Default: N)? " _AUTO_UPDATE_
387- # To upper
388- if [ " ${_AUTO_UPDATE_} X" = " nX" ]; then
389- _AUTO_UPDATE_=N
390- fi
391- if [ " ${_AUTO_UPDATE_} X" = " yX" ]; then
392- _AUTO_UPDATE_=Y
393- fi
394- fi
395384
396385 if [ $_PLUGINS_ ] && [ " $_PLUGINS_ " X = " gateway" X ]; then
397386 plugins=Y
@@ -406,8 +395,7 @@ function main() {
406395 fi
407396
408397 # Get the latest version.
409- lastversion=$( curl -sS https://raw.githubusercontent.com/iotexproject/iotex-bootstrap/master/README.md| grep " ^- $_GREP_STRING_ :" | awk ' {print $3}' )
410-
398+ lastversion=$( curl -sS https://api.github.com/repos/iotexproject/iotex-core/releases/latest| grep -oP ' (?<="tag_name": ")[^"]*' )
411399 echo -e " Current operating environment: ${YELLOW} $env ${NC} "
412400 read -p " Install or Upgrade Version; if null the latest [$lastversion ]: " ver
413401 version=${ver:- " $lastversion " } # if $ver ;then version=$ver;else version=$lastversion"
@@ -427,11 +415,6 @@ function main() {
427415 if [ " $version " X = " $runversion " X ] && [ $_PLUGINS_CHANGE_ -eq 0 ]; then
428416 # Do nothing
429417 procssNotUpdate
430- if [ " $_AUTO_UPDATE_ " X = " Y" X ]; then
431- # Need set auto-update
432- echo -e " ${YELLOW} Restarting auto-update..."
433- startAutoUpdate
434- fi
435418 exit 0
436419 fi
437420 fi
@@ -488,12 +471,10 @@ function main() {
488471 else
489472 disableGateway
490473 fi
491-
474+
492475 startupNode
493476
494- if [ " $_AUTO_UPDATE_ " X == " Y" X ]; then
495- startAutoUpdate
496- fi
477+ checkAndCleanAutoUpdate
497478}
498479
499480main $@
0 commit comments