Bug 68893 - RFE: firstboot cleanups
Summary: RFE: firstboot cleanups
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: firstboot   
(Show other bugs)
Version: limbo
Hardware: i386 Linux
Target Milestone: ---
Assignee: Brent Fox
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-07-15 19:46 UTC by Dan Burcaw
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-07-15 19:46:13 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Dan Burcaw 2002-07-15 19:46:09 UTC
Hi Brent, these may or may not be important for your purposes, but
at least for my own tests of firstboot, it is handy.  Do with them what
you want ;-) :

--- src/firstboot.orig  Mon Jul 15 13:30:41 2002
+++ src/firstboot       Mon Jul 15 13:30:13 2002
@@ -62,6 +62,11 @@
 #Let's check to see if firstboot should be run or not
 #If we're in debug mode, run anyway.  Even if the file exists
 if (not doDebug):
+    #Well first, is this even being run as root?
+    if os.getuid() > 0 or os.geteuid() > 0:
+       print "You must be root to run firstboot."
+       sys.exit(0)
     #We're not in debug mode, so do some checking
     #First, look and see if /etc/sysconfig/firstboot exists
--- src/firstbootWindow.py.orig Mon Jul 15 13:23:31 2002
+++ src/firstbootWindow.py      Mon Jul 15 13:24:44 2002
@@ -262,7 +262,10 @@
     def writeSysconfigFile(self, *args):
         #Write the /etc/sysconfig/firstboot file to tell firstboot not to run again
         if (not self.doDebug):
-            fd = open("/etc/sysconfig/firstboot", "w")
+           try:
+               fd = open("/etc/sysconfig/firstboot", "w")
+           except:
+               pass # we should never get here, as we make sure firstboot is
run as root

Comment 1 Brent Fox 2002-08-13 03:30:32 UTC
Hi.  Thanks for the patches.  I applied the first one, but not the second one. 
It's not really clear what to do if we can't write to /etc/sysconfig/firstboot.
 Wrapping the open in a try/except won't help if we fall through the except loop
and then call fd.write("foo") because fd will be undefined.  I've decided to
leave that like it is, but the first one works fine.  Thanks again for your
help.  I gave you credit in the changelog and the patch should appear in 0.9.9-5
when it gets rebuild tomorrow.

Note You need to log in before you can comment on or make changes to this bug.