Commit d77567db3ff5beae9c612cf5b65003a5b3874a15

Authored by Clang
Committed by GitHub
1 parent c1a39050
Exists in master

Update install_ngrok.sh

Showing 1 changed file with 31 additions and 29 deletions   Show diff stats
install_ngrok.sh
... ... @@ -456,18 +456,8 @@ function fun_update_ngrok(){
456 456 local_init_version=`sed -n '/'^version'/p' /etc/init.d/ngrokd | cut -d\" -f2`
457 457 install_shell=${strPath}
458 458 cd ${str_ngrok_dir}
  459 + update_flag="false"
459 460 if [ ! -z ${remote_shell_version} ] || [ ! -z ${remote_init_version} ];then
460   - update_flag="false"
461   - if [[ "${version}" < "${remote_shell_version}" ]];then
462   - echo "========== Update ngrokd install_ngrok.sh =========="
463   - if ! wget --no-check-certificate ${str_install_shell} -O ${install_shell}/install_ngrok.sh; then
464   - echo "Failed to download install_ngrok.sh file!"
465   - exit 1
466   - else
467   - echo -e "${COLOR_GREEN}install_ngrok.sh Update successfully !!!${COLOR_END}"
468   - update_flag="true"
469   - fi
470   - fi
471 461 if [[ "${local_init_version}" < "${remote_init_version}" ]];then
472 462 echo "========== Update ngrokd /etc/init.d/ngrokd =========="
473 463 if ! wget --no-check-certificate ${program_init_download_url} -O /etc/init.d/ngrokd; then
... ... @@ -478,6 +468,16 @@ function fun_update_ngrok(){
478 468 update_flag="true"
479 469 fi
480 470 fi
  471 + if [[ "${version}" < "${remote_shell_version}" ]];then
  472 + echo "========== Update ngrokd install_ngrok.sh =========="
  473 + if ! wget --no-check-certificate ${str_install_shell} -O ${install_shell}/$0; then
  474 + echo "Failed to download install_ngrok.sh file!"
  475 + exit 1
  476 + else
  477 + echo -e "${COLOR_GREEN}install_ngrok.sh Update successfully !!!${COLOR_END}"
  478 + update_flag="true"
  479 + fi
  480 + fi
481 481 if [ "${update_flag}" == 'true' ]; then
482 482 echo -e "${COLOR_GREEN}Update shell successfully !!!${COLOR_END}"
483 483 echo ""
... ... @@ -486,26 +486,28 @@ function fun_update_ngrok(){
486 486 exit 1
487 487 fi
488 488 fi
489   - [ ! -d ${str_ngrok_dir}/bin/ ] && mkdir -p ${str_ngrok_dir}/bin/
490   - rm -f ${str_ngrok_dir}/bin/ngrokd /usr/bin/ngrokd /var/run/ngrok_clang.pid /root/ngrok_install.log /root/ngrok_uninstall.log
491   - # Download ngrok file
492   - fun_download_file
493   - [ ! -x /etc/init.d/ngrokd ] && chmod 755 /etc/init.d/ngrokd
494   - [ -s /etc/init.d/ngrokd ] && ln -s /etc/init.d/ngrokd /usr/bin/ngrokd
495   - if [ "${OS}" == 'CentOS' ]; then
496   - if [ -s /etc/init.d/ngrokd ]; then
497   - chmod +x /etc/init.d/ngrokd
498   - chkconfig --add ngrokd
499   - fi
500   - else
501   - if [ -s /etc/init.d/ngrokd ]; then
502   - chmod +x /etc/init.d/ngrokd
503   - update-rc.d -f ngrokd defaults
  489 + if [ "${update_flag}" == 'false' ]; then
  490 + [ ! -d ${str_ngrok_dir}/bin/ ] && mkdir -p ${str_ngrok_dir}/bin/
  491 + rm -f ${str_ngrok_dir}/bin/ngrokd /usr/bin/ngrokd /var/run/ngrok_clang.pid /root/ngrok_install.log /root/ngrok_uninstall.log
  492 + # Download ngrok file
  493 + fun_download_file
  494 + [ ! -x /etc/init.d/ngrokd ] && chmod 755 /etc/init.d/ngrokd
  495 + [ -s /etc/init.d/ngrokd ] && ln -s /etc/init.d/ngrokd /usr/bin/ngrokd
  496 + if [ "${OS}" == 'CentOS' ]; then
  497 + if [ -s /etc/init.d/ngrokd ]; then
  498 + chmod +x /etc/init.d/ngrokd
  499 + chkconfig --add ngrokd
  500 + fi
  501 + else
  502 + if [ -s /etc/init.d/ngrokd ]; then
  503 + chmod +x /etc/init.d/ngrokd
  504 + update-rc.d -f ngrokd defaults
  505 + fi
504 506 fi
  507 + clear
  508 + /etc/init.d/ngrokd start
  509 + echo "Ngrok update success!"
505 510 fi
506   - clear
507   - /etc/init.d/ngrokd start
508   - echo "Ngrok update success!"
509 511 else
510 512 echo "Ngrok Not install!"
511 513 fi
... ...