Skip to content

Instantly share code, notes, and snippets.

@kescherCode
Last active September 23, 2022 12:19
Show Gist options
  • Select an option

  • Save kescherCode/f29c9d4945feb2fcaf4ba7c6103a83f3 to your computer and use it in GitHub Desktop.

Select an option

Save kescherCode/f29c9d4945feb2fcaf4ba7c6103a83f3 to your computer and use it in GitHub Desktop.

Revisions

  1. kescherCode revised this gist Feb 6, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,14 @@
    #!/usr/bin/env bash

    sudouser="kescher"
    aur_helper="yay"
    last_update_notification="/usr/local/etc/last_update_notification"
    subjectline="Update notification for $(hostname -s)"
    fromaddress="Update Notification <[email protected]>"
    toaddress="Jeremy Kescher <[email protected]>"

    repo=$(checkupdates)
    aur=$(sudo -u "$sudouser" yay -Qu --aur | sort)
    aur=$(sudo -u "$sudouser" "$aur_helper" -Qu --aur | sort)
    update=""

    if [[ -n "$repo" && -n "$aur" ]]; then
  2. kescherCode revised this gist May 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ update=""
    if [[ -n "$repo" && -n "$aur" ]]; then
    update="Repo:"$'\n'"$repo"$'\n'"AUR:"$'\n'"$aur"
    elif [[ -n "$repo" ]]; then
    update="repo:"$'\n'"$repo"
    update="Repo:"$'\n'"$repo"
    elif [[ -n "$aur" ]]; then
    update="AUR:"$'\n'"$aur"
    else :>"$last_update_notification" && exit
  3. kescherCode revised this gist Apr 19, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,6 @@ elif [[ -n "$aur" ]]; then
    update="AUR:"$'\n'"$aur"
    else :>"$last_update_notification" && exit
    fi
    echo "$update"
    echo "$(cat "$last_update_notification")"

    [[ "$(cat "$last_update_notification")" == "$update" ]] && exit

  4. kescherCode revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ fromaddress="Update Notification <[email protected]>"
    toaddress="Jeremy Kescher <[email protected]>"

    repo=$(checkupdates)
    aur=$(sudo -u "$sudouser" yay -Qu --aur)
    aur=$(sudo -u "$sudouser" yay -Qu --aur | sort)
    update=""

    if [[ -n "$repo" && -n "$aur" ]]; then
  5. kescherCode revised this gist Apr 17, 2021. 1 changed file with 10 additions and 4 deletions.
    14 changes: 10 additions & 4 deletions notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,16 @@ repo=$(checkupdates)
    aur=$(sudo -u "$sudouser" yay -Qu --aur)
    update=""

    [[ -z "$repo" && -z "$aur" ]] && :>"$last_update_notification" && exit

    [ -n "$repo" ] && update="Repo:"$'\n'"$repo"
    [ -n "$aur" ] && update="$update"$'\n'"AUR:"$'\n'"$aur"
    if [[ -n "$repo" && -n "$aur" ]]; then
    update="Repo:"$'\n'"$repo"$'\n'"AUR:"$'\n'"$aur"
    elif [[ -n "$repo" ]]; then
    update="repo:"$'\n'"$repo"
    elif [[ -n "$aur" ]]; then
    update="AUR:"$'\n'"$aur"
    else :>"$last_update_notification" && exit
    fi
    echo "$update"
    echo "$(cat "$last_update_notification")"

    [[ "$(cat "$last_update_notification")" == "$update" ]] && exit

  6. kescherCode revised this gist Oct 13, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -4,18 +4,18 @@ sudouser="kescher"
    last_update_notification="/usr/local/etc/last_update_notification"
    subjectline="Update notification for $(hostname -s)"
    fromaddress="Update Notification <[email protected]>"
    toaddress="Jeremy Kescher <jeremy@example.com>"
    toaddress="Jeremy Kescher <jeremy@kescher.at>"

    repo=$(checkupdates)
    aur=$(sudo -u "$sudouser" yay -Qu --aur)
    update=""

    [[ -z "$repo" && -z "$aur" ]] && :>$last_update_notification && exit
    [[ -z "$repo" && -z "$aur" ]] && :>"$last_update_notification" && exit

    [ -n "$repo" ] && update="Repo:"$'\n'"$repo"
    [ -n "$aur" ] && update="$update"$'\n'"AUR:"$'\n'"$aur"

    [[ $(cat $last_update_notification) == "$update" ]] && exit
    [[ "$(cat "$last_update_notification")" == "$update" ]] && exit

    echo "$update" | mail -s "$subjectline" -r "$fromaddress" "$toaddress"
    echo "$update" > $last_update_notification
    echo "$update" > "$last_update_notification"
  7. kescherCode revised this gist Oct 13, 2020. No changes.
  8. kescherCode created this gist Oct 13, 2020.
    21 changes: 21 additions & 0 deletions notify_updates.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/usr/bin/env bash

    sudouser="kescher"
    last_update_notification="/usr/local/etc/last_update_notification"
    subjectline="Update notification for $(hostname -s)"
    fromaddress="Update Notification <[email protected]>"
    toaddress="Jeremy Kescher <[email protected]>"

    repo=$(checkupdates)
    aur=$(sudo -u "$sudouser" yay -Qu --aur)
    update=""

    [[ -z "$repo" && -z "$aur" ]] && :>$last_update_notification && exit

    [ -n "$repo" ] && update="Repo:"$'\n'"$repo"
    [ -n "$aur" ] && update="$update"$'\n'"AUR:"$'\n'"$aur"

    [[ $(cat $last_update_notification) == "$update" ]] && exit

    echo "$update" | mail -s "$subjectline" -r "$fromaddress" "$toaddress"
    echo "$update" > $last_update_notification