Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #!/bin/bash
  2. # Pending Updates Script for Managed Software Center
  3. ### The following line load the Hello IT bash script lib
  4. . "$HELLO_IT_SCRIPT_FOLDER/com.github.ygini.hello-it.scriptlib.sh"
  5.  
  6. # Functions
  7. # updateTitle "String" - Updates Menu Item Title (Text of item)
  8. # updateTooltip "String" - Updates Menu Item Hover Text
  9. # updateState ${STATE[0]} - Updates the state icon
  10. # STATE VALUES
  11. # supported states are managed by the STATE array
  12. # ${STATE[0]} --> OK (Green light)
  13. # ${STATE[1]} --> Warning (Orange light)
  14. # ${STATE[2]} --> Error (Red light)
  15. # ${STATE[3]} --> Unavailable (Empty circle)
  16. # ${STATE[4]} --> No state to display (Nothing at all)
  17.  
  18. function onClickAction {
  19. setTitleAction
  20. sudo /usr/local/bin/santactl sync
  21. if [ $? -eq 0 ]; then
  22. osascript -e 'display notification "Your santa whitelist has been synced!" with title "🎅"'
  23. else
  24. osascript -e 'display notification "There was an error in syncing your Santa whitelist! with title "🎅"'
  25. fi
  26. }
  27.  
  28. function setTitleAction {
  29. if ! [ -f /usr/local/bin/santactl ]; then
  30. echo "hitp-title: Santa is not installed!"
  31. echo "hitp-state: error"
  32. exit 1
  33. else
  34. echo "hitp-title: Sync Whitelist"
  35. echo "hitp-state: none"
  36. fi
  37. }
  38.  
  39. case $@ in
  40. run)
  41. onClickAction
  42. ;;
  43. periodic-run)
  44. setTitleAction
  45. ;;
  46. title)
  47. setTitleAction
  48. ;;
  49. network)
  50. setTitleAction
  51. ;;
  52. esac
  53.  
  54. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement