Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion systemd-timer/motd-update.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Description=Motd upgradable package count service
After=network.target

[Service]
ExecStart=run-parts /etc/update-motd-static.d
ExecStart=/bin/bash -c "bkt --ttl 1d --force -- sudo apt-get update --quiet=2 && bkt --ttl 1d --force -- sudo apt-get -s dist-upgrade"
2 changes: 1 addition & 1 deletion systemd-timer/motd-update.timer
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Description=Motd upgradable package count timer - Daily at 8:00PM
[Timer]
OnCalendar=*-*-* 20:00
Persistent=true

[Install]
WantedBy=timers.target
53 changes: 0 additions & 53 deletions update-motd-static.d/20-update

This file was deleted.

Empty file modified update-motd.d/10-welcome
100644 → 100755
Empty file.
Empty file modified update-motd.d/15-system
100644 → 100755
Empty file.
28 changes: 28 additions & 0 deletions update-motd.d/20-update
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

function color (){
echo "\e[$1m$2\e[0m"
}

msgColor="38;5;103"
countColor="38;5;16;48;5;242"
plurality="packages"

# Count
bkt --ttl 1d -- sudo apt-get update --quiet=2
pkgCount="$(bkt --ttl 1d -- sudo apt-get -s dist-upgrade | grep -Po '^\d+(?= upgraded)')"

if (( $pkgCount > 0 )); then
countColor="38;5;16;48;5;71"
fi
if (( $pkgCount == 1 )); then
plurality="package"
fi

# Message
msgHeader=$(color $msgColor \*)
msgCount=$(color $countColor " $pkgCount ")
msgLabel=$(color $msgColor "$plurality can be upgraded")

echo -e "\n$msgHeader $msgCount $msgLabel\n"