PERFORCE change 125979 for review
Ivan Voras
ivoras at FreeBSD.org
Sun Sep 2 12:21:55 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=125979
Change 125979 by ivoras at ivoras_finstall on 2007/09/02 19:21:08
Sync to the source as published in the "alpha" / technology preview
LiveCD image.
- implement post-install configuration of timezone, x.org
- make makeimage.py more generic (separate finstall-specific parts into
"-f" switch
Affected files ...
.. //depot/projects/soc2007/ivoras_finstall/README.txt#4 edit
.. //depot/projects/soc2007/ivoras_finstall/installer/basewin.py#7 edit
.. //depot/projects/soc2007/ivoras_finstall/installer/finstall.py#16 edit
.. //depot/projects/soc2007/ivoras_finstall/makeimage/makeimage.py#12 edit
.. //depot/projects/soc2007/ivoras_finstall/pybackend/systoolengine.py#13 edit
Differences ...
==== //depot/projects/soc2007/ivoras_finstall/README.txt#4 (text+ko) ====
@@ -1,1 +1,9 @@
This is a starting entry for `finstall` project. More info to come.
+
+The project is made of three subprojects:
+
+ - installer - PyGTK installer
+ - pybackend - installer / configuration backend written in python
+ - makeimage - Python script for LiveCD ISO image creation
+
+See http://wiki.freebsd.org/finstall for more information.
==== //depot/projects/soc2007/ivoras_finstall/installer/basewin.py#7 (text+ko) ====
@@ -109,7 +109,5 @@
m = re.match(r"(\d+)\.(\d+)\.(\d+)\.(\d+)", addr)
if m == None:
return False
- if 0 <= int(m.group(1)) <= 255 and 0 <= int(m.group(2)) <= 255 and 0 <= int(m.group(3)) <= 255 and 0 <= int(m.group(4)) <= 255:
- return True
- return False
+ return 0 <= int(m.group(1)) <= 255 and 0 <= int(m.group(2)) <= 255 and 0 <= int(m.group(3)) <= 255 and 0 <= int(m.group(4)) <= 255
==== //depot/projects/soc2007/ivoras_finstall/installer/finstall.py#16 (text+ko) ====
@@ -894,6 +894,8 @@
def nfinish_on_load(self):
self._load_label(self["label2"], "nfinish.txt")
+ if "new_parts" in self.trackdata and len(self.trackdata["new_parts"]) > 0:
+ self.trackdata["postinstall_job"] = self.server.StartPostInstallJob(self.trackdata["new_parts"], True)
return True
==== //depot/projects/soc2007/ivoras_finstall/makeimage/makeimage.py#12 (text+ko) ====
@@ -38,7 +38,7 @@
raise MakeImageException("This utility requires mkisofs(8) (install ports/sysutils/cdrtools)")
def usage(exit=True):
- print "usage: %s -d WORKDIR [-i ISOFILE] [-k KERNEL] [-p PKGLISTFILE] [-s SRCDIR] [-x BUNDLEDIR] [-b] [-c] " % sys.argv[0]
+ print "usage: %s -d WORKDIR [-i ISOFILE] [-k KERNEL] [-p PKGLISTFILE] [-s SRCDIR] [-x BUNDLEDIR] [-b] [-c] [-f]" % sys.argv[0]
print
print "Description:"
print " -d WORKDIR Base work directory to hold intermediate and final files"
@@ -58,6 +58,8 @@
print " and ISO image build. If specified only once, packages"
print " will get built and installed, if specified twice,"
print " packages will be skipped."
+ print " -f The image is to be created with special support for"
+ print " the finstall project (not a generic LiveCD)"
if exit:
sys.exit(1)
else:
@@ -70,6 +72,7 @@
DoBuild = False
DoMakeRoot = True # Create / install livecd tree
DoMakePkgs = True
+DoFinstallImage = False
LABEL = "FreeBSD7" # ISO9660 Volume label
BUNDLEDIR = "bundles"
BUNDLEFILE = "bundle-spec"
@@ -107,6 +110,8 @@
ISO = a
elif o == "-x":
BUNDLEDIR = a
+ elif o == "-f":
+ DoFinstallImage = True
elif o == "-h":
usage()
@@ -177,11 +182,14 @@
execute("make installkernel KERNCONF=%s DESTDIR=%s" % (KERNEL, DESTDIR))
execute("make distribution DESTDIR=%s" % DESTDIR)
execute("rm %s/boot/kernel/*.symbols" % DESTDIR)
- os.chdir(DESTDIR)
- f = file("maptree.txt", "w")
- write_maptree(".", f)
+ if not os.path.exists("%s/install" % DESTDIR):
+ os.mkdir("%s/install" % DESTDIR)
+ f = file("%s/install/base.maptree" % DESTDIR, "w")
+ write_maptree(DESTDIR, f)
f.close()
execute("mtree -c > base.mtree")
+ if not os.path.exists("%s/dist" % DESTDIR):
+ os.mkdir("%s/dist" % DESTDIR)
os.chdir(STARTDIR)
else:
if not os.path.exists(DESTDIR) or not os.path.exists("%s/COPYRIGHT" % DESTDIR):
@@ -198,6 +206,7 @@
# Install packages into the liveCD tree, using chroot
printmsg("Bundling packages")
master_pkglist = []
+ pkgflags = {}
f = file(PKGLISTFILE, "r")
for line in f.readlines():
line = line.strip()
@@ -205,10 +214,17 @@
continue
if line[0] == "#":
continue
- fullname = getpkgfullname(line)
+ if line.find(";") != -1:
+ pf = line.split(";")
+ fullname = getpkgfullname(pf[0])
+ flags = pf[1:]
+ else:
+ fullname = getpkgfullname(line)
+ flags = []
if fullname == None:
printmsg("Fatal error: cannot find package %s" % line)
sys.exit(1)
+ pkgflags[fullname] = flags
master_pkglist.append(fullname)
dest_pkgs = {}
for pkg in master_pkglist:
@@ -228,7 +244,10 @@
f.write("pkg_delete -a\n")
for pkg in master_pkglist:
f.write("echo --- Installing %s\n" % pkg)
- f.write("/usr/sbin/pkg_add %s\n" % dest_pkgs[pkg])
+ if 'yes' in pkgflags[pkg]: # the package has post-install script that needs to be yes'ed
+ f.write("/usr/bin/yes yes | pkg_add %s\n" % dest_pkgs[pkg])
+ else:
+ f.write("/usr/sbin/pkg_add %s\n" % dest_pkgs[pkg])
f.close()
for pkg in dest_pkgs.keys():
if pkg == None:
@@ -238,6 +257,14 @@
for pkg in dest_pkgs:
os.unlink(dest_pkgs[pkg])
os.unlink("pkginst.sh")
+ if not os.path.exists("%s/install" % DESTDIR):
+ os.mkdir("%s/install" % DESTDIR)
+ f = file("%s/install/vardbpkg.maptree" % DESTDIR, "w")
+ write_maptree("%s/var/db/pkg" % DESTDIR, f)
+ f.close()
+ f = file("%s/install/usrlocal.maptree" % DESTDIR, "w")
+ write_maptree("%s/usr/local" % DESTDIR, f)
+ f.close()
os.chdir(STARTDIR)
@@ -296,30 +323,33 @@
else:
printmsg("WARNING: Not bundling any config files")
-### finstall-specific part ###
-# Everything done until now has been for a generic LiveCD. Now, do some magic
-# (configuration mostly) for finstall.
+
+if DoFinstallImage:
+ ### finstall-specific part ###
+ # Everything done until now has been for a generic LiveCD. Now, do some magic
+ # (configuration mostly) for finstall.
-# Create an alternative root user named "install" and make it run startx when
-# logged in.
-install_found = False
-f = file("%s/etc/passwd" % DESTDIR, "r")
-for line in f.readlines():
- if line.startswith("install:"):
- install_found = True
-f.close()
-if not install_found:
- f = file("%s/tmp/userinst.sh" % DESTDIR, "w")
- f.write("pw useradd -n install -o -u 0 -d /install -m -s /bin/tcsh -w none -c Installer")
+ # Create an alternative root user named "install" and make it run startx when
+ # logged in.
+ install_found = False
+ f = file("%s/etc/passwd" % DESTDIR, "r")
+ for line in f.readlines():
+ if line.startswith("install:"):
+ install_found = True
f.close()
- execute("chroot %s /bin/sh /tmp/userinst.sh" % DESTDIR)
- os.unlink("%s/tmp/userinst.sh" % DESTDIR)
+ if not install_found:
+ f = file("%s/tmp/userinst.sh" % DESTDIR, "w")
+ f.write("pw useradd -n install -o -u 0 -d /install -m -s /bin/tcsh -w none -c Installer")
+ f.close()
+ execute("chroot %s /bin/sh /tmp/userinst.sh" % DESTDIR)
+ os.unlink("%s/tmp/userinst.sh" % DESTDIR)
-skel_data = file("%s/usr/share/skel/dot.login" % DESTDIR, "r").read()
-f = file("%s/install/.login" % DESTDIR, "w")
-f.write(skel_data)
-f.write("startx\n")
-f.close()
+ skel_data = file("%s/usr/share/skel/dot.login" % DESTDIR, "r").read()
+ f = file("%s/install/.login" % DESTDIR, "w")
+ f.write(skel_data)
+ f.write("/usr/local/bin/python /install/prelogin.py\n")
+ f.write("startx\n")
+ f.close()
# finish usr image
==== //depot/projects/soc2007/ivoras_finstall/pybackend/systoolengine.py#13 (text+ko) ====
@@ -298,7 +298,8 @@
self.result = str(e)
if self.error == None:
# create fstab
- f = file("%s/etc/fstab" % install_root, "w+")
+ logging.info("Generating %s/etc/fstab" % install_root)
+ f = file("%s/etc/fstab" % install_root, "w")
f.write("# Generated by finstall on %s\n" % time.strftime("%c"))
f.write("# Device\tMountpoint\tFStype\tOptions\tDump\tPass\n")
for part in self.part_spec:
@@ -307,6 +308,8 @@
if line != None:
f.write("%s\n" % line)
f.close()
+ else:
+ logging.info("Skipping fstab generation because of "+self.result)
self.finished = True
@@ -367,6 +370,12 @@
def run(self):
self.systool.SetConf("moused_enable", "YES", "Enable system mouse") # by default
+ if os.path.exists("/etc/localtime"):
+ shutil.copyfile("/etc/localtime", "%s/etc/localtime" % self.systool.root_dest)
+ if os.path.exists("/etc/X11/xorg.conf"):
+ if not os.path.exists("%s/etc/X11" % self.systool.root_dist):
+ os.mkdir("%s/etc/X11" % self.systool.root_dist)
+ shutil.copyfile("/etc/X11/xorg.conf", "%s/etc/X11/xorg.conf" % self.systool.root_dist)
code, result = self.UmountPartitions(self.part_spec, self.INSTALL_ROOT, force)
if code != 0:
self.error = code
@@ -963,15 +972,3 @@
return result
-
-
-
-
-
-
-
-
-
-
-
-
More information about the p4-projects
mailing list