Update 08-28-2022: I added more packages to be queried. The script is now hosted in GitLab and has one extra line comparing the versions of the packages.
Original:
I needed a script to check on the current versions of specific packages, as well as the latest versions from the vendors or manufacturer websites. I used the github and gitlab repositories for the packages, along with awk to query the versions and tr to remove the v in front of the version numbers. I even added a line for Microsoft Teams.
First attempt:
#!/usr/bin/bash
echo DKMS && echo Current: && ls /var/log/packages | grep dkms | awk -F "-" '{print $2}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/dell/dkms | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo EVDI: && echo Current: && ls /var/log/packages | grep evdi-1 | awk -F "-" '{print $2}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/DisplayLink/evdi | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo FreeRDP && echo Current: && xfreerdp /version | awk '{print $5}' && echo "Latest:" && git ls-remote --tags --refs --sort="version:refname" git://github.com/FreeRDP/FreeRDP | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo NVIDIA: && echo Current: && grep "X Driver" /var/log/Xorg.0.log | awk '{print $8}' && echo Latest: && git ls-remote --tags --refs --sort="version:refname" git://github.com/NVIDIA/nvidia-xconfig | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo Remmina: && echo Current: && ls /var/log/packages | grep Remmina | awk -F "-" '{print $2}' | tr -d \v && echo Latest: && git ls-remote --tags --refs --sort="version:refname" https://gitlab.com/Remmina/Remmina.git | awk -F/ 'END{print$NF}' | tr -d \v
echo
echo Teams: && echo Current: && ls /var/log/packages | grep teams-insiders | awk -F "-" '{print $3}' | tr -d \v && echo Latest: && curl -s https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams-insiders/ | awk -F "teams" 'NF > 1 {print $NF}' | tail -1 | awk -F "_" '{print $2}'
Second attempt:
#!/usr/bin/bash
CurrentDKMS=$(ls /var/log/packages | grep dkms | awk -F "-" '{print $2}' 2>&1)
LatestDKMS=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/dell/dkms | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo DKMS Current: $CurrentDKMS Latest: $LatestDKMS
CurrentEVDI=$(ls /var/log/packages | grep evdi-1 | awk -F "-" '{print $2}' 2>&1)
LatestEVDI=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/DisplayLink/evdi | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo EVDI Current: $CurrentEVDI Latest: $LatestEVDI
CurrentFreeRDP=$(xfreerdp /version | awk '{print $5}' 2>&1)
LatestFreeRDP=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/FreeRDP/FreeRDP | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo FreeRDP Current: $CurrentFreeRDP Latest: $LatestFreeRDP
CurrentNVIDIA=$(grep "X Driver" /var/log/Xorg.0.log | awk '{print $8}' 2>&1)
LatestNVIDIA=$(git ls-remote --tags --refs --sort="version:refname" git://github.com/NVIDIA/nvidia-xconfig | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo NVIDIA Current: $CurrentNVIDIA Latest: $LatestNVIDIA
CurrentRemmina=$(ls /var/log/packages | grep Remmina | awk -F "-" '{print $2}' | tr -d \v 2>&1)
LatestRemmina=$(git ls-remote --tags --refs --sort="version:refname" https://gitlab.com/Remmina/Remmina.git | awk -F/ 'END{print$NF}' | tr -d \v 2>&1)
echo Remmina Current: $CurrentRemmina Latest: $LatestRemmina
CurrentTeams=$(ls /var/log/packages | grep teams-insiders | awk -F "-" '{print $3}' | tr -d \v 2>&1)
LatestTeams=$(curl -s https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams-insiders/ | awk -F "_" 'NF >1 {print $2}' | tail -1 2>&1)
echo Teams Current: $CurrentTeams Latest: $LatestTeams
Regards,
F. Bobbio C.
No comments:
Post a Comment