summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2020-08-04 01:40:26 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2020-08-04 23:23:32 +0300
commit40108db4434d8c2e0a1ad2d1dd3f5ae34b17352c (patch)
tree14edb2241a48b600f217aa8ebc03a59ed62ca268 /meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh
parentd071adf43ac87f21dde2f84287120960c723962c (diff)
downloadopenbmc-40108db4434d8c2e0a1ad2d1dd3f5ae34b17352c.tar.xz
Update to internal 0.72
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh27
1 files changed, 21 insertions, 6 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh
index 38728b512..b9ea1127c 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh
+++ b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh
@@ -1,8 +1,23 @@
#!/bin/sh
-if [[ `cat /proc/cmdline` =~ "resetreason=0x11" ]]
-then
- busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/ac_boot xyz.openbmc_project.Common.ACBoot ACBoot s "True"
-else
- busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/ac_boot xyz.openbmc_project.Common.ACBoot ACBoot s "False"
-fi
+bitWiseAnd() {
+ local IFS='&'
+ printf "%s\n" "$(( $* ))"
+}
+
+ACBOOT="False"
+
+while IFS=' ' read -ra OPTIONS; do
+ for i in "${OPTIONS[@]}"; do
+ while IFS='=' read option param; do
+ if [ "resetreason" == "$option" ]; then
+ if [ $(bitWiseAnd "$param" "0x1") -ne 0 ]; then
+ ACBOOT="True"
+ fi
+ fi
+ done <<< $i
+ done
+done < /proc/cmdline
+
+busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/ac_boot xyz.openbmc_project.Common.ACBoot ACBoot s "$ACBOOT"
+