Advertisement
therealbeanjr

update-ipbx-installer-to-github

Nov 3rd, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Original code by Dennis Simpson
  4. # Modified by Kyle Warwick-Mathieu
  5. echo "Checking if script is up to date, please wait"
  6. cd /root/ipbx-installer || exit
  7. git pull
  8. cd /tmp || exit
  9. wget http://incrediblepbx.com/incrediblepbx13-12.2-centos.tar.gz
  10. tar zxvf incrediblepbx*
  11.  
  12. diff /root/ipbx-installer/IncrediblePBX13-12R.sh /tmp/IncrediblePBX13-12R.sh >& /dev/null
  13. if [ "$?" != "0" -a -s /tmp/IncrediblePBX13-12R.sh ]; then # If the exit code is not 0 (in other words if the file is different)
  14.     cat /tmp/IncrediblePBX13-12R.sh > /root/ipbx-installer/IncrediblePBX13-12R.sh
  15.     chmod +x /root/ipbx-installer/IncrediblePBX13-12R.sh
  16.     cd /root/ipbx-installer/ || exit
  17.     git add IncrediblePBX13-12R.sh
  18.     git commit -m "Automated update"
  19.     git push -f
  20.     rm -rf /tmp/*
  21.     exit
  22. else
  23.     echo "Nothing to do!"
  24.     rm /tmp/IncrediblePBX13-12R.sh # If no updates are available, simply remove the file
  25.     rm -rf /tmp/*
  26. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement