Blob Blame History Raw
From 4a3e812e0b6a3974bff0f0b1232d3ac95efe8902 Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Fri, 16 May 2014 21:12:36 +0400
Subject: [PATCH] resume/module-setup.sh: filter out empty resume= options in
 cmdline()

cmdline() prints empty "resume=" options for non-persistent swap
devices, for example zram. Add a check for that.

This patch also fixes printf formatting and removes unused variables.
---
 modules.d/95resume/module-setup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index ceb785510f..b1b4684b76 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -17,12 +17,12 @@ check() {
 
 # called by dracut
 cmdline() {
-    local _activated
-    declare -A _activated
+    local _resume
 
     for dev in "${!host_fs_types[@]}"; do
         [[ ${host_fs_types[$dev]} =~ ^(swap|swsuspend|swsupend)$ ]] || continue
-        printf "resume=%s " "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
+        _resume=$(shorten_persistent_dev "$(get_persistent_dev "$dev")")
+        [[ -n ${_resume} ]] && printf " resume=%s" "${_resume}"
     done
 }
 
-- 
1.9.3