modsign: do not install, if no keys present
authorHarald Hoyer <harald@redhat.com>
Wed, 24 Jul 2013 08:34:19 +0000 (10:34 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 24 Jul 2013 08:34:19 +0000 (10:34 +0200)
also fixed inst_hook

modules.d/03modsign/module-setup.sh

index 8831ad5..730cd86 100644 (file)
@@ -8,7 +8,15 @@
 # Peter Jones <pjones@redhat.com>
 
 check() {
-    [ -x /usr/bin/keyctl ] || return 1
+    [[ -x /usr/bin/keyctl ]] || return 1
+
+    # do not include module in hostonly mode,
+    # if no keys are present
+    if [[ $hostonly ]]; then
+        x=$(echo /lib/modules/keys/*)
+        [[ "${x}" = "/lib/modules/keys/*" ]] && return 255
+    fi
+
     return 0
 }
 
@@ -20,9 +28,10 @@ install() {
     inst_dir /lib/modules/keys
     inst_binary /usr/bin/keyctl
 
-    inst_hook initqueue/pre-trigger 01 "$moddir/load-modsign-keys.sh"
+    inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
+
     for x in /lib/modules/keys/* ; do
-        [ "${x}" = "/lib/modules/keys/*" ] && break
-        inst_simple ${x}
+        [[ "${x}" = "/lib/modules/keys/*" ]] && break
+        inst_simple "${x}"
     done
 }