On Tue, 2014-06-17 at 14:46 +0200, Martin Kolman wrote:
And also tell the user why firstboot is not starting.
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
progs/firstboot | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/progs/firstboot b/progs/firstboot
index 470aca6..51f66a2 100755
--- a/progs/firstboot
+++ b/progs/firstboot
@@ -136,6 +136,19 @@ if __name__ == "__main__":
config.mode = config.mode | MODE_RECONFIG
# First check to see if firstboot should even run.
+
+ # check if firstboot has not been disabled
+ config_path = "/etc/sysconfig/firstboot"
+ if os.path.isfile(config_path):
+ with open(config_path, "r") as f:
+ buf = f.readlines()
+ # check if one of the options in the config file (stripped of trailing
newlines)
+ # is equal to the option that disables firstboot
+ if "RUN_FIRSTBOOT=NO" in (l.rstrip("\n") for l in buf):
+ logging.error(_("Firstboot startup disabled in
/etc/sysconfig/firstboot, exiting."))
+ os._exit(0)
+
+ # check if we are running as root
if not opts.test and (os.getuid() > 0 or os.geteuid() > 0):
logging.error(_("You must be root to run firstboot."))
os._exit(0)
Since we are the only ones that are supposed to write that
file out this
check should be adequate even if it's not bullet-proof. ACK.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic