aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/obsolete-packages
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-12-26 13:07:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-12-26 13:07:32 -0300
commit4adddce1227e3a332f8b30cc4e0cee7d0b82a808 (patch)
treebde90f21d80aaf53381256a5cfa465ba191798ea /share/hydractl/obsolete-packages
parent042cc90fad9f88e8834052441110c1dae5ffa809 (diff)
downloadhydra-4adddce1227e3a332f8b30cc4e0cee7d0b82a808.tar.gz
hydra-4adddce1227e3a332f8b30cc4e0cee7d0b82a808.tar.bz2
Feat: hydractl: obsolete-packages: improve output and add xargs param
Diffstat (limited to 'share/hydractl/obsolete-packages')
-rwxr-xr-xshare/hydractl/obsolete-packages25
1 files changed, 23 insertions, 2 deletions
diff --git a/share/hydractl/obsolete-packages b/share/hydractl/obsolete-packages
index 1b84ff5..783d2b8 100755
--- a/share/hydractl/obsolete-packages
+++ b/share/hydractl/obsolete-packages
@@ -16,16 +16,37 @@
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
+# Parameters
OBSOLETE="`apt-show-versions | grep 'No available version' | cut -d : -f 1`"
+# List all obsolete packages
if [ ! -z "$OBSOLETE" ]; then
- echo "Obsolete packages: $OBSOLETE"
+ echo "Obsolete packages:"
+ echo ""
+
+ if echo "$*" | grep -q -- 'xargs'; then
+ echo "$OBSOLETE" | xargs
+ else
+ echo "$OBSOLETE"
+ fi
fi
+# List all obsolete packages with known vulnerabilities
if which debsecan &> /dev/null; then
VULNS="`debsecan | grep obsolete | cut -d ' ' -f 2 | uniq`"
+ if [ ! -z "$OBSOLETE" ]; then
+ echo ""
+ fi
+
if [ ! -z "$VULNS" ]; then
- echo "Obsolete packages with known vulnerabilities: $VULNS"
+ echo "Obsolete packages with known vulnerabilities:"
+ echo ""
+
+ if echo "$*" | grep -q -- 'xargs'; then
+ echo "$VULNS" | xargs
+ else
+ echo "$VULNS"
+ fi
fi
fi