From owner-p4-projects@FreeBSD.ORG Sun Jun 24 16:37:51 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D9AA216A46E; Sun, 24 Jun 2007 16:37:50 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD9A516A494 for ; Sun, 24 Jun 2007 16:37:50 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 9A7B913C447 for ; Sun, 24 Jun 2007 16:37:50 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5OGboIL051939 for ; Sun, 24 Jun 2007 16:37:50 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5OGbord051936 for perforce@freebsd.org; Sun, 24 Jun 2007 16:37:50 GMT (envelope-from ivoras@FreeBSD.org) Date: Sun, 24 Jun 2007 16:37:50 GMT Message-Id: <200706241637.l5OGbord051936@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Cc: Subject: PERFORCE change 122233 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2007 16:37:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=122233 Change 122233 by ivoras@ivoras_finstall on 2007/06/24 16:37:17 Silence most of the warnings on the LiveCD Affected files ... .. //depot/projects/soc2007/ivoras_finstall/makeimage/makeimage.py#3 edit Differences ... ==== //depot/projects/soc2007/ivoras_finstall/makeimage/makeimage.py#3 (text+ko) ==== @@ -37,7 +37,7 @@ raise MakeImageException("This utility requires mkisofs(8) (install ports/sysutils/cdrtools)") def usage(): - print "usage: %s -d WORKDIR [-s SRCDIR] [-k KERNEL]" % sys.argv[0] + print "usage: %s -d WORKDIR [-s SRCDIR] [-k KERNEL] [-b] [-c] [-i ISOFILE]" % sys.argv[0] sys.exit(1) WORKDIR = None # Working directory. Will create DESTDIR inside it. @@ -45,9 +45,11 @@ SRCDIR = "/usr/src" KERNEL = "GENERIC" DoBuild = False +DoMakeRoot = True # Create / install livecd tree LABEL = "FreeBSD7" +ISO = None -opts, args = getopt(sys.argv[1:], "d:s:bh") +opts, args = getopt(sys.argv[1:], "d:s:i:bch") for o,a in opts: if o == "-d": WORKDIR = a @@ -63,6 +65,10 @@ KERNEL = a elif o == "-b": DoBuild = True + elif o == "-c": + DoMakeRoot = False + elif o == "-i": + ISO = a elif o == "-h": usage() @@ -74,39 +80,67 @@ os.makedirs(WORKDIR) DESTDIR = "%s/livecd" % WORKDIR -if os.path.exists(DESTDIR): - if not os.path.exists("%s/COPYRIGHT" % DESTDIR): - print "--> %s doesn't look like a FreeBSD root" % DESTDIR - resp = raw_input("Delete it anyway? (y/N) ").upper() - if resp != "Y": - print "Canceling" - sys.exit(1) - else: - print "Wiping out %s" % DESTDIR - nukedir(DESTDIR) + +if DoMakeRoot: + if os.path.exists(DESTDIR): + if not os.path.exists("%s/COPYRIGHT" % DESTDIR): + print "--> %s doesn't look like a FreeBSD root" % DESTDIR + resp = raw_input("Delete it anyway? (y/N) ").upper() + if resp != "Y": + print "Canceling" + sys.exit(1) + else: + print "Wiping out %s" % DESTDIR + nukedir(DESTDIR) + + os.makedirs(DESTDIR) -os.makedirs(DESTDIR) + initutils() -initutils() + printmsg("Using '%s' as source directory" % SRCDIR) + printmsg("Using '%s' as working directory (root on '%s')" % (WORKDIR, DESTDIR)) + printmsg("Using '%s' kernel" % KERNEL) -printmsg("Using '%s' as source directory" % SRCDIR) -printmsg("Using '%s' as working directory (root on '%s')" % (WORKDIR, DESTDIR)) -printmsg("Using '%s' kernel" % KERNEL) -printmsg("Random message to test scrolling") + os.chdir(SRCDIR) + if DoBuild: + execute("make buildworld") + execute("make installworld DESTDIR=%s" % DESTDIR) + execute("make distribution DESTDIR=%s" % DESTDIR) + execute("make installkernel KERNCONF=%s DESTDIR=%s" % (KERNEL, DESTDIR)) +else: + if not os.path.exists(DESTDIR) or not os.path.exists("%s/COPYRIGHT" % DESTDIR): + print "%s doesn't look like existing livecd root" % DESTDIR + sys.exit(1) -os.chdir(SRCDIR) -if DoBuild: - execute("make buildworld") -execute("make installworld DESTDIR=%s" % DESTDIR) -execute("make distribution DESTDIR=%s" % DESTDIR) -execute("make installkernel KERNCONF=%s DESTDIR=%s" % (KERNEL, DESTDIR)) +str_time = strftime("%Y-%m-%d %H:%M") +printmsg("Creating config files") +# Edit loader.conf lc = file("%s/boot/loader.conf" % DESTDIR, "w+") -lc.write("# /boot/loader.conf generated by finstall makeimage.py on %s\n" % strftime("%Y-%m-%d %H:%M")) +lc.write("# /boot/loader.conf generated by finstall makeimage.py on %s\n" % str_time) lc.write('rootdev="iso9660/%s"\n' % LABEL) lc.write('boot_cdrom="1"\n') lc.close() +# Edit fstab +f = file("%s/etc/fstab" % DESTDIR, "w+") +f.write("# /etc/fstab generated by finstall makeimage.py on %s\n" % str_time) +f.write("/dev/iso9660/%s / cd9660 ro 0 0\n" % LABEL) +f.write("md /tmp mfs rw,-S,-s32m 0 0\n") +f.write("/tmp /etc unionfs rw,copymode=transparent 0 0\n") +f.close() + +# Edit rc.conf +f = file("%s/etc/rc.conf" % DESTDIR, "w+") +f.write("# /etc/rc.conf generated by finstall makeimage.py on %s\n" % str_time) +f.write('rc_debug="NO"\n') +f.write('hostname="finstall"\n') +f.write('background_fsck="NO"\n') +f.write('syslogd_flags="-C"\n') +f.close() + os.chdir(WORKDIR) -execute("mkisofs -l -nobak -V %s -T -J -r -ldots -b boot/cdboot -no-emul-boot -o %s/image.iso %s" % (LABEL, WORKDIR, DESTDIR)) +if ISO == None: + ISO = "%s/image.iso" % WORKDIR +execute("mkisofs -l -nobak -V %s -T -J -r -ldots -b boot/cdboot -no-emul-boot -o %s %s" % (LABEL, ISO, DESTDIR))