Advertisement
marcoshalano

New update-prey to put on /etc/cron.daily

Aug 22nd, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.99 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Instructions
  4. # Just put this script on /etc/cron.daily and set eXecute permission
  5.  
  6. # ChangeLog
  7. # Added $ARCH variable
  8. # Added support for new Ubuntu which use Systemd instead of Upstart, so move initctl off and back is a workaround.
  9. # Added a log message
  10. # Fixed a bug. Originally "mv /sbin/initctl{,-hidden}" and "mv /sbin/initctl{-hidden,}" may be don't work, so I put the full command and all works now.
  11.  
  12. ARCH=amd64
  13. CURRENT_VERSION=$(dpkg-query -W -f='${Version}\n' prey)
  14. PACKAGE_VERSION=$(curl -s https://s3.amazonaws.com/prey-releases/node-client/latest.txt)
  15. if [ "$CURRENT_VERSION" != "$PACKAGE_VERSION" ]; then
  16. wget -q -O"/tmp/prey.deb" https://s3.amazonaws.com/prey-releases/node-client/"$PACKAGE_VERSION"/prey_"$PACKAGE_VERSION"_$ARCH.deb
  17. mv /sbin/initctl /sbin/initctl-hidden
  18. dpkg -i /tmp/prey.deb >/dev/null 2>/dev/null
  19. mv /sbin/initctl-hidden /sbin/initctl
  20. rm -f /tmp/prey.deb
  21. logger "Prey Auto-Theft updated from $CURRENT_VERSION to $PACKAGE_VERSION"
  22. fi
  23. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement