summaryrefslogtreecommitdiff
diff options
authorNara Huang <nara.huang@canonical.com>2020-06-12 16:27:57 +0800
committerNara Huang <nara.huang@canonical.com>2020-06-12 16:27:57 +0800
commitdbd6eddacbfda67209c9a89da39c9a088ed1334a (patch)
treeac57d90bff1c78e7126f559827f514af21f9e3e2
parent6c0a9e3b4e1a8f6c9535cea0150055be464745ec (diff)
Misc: Add script and job to check unwanted packages
-rwxr-xr-xbin/check_package.sh27
-rw-r--r--jobs/misc/misc-generic.txt7
2 files changed, 34 insertions, 0 deletions
diff --git a/bin/check_package.sh b/bin/check_package.sh
new file mode 100755
index 0000000..3a5cac8
--- /dev/null
+++ b/bin/check_package.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Copyright 2020 Canonical Ltd.
+# All rights reserved.
+#
+# Written by:
+# Nara Huang <nara.huang@canonical.com>
+# Script to check packages that may have license or patent issues,
+# if any of package in argument is installed, this script will
+# return 1 as the test fails.
+installed=0
+if [ $# -ne 0 ]; then
+ while [ $# != 0 ]
+ do
+ dpkg -s $1 &> /dev/null
+ if [ $? -eq 0 ]; then
+ echo $1 "is installed."
+ installed=1
+ else
+ echo $1 "is not installed."
+ fi
+ shift
+ done
+ exit $installed
+else
+ echo "Usage: \"$0 packagename1 packagename2\"";
+ exit
+fi
diff --git a/jobs/misc/misc-generic.txt b/jobs/misc/misc-generic.txt
index 7f62d31..0f3f53b 100644
--- a/jobs/misc/misc-generic.txt
+++ b/jobs/misc/misc-generic.txt
@@ -32,3 +32,10 @@ command: sed -i 's/\#Storage=auto/Storage=persistent/' /etc/systemd/journald.con
_summary: Set journald to preserve logs during stress test
_description:
To make sure system will write journald log to disk during every boot.
+
+plugin: shell
+id: misc/generic/check-unwanted-packages
+command: check_package.sh gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libavcodec-extra ubuntu-restricted-extras ttf-mscorefonts-installer unrar
+_summary: Check if unwanted packages are installed
+_description:
+ For some packages which may have license or patent issues, this case checks if they are installed.