Skip to content

Commit

Permalink
Merge pull request #14 from WenhuaChang/master
Browse files Browse the repository at this point in the history
set secureboot default to firmware status
  • Loading branch information
wfeldt committed Mar 6, 2013
2 parents cbdcb60 + 9c29c2a commit 3cd7284
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/modules/BootCommon.ycp
Expand Up @@ -1143,6 +1143,20 @@ global define void setLoaderType (string bootloader) {
y2milestone ("Loader type set");
}

boolean checkSecureBoot()
{
boolean ret = false;
string sbvar = "/sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data";
boolean sbvar_avail = 0 == (integer) SCR::Execute (.target.bash, "test -e " + sbvar);

if (sbvar_avail) {
string cmd = sformat ("test `od -An -N1 -t u1 %1` -eq 1", sbvar);
ret = 0 == (integer) SCR::Execute (.target.bash, cmd);
}

return ret;
}

global define boolean getSystemSecureBootStatus (boolean recheck) {

if ((! recheck) && (secure_boot != nil))
Expand All @@ -1159,8 +1173,7 @@ global define boolean getSystemSecureBootStatus (boolean recheck) {
}
}

// TODO : Detect Secure Boot
secure_boot = false;
secure_boot = checkSecureBoot();
return secure_boot;
}

Expand Down

0 comments on commit 3cd7284

Please sign in to comment.