summaryrefslogtreecommitdiff
diff options
authorPMR <pmr@pmr-lander>2018-08-16 08:26:09 +0000
committerPMR <pmr@pmr-lander>2018-08-16 08:26:09 +0000
commit9b677da1608137be4912df2bf921fc4448abe063 (patch)
treee1ea4fd73a89f541af841d1f758484a201cf361b
parent87b0140a614e550d826a8133794f9818ac24a35d (diff)
parentafc106cf7bf2367e434697e024bd668d58cb5d0d (diff)
Merge #353133 from ~dannf/plainbox-provider-checkbox:network-predictable-names
-rwxr-xr-xbin/network_predictable_names45
-rw-r--r--units/networking/jobs.pxu7
2 files changed, 52 insertions, 0 deletions
diff --git a/bin/network_predictable_names b/bin/network_predictable_names
new file mode 100755
index 00000000..20c52dfb
--- /dev/null
+++ b/bin/network_predictable_names
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+# Script to verify that all network interfaces have predictable names
+#
+# Copyright (c) 2018 Canonical Ltd.
+#
+# Authors
+# dann frazier <dann.frazier@canonical.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# The purpose of this script is to identify any network interfaces
+# that do not have a predictable name. See:
+# https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
+#
+# Usage:
+# network_predictable_names
+#
+# Parameters:
+# None
+
+failed=0
+
+for iface in /sys/class/net/*; do
+ iface=${iface##*/}
+
+ if [ "${iface}" != "${iface#eth}" ]; then
+ echo "** Error: Network interface $iface is not a predictable name"
+ failed=1
+ fi
+done
+
+exit $failed
diff --git a/units/networking/jobs.pxu b/units/networking/jobs.pxu
index 92eadd4e..360aaf23 100644
--- a/units/networking/jobs.pxu
+++ b/units/networking/jobs.pxu
@@ -77,3 +77,10 @@ requires: package.name == 'cups-client'
command: network_printer_test -s $CHECKBOX_SERVER
_description: Try to enable a remote printer on the network and print a test page.
+plugin: shell
+category_id: com.canonical.plainbox::networking
+id: networking/predictable_names
+command: network_predictable_names
+_summary: Verify that all network interfaces have predictable names.
+_description: Verify that all network interfaces have predictable names.
+