[HOWTO] Self updating OSMC Distribution (Not recommended for inexperienced users)

Here is a little script can push notifications about what package was updated if your not a fan of emails to pushbullet or pushover or as a simple kodi notification

we need to save this to /usr/bin/unattended_push_notifications so perform this command

sudo nano /usr/bin/unattended_push_notifications

then append:

#!/bin/sh
use_pushbullet="disabled"                               # enabled / disabled (default: disabled)
use_pushover="disabled"                                 # enabled / disabled (default: disabled)
use_kodi="enabled"                                      # enabled / disabled (default: disabled)

#Pushbullet/Pushover settings
pushbullet_token=""                                     # Your access token here (https://docs.pushbullet.com/)
pushover_token=""                                       # Your access token here (https://pushover.net/api)
pushover_username=""                                    # Pushover User ID (the user/group key (not e-mail address often referred to as USER_KEY)

log="/var/log/unattended-upgrades/unattended-upgrades-dpkg.log"
check_package=$(cat $log | tail -4 | grep "Setting up")

pushover_message () {
curl -s \
  --form-string "token=$pushover_token" \
  --form-string "user=$pushover_username" \
  --form-string "message=Package updating: $check_package" \
  https://api.pushover.net/1/messages.json
}

pushbullet_message () {
message="$check_package"
title="Package updating:"
curl -u $pushbullet_token: https://api.pushbullet.com/v2/pushes -d type=note -d title="$title" -d body="$message"
}

kodi_message () {
kodi-send --action="Notification(Package updating:,$check_package,5000)"
}

     if [ $use_pushbullet = "enabled" ]; then
        pushbullet_message
     fi
     if [ $use_pushover = "enabled" ]; then
        pushover_message
     fi
     if [ $use_kodi = "enabled" ]; then
        kodi_message
     fi

then we need to make it executable with

 sudo chmod +x /usr/bin/unattended_push_notifications

then add a condition that make it run after its updates

 sudo nano /etc/apt/apt.conf.d/99-post-update

and append:

 Dpkg::Post-Invoke {"/usr/bin/unattended_push_notifications";};

Here is an image of how pushbullet messages look