Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Pending Updates Script for Managed Software Center
- ### The following line load the Hello IT bash script lib
- . "$HELLO_IT_SCRIPT_FOLDER/com.github.ygini.hello-it.scriptlib.sh"
- # Functions
- # updateTitle "String" - Updates Menu Item Title (Text of item)
- # updateTooltip "String" - Updates Menu Item Hover Text
- # updateState ${STATE[0]} - Updates the state icon
- # STATE VALUES
- # supported states are managed by the STATE array
- # ${STATE[0]} --> OK (Green light)
- # ${STATE[1]} --> Warning (Orange light)
- # ${STATE[2]} --> Error (Red light)
- # ${STATE[3]} --> Unavailable (Empty circle)
- # ${STATE[4]} --> No state to display (Nothing at all)
- function onClickAction {
- setTitleAction
- sudo /usr/local/bin/santactl sync
- if [ $? -eq 0 ]; then
- osascript -e 'display notification "Your santa whitelist has been synced!" with title "🎅"'
- else
- osascript -e 'display notification "There was an error in syncing your Santa whitelist! with title "🎅"'
- fi
- }
- function setTitleAction {
- if ! [ -f /usr/local/bin/santactl ]; then
- echo "hitp-title: Santa is not installed!"
- echo "hitp-state: error"
- exit 1
- else
- echo "hitp-title: Sync Whitelist"
- echo "hitp-state: none"
- fi
- }
- case $@ in
- run)
- onClickAction
- ;;
- periodic-run)
- setTitleAction
- ;;
- title)
- setTitleAction
- ;;
- network)
- setTitleAction
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement