[Pkg-uml-commit] r45 - in trunk/src/rootstrap: . debian modules
Mattia Dongili
malattia at costa.debian.org
Sat Apr 8 11:06:33 UTC 2006
Author: malattia
Date: 2006-04-08 11:03:31 +0000 (Sat, 08 Apr 2006)
New Revision: 45
Added:
trunk/src/rootstrap/COPYING
trunk/src/rootstrap/Makefile
trunk/src/rootstrap/builder
trunk/src/rootstrap/debian/
trunk/src/rootstrap/debian/changelog
trunk/src/rootstrap/debian/control
trunk/src/rootstrap/debian/copyright
trunk/src/rootstrap/debian/dirs
trunk/src/rootstrap/debian/rules
trunk/src/rootstrap/dhclient-script
trunk/src/rootstrap/modules/
trunk/src/rootstrap/modules/base-config
trunk/src/rootstrap/modules/debian
trunk/src/rootstrap/modules/docpurge
trunk/src/rootstrap/modules/localepurge
trunk/src/rootstrap/modules/mkfs
trunk/src/rootstrap/modules/mkisofs
trunk/src/rootstrap/modules/mount
trunk/src/rootstrap/modules/network
trunk/src/rootstrap/modules/tasksel
trunk/src/rootstrap/modules/uml
trunk/src/rootstrap/modules/umount
trunk/src/rootstrap/rootstrap
trunk/src/rootstrap/rootstrap.conf
trunk/src/rootstrap/rootstrap.sgml
Log:
Import rootstrap source from current deb-src
Added: trunk/src/rootstrap/COPYING
===================================================================
--- trunk/src/rootstrap/COPYING 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/COPYING 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
Added: trunk/src/rootstrap/Makefile
===================================================================
--- trunk/src/rootstrap/Makefile 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/Makefile 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,39 @@
+prefix=/usr
+exec_prefix=$(prefix)
+sysconfdir=/etc
+libdir=$(exec_prefix)/lib
+mandir=$(prefix)/share/man
+pkgconfdir=$(sysconfdir)/rootstrap
+pkglibdir=$(libdir)/rootstrap
+
+all: rootstrap rootstrap.1
+
+install:
+ install -d $(DESTDIR)$(exec_prefix)/bin
+ install rootstrap $(DESTDIR)$(exec_prefix)/bin
+
+ install -d $(DESTDIR)$(pkglibdir)/modules
+ install -m 755 modules/[a-z]* $(DESTDIR)$(pkglibdir)/modules
+
+ install -d $(DESTDIR)$(pkglibdir)
+ install builder $(DESTDIR)$(pkglibdir)
+
+ install -d $(DESTDIR)$(pkgconfdir)/modules
+ install -m 644 rootstrap.conf $(DESTDIR)$(pkgconfdir)
+
+ install -d $(DESTDIR)$(mandir)/man1
+ install -m 644 rootstrap.1 $(DESTDIR)$(mandir)/man1
+
+ install -m 755 dhclient-script $(DESTDIR)$(pkgconfdir)
+
+clean:
+ true
+
+rootstrap.1: rootstrap.sgml
+ docbook-to-man $< > $@
+
+check: test.ext2
+ linux ubd0=$< devfs=nomount
+
+test.ext2: rootstrap
+ ./rootstrap $@
Added: trunk/src/rootstrap/builder
===================================================================
--- trunk/src/rootstrap/builder 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/builder 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+import ConfigParser
+import os
+import sys
+
+sys.stdout.write("builder running...\n")
+
+# Initialization
+os.system("mount -t tmpfs tmpfs /etc")
+os.mkdir("/etc/rootstrap")
+os.system("mount -t hostfs hostfs -o /etc/rootstrap /etc/rootstrap")
+os.system("mount -t proc proc /proc")
+os.system("mount -t tmpfs tmpfs /tmp")
+os.mkdir("/tmp/target")
+os.mkdir("/tmp/host")
+os.system("mount -t hostfs hostfs /tmp/host")
+
+# Parse kernel command line
+workdir = '~/.rootstrap'
+configfile = None
+for arg in open('/proc/cmdline').read().split():
+ argsplit = arg.split('=')
+ if len(argsplit) > 1:
+ if argsplit[0] == 'rsworkdir':
+ workdir = os.path.expanduser(argsplit[1])
+ elif argsplit[0] == 'rsconfig':
+ configfile = '/tmp/host' + os.path.expanduser(os.path.join('/tmp/host',os.path.expanduser(argsplit[1])))
+
+os.system("mount -t hostfs hostfs -o %s /etc/rootstrap/workdir" % workdir)
+
+def dispatch(module, vars):
+ "Invoke a rootstrap module"
+
+ found = 0
+ for scriptpat in ('/etc/rootstrap/workdir/modules/%s',
+ '/etc/rootstrap/modules/%s',
+ '/usr/lib/rootstrap/modules/%s'):
+ script = scriptpat % module
+ if os.path.exists(script):
+ print "Using rootstrap module %s from:\n\t%s" % (module,script)
+ status = os.spawnle(os.P_WAIT, script, script, vars)
+ if status != 0:
+ raise "rootstrap: Module '%s' failed, status: %d" % (module,status)
+ return
+
+ raise "rootstrap: unknown module: %s\n" % module
+
+config = ConfigParser.ConfigParser()
+config.optionxform = str # case sensitive
+config.readfp(open('/etc/rootstrap/rootstrap.conf'))
+config.read(('/etc/rootstrap/workdir/rootstrap.conf',))
+if configfile:
+ config.read(configfile)
+
+globalvars = { 'TARGET' : '/tmp/target', 'WORKDIR' : '/etc/rootstrap/workdir' }
+for var in config.options('global'):
+ globalvars[var] = config.get('global', var)
+
+for module in config.get('global', 'modules').split():
+ modulevars = globalvars
+ if config.has_section(module):
+ for var in config.options(module):
+ modulevars[var] = config.get(module,var)
+
+ dispatch(module, modulevars)
+
+os.system("mount -o remount,ro hostfs /")
+os.system("/sbin/halt -d -f")
Property changes on: trunk/src/rootstrap/builder
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/rootstrap/debian/changelog
===================================================================
--- trunk/src/rootstrap/debian/changelog 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/debian/changelog 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,280 @@
+rootstrap (0.3.21-1) unstable; urgency=low
+
+ * If there are no processes left running which use the target
+ filesystem, don't let the (failing) fuser call abort the entire script
+ (Closes: #255531)
+
+ -- Matt Zimmerman <mdz at debian.org> Mon, 21 Jun 2004 12:08:06 -0700
+
+rootstrap (0.3.20-1) unstable; urgency=low
+
+ * Only pay attention to the [network]/gateway option when not using
+ uml=dhcp
+ * Divert start-stop-daemon, as debootstrap does, while installing
+ packages with apt
+ * Use fuser to kill off any processes using the target root fs, so that
+ it can be unmounted
+
+ -- Matt Zimmerman <mdz at debian.org> Sun, 6 Jun 2004 11:28:16 -0700
+
+rootstrap (0.3.19-1) unstable; urgency=low
+
+ * The initialsize/freespace settings seem to confuse people; increase
+ initialsize and set freespace to zero, to get a 1GB sparse image with
+ no resizing by default (Closes: #205972)
+
+ -- Matt Zimmerman <mdz at debian.org> Sun, 14 Mar 2004 18:34:20 -0800
+
+rootstrap (0.3.18-1) unstable; urgency=low
+
+ * New base-config module, which invokes base-config to configure the
+ base system. This currently only works on sarge+ because it uses
+ debconf-set-selections, and it doesn't really work there either due to
+ limitations in base-config (it doesn't honor some important pre-seeded
+ debconf responses)
+ * Set default root password to 'rootstrap' in base-config module
+ (Closes: #224430)
+ * New tasksel module
+ * Fix -u/--umlargs, rename to --umlarg and have it only take one argument
+
+ -- Matt Zimmerman <mdz at debian.org> Mon, 16 Feb 2004 11:33:31 -0800
+
+rootstrap (0.3.17-1) unstable; urgency=low
+
+ * Make "imagefile" one word on the man page, so it's clear that it's a
+ single argument
+ * -s is in megabytes, like initialsize in rootstrap.conf
+ * Make the network/control parameter, used with the daemon transport,
+ optional, since UML now has a reasonable compiled-in default
+
+ -- Matt Zimmerman <mdz at debian.org> Fri, 19 Sep 2003 21:42:37 -0400
+
+rootstrap (0.3.16-1) unstable; urgency=low
+
+ * Set the hostname in the rootstrapped system, rather than
+ leaving it blank (some packages can't install without a hostname).
+ Thanks to Mike Snitzer for working this out
+ rootstrap still doesn't really configure the base system (suggestions
+ welcome; see #211397)
+ * set -e on more modules
+
+ -- Matt Zimmerman <mdz at debian.org> Wed, 17 Sep 2003 10:19:47 -0400
+
+rootstrap (0.3.15-1) unstable; urgency=low
+
+ * Add -c/--config option to specify a config file to read
+
+ -- Matt Zimmerman <mdz at debian.org> Mon, 15 Sep 2003 19:15:28 -0400
+
+rootstrap (0.3.14-1) unstable; urgency=low
+
+ * [modules/debian] Transfer DNS configuration into resolv.conf in the
+ generated system
+ * Correctly remount the hostfs-root read-only
+ * Make some of the modules more robust, and run with set -e
+ * [modules/{debian,network}] DHCP support for networking configuration
+ * [rootstrap.conf] Don't exclude dhcp-client anymore
+ * Change daemon transport syntax to match new interface (no more
+ separate data socket)
+
+ -- Matt Zimmerman <mdz at debian.org> Sun, 14 Sep 2003 20:46:43 -0400
+
+rootstrap (0.3.13-1) unstable; urgency=low
+
+ * Fix ext3 handling (mkfs.ext3 works fine without -j)
+ (Closes: #199882)
+ * Add support for uml_switch networking (Closes: #207631)
+
+ -- Matt Zimmerman <mdz at debian.org> Mon, 1 Sep 2003 13:42:15 -0400
+
+rootstrap (0.3.12-1) unstable; urgency=low
+
+ * Increase default initalsize to 256, which is enough room for
+ base+build-essential+umlrun on i386. Note that this is created
+ sparsely, and shrunk down to reflect freespace if it is not used
+ * Depend on more recent user-mode-linux, for new hostfs-root syntax
+ (Closes: #197480)
+ * Really fix the stupid man page problem (Closes: #191767)
+
+ -- Matt Zimmerman <mdz at debian.org> Thu, 19 Jun 2003 16:03:02 -0400
+
+rootstrap (0.3.11-1) unstable; urgency=low
+
+ * When network configuration is enabled in the debian module, configure
+ the loopback interface as well
+ * Fiddle with man page so that it doesn't eat a line of input.
+ I hate groff (Closes: #191767)
+ * Add network/slirp config option, primarily for use with the patch in
+ #175093 (hopefully will be merged soon)
+
+ -- Matt Zimmerman <mdz at debian.org> Sat, 3 May 2003 13:54:51 -0400
+
+rootstrap (0.3.10-1) unstable; urgency=low
+
+ * Fix the debian module's 'install' directive to be non-interactive
+ * Patch from Brian May to invoke dpkg in the target rather than using
+ dpkg --root (Closes: #189355)
+ * Handle building on a block device a bit more gracefully (I hope)
+ (Closes: #188047)
+
+ -- Matt Zimmerman <mdz at debian.org> Sun, 20 Apr 2003 15:39:38 -0400
+
+rootstrap (0.3.9-1) unstable; urgency=low
+
+ * Use new syntax for mounting root hostfs
+ * Only clobber regular files (Closes: #185672)
+
+ -- Matt Zimmerman <mdz at debian.org> Fri, 4 Apr 2003 21:12:49 -0500
+
+rootstrap (0.3.8-1) unstable; urgency=low
+
+ * Use DEBIAN_FRONTEND=noninteractive, not Noninteractive
+ (Closes: #175958)
+ * Preconfigured tap support (Closes: #166152)
+ * Use long integers so that larger image sizes work (Closes: #183375)
+ * Add vim magic comment (Closes: #183350)
+ * Suggests: slirp
+
+ -- Matt Zimmerman <mdz at debian.org> Tue, 4 Mar 2003 19:39:49 -0500
+
+rootstrap (0.3.7-1) unstable; urgency=low
+
+ * Add support for the slirp transport. For this to be really useful,
+ you must rebuild slirp with the FULL_BOLT option for reasonable
+ performance. However, once this is done, networking works with no
+ address configuration or root access.
+
+ -- Matt Zimmerman <mdz at debian.org> Thu, 9 Jan 2003 21:37:46 -0500
+
+rootstrap (0.3.6-1) unstable; urgency=low
+
+ * Update and clarify man page
+ * Fix one-character error which prevent the -u/--umlargs option fram working
+
+ -- Matt Zimmerman <mdz at debian.org> Mon, 21 Oct 2002 22:16:05 -0400
+
+rootstrap (0.3.5-1) unstable; urgency=low
+
+ * Add support to the debian module for saving the network configuration
+ to /etc/network/interfaces
+ * Add pointer to GPL in copyright (thanks, linda)
+
+ -- Matt Zimmerman <mdz at debian.org> Sat, 21 Sep 2002 18:43:48 -0400
+
+rootstrap (0.3.4-1) unstable; urgency=low
+
+ * Fix default configuration to use a valid Debian mirror.
+ Thanks to smoerk at gmx.de for pointing this out.
+ * s/DEBCONF_FRONTEND/DEBIAN_FRONTEND/ so that we correctly get the
+ noninteractive frontend. This should cut down greatly on debconf
+ warnings.
+ * Fix a bug whereby if a module was overloaded by a local version, the
+ original was still run. Chaos ensued when both modules executed.
+
+ -- Matt Zimmerman <mdz at debian.org> Thu, 25 Jul 2002 13:36:09 -0400
+
+rootstrap (0.3.3-1) unstable; urgency=low
+
+ * Don't fail if no network configuration is specified. This allows
+ installations from local mirrors and CDs.
+ (Closes: #151478)
+ * Be more conservative, and fail the entire build process if any module
+ fails. This makes it harder to overlook important errors.
+ * Clarify documentation for the debian/mirror option, which must be a
+ URL understood by debootstrap (Closes: #151482)
+
+ -- Matt Zimmerman <mdz at debian.org> Sun, 30 Jun 2002 19:41:56 -0400
+
+rootstrap (0.3.2-1) unstable; urgency=low
+
+ * Mount the working directory as a separate hostfs filesystem, rather
+ than assuming it will be available via the root-hostfs mount. This
+ makes it possible to use /tmp as your workspace on the host
+ (Closes: #147712)
+
+ -- Matt Zimmerman <mdz at debian.org> Thu, 23 May 2002 20:02:09 -0400
+
+rootstrap (0.3.1-2) unstable; urgency=low
+
+ * Fix build-depends to reflect that we use docbook-to-man again
+ (Closes: #146590)
+
+ -- Matt Zimmerman <mdz at debian.org> Fri, 10 May 2002 23:57:08 -0400
+
+rootstrap (0.3.1-1) unstable; urgency=low
+
+ * Fix the mkisofs module so that it works with the new hostfs setup
+ * Remove build-dependency on mkcramfs
+ * Update uml module to add an fstab entry for /proc
+
+ -- Matt Zimmerman <mdz at debian.org> Tue, 7 May 2002 23:10:43 -0400
+
+rootstrap (0.3-1) unstable; urgency=low
+
+ * Get rid of the cramfs hack, instead use tmpfs filesystems to overlay
+ the parts of the host filesystem that we don't want (such as /etc)
+ * Fix all modules to use $TARGET instead of /target, as the target mount
+ point has moved (and could again). All custom modules must be updated
+ to use $TARGET.
+ * Add a setting to rootstrap.conf to allow configuration of a nameserver
+ (Closes: #143171)
+
+ -- Matt Zimmerman <mdz at debian.org> Wed, 17 Apr 2002 22:15:55 -0400
+
+rootstrap (0.2.4-1) unstable; urgency=low
+
+ * Build the man page with docbook-to-man instead of docbook2man, because
+ the latter seems to garble the output (Closes: #140857)
+ * Append /sbin:/usr/sbin to PATH when building, to ensure that mkcramfs
+ can be found (Closes: #142130)
+
+ -- Matt Zimmerman <mdz at debian.org> Wed, 10 Apr 2002 23:19:25 -0400
+
+rootstrap (0.2.3-1) unstable; urgency=low
+
+ * New code release
+ - Fix a bug in the creation of ubd devices by the uml module
+
+ -- Matt Zimmerman <mdz at debian.org> Thu, 28 Mar 2002 22:13:26 -0500
+
+rootstrap (0.2.2-1) unstable; urgency=low
+
+ * New code release
+ - Add an option to the debian module to install additional packages
+ with apt
+ - Make the installation of uml kernel modules an optional behaviour
+ - Use DEBCONF_FRONTEND=Noninteractive to suppress warning messages
+ about debconf falling back to it from other frontends
+ - Manually create a ubd0 device for UML, since potato's MAKEDEV
+ doesn't understand ubd
+ - Append /sbin:/usr/sbin to PATH so that we can always find tune2fs if
+ it is installed (Closes: #138398)
+
+ -- Matt Zimmerman <mdz at debian.org> Sat, 16 Mar 2002 16:14:01 -0500
+
+rootstrap (0.2.1-1) unstable; urgency=low
+
+ * New code release
+ - Pass devfs=mount to UML when booting the initial filesystem, since
+ the latest packages do not mount it by default
+
+ -- Matt Zimmerman <mdz at debian.org> Wed, 13 Mar 2002 09:26:42 -0500
+
+rootstrap (0.2-1) unstable; urgency=low
+
+ * New code release
+ - Includes man page (Closes: #137849)
+ - No need to try to remount root read-only now that cramfs is used
+ (old cruft)
+ - Removed unused -p option; I forget what it was intended to do
+ * Depend on debootstrap >= 0.1.16.4, because that version fixes
+ --include
+
+ -- Matt Zimmerman <mdz at debian.org> Tue, 12 Mar 2002 23:54:25 -0500
+
+rootstrap (0.1-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Matt Zimmerman <mdz at debian.org> Tue, 29 Jan 2002 03:58:56 -0500
+
Added: trunk/src/rootstrap/debian/control
===================================================================
--- trunk/src/rootstrap/debian/control 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/debian/control 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,30 @@
+Source: rootstrap
+Section: utils
+Priority: optional
+Maintainer: Matt Zimmerman <mdz at debian.org>
+Build-Depends: debhelper (>> 3.0.0), docbook-to-man
+Standards-Version: 3.5.2
+
+Package: rootstrap
+Architecture: i386
+Depends: python, user-mode-linux (>= 2.4.20-4um-1), debootstrap (>= 0.1.16.4), dpkg (>= 1.9.19)
+Recommends: uml-utilities
+Suggests: dhcp3-client, dhcp3-server
+Description: A tool for building complete Linux filesystem images
+ Rootstrap was originally written to provide a facility for building
+ filesystems for use with User-mode Linux, but can be useful in other
+ applications as well.
+ .
+ It uses a modular set of shell scripts to create the filesystem
+ image, install a base system, and customize it for a particular
+ application. Currently, it only builds Debian systems, but the
+ architecture is such that other base systems could be used instead.
+ .
+ Use of rootstrap does not require root access, or special privileges
+ of any kind. This is because it builds the filesystem inside a
+ User-mode Linux system running under an
+ unprivileged uid.
+ .
+ Filesystem creation with rootstrap is quick and painless. With a
+ local mirror and a single command, a fresh Debian woody filesystem
+ can be created in about 3 minutes on relatively modest hardware.
Added: trunk/src/rootstrap/debian/copyright
===================================================================
--- trunk/src/rootstrap/debian/copyright 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/debian/copyright 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,29 @@
+This package was debianized by Matt Zimmerman <mdz at debian.org> on
+Tue, 29 Jan 2002 03:58:56 -0500.
+
+It has no distribution site of its own.
+
+Upstream Author: Matt Zimmerman <mdz at debian.org>
+
+Copyright:
+
+
+ rootstrap
+ Copyright (C) 2002 Matt Zimmerman
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+On Debian systems, a copy of the GPL may be found in
+/usr/share/common-licenses/GPL.
Added: trunk/src/rootstrap/debian/dirs
===================================================================
--- trunk/src/rootstrap/debian/dirs 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/debian/dirs 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1 @@
+etc/rootstrap/workdir
Added: trunk/src/rootstrap/debian/rules
===================================================================
--- trunk/src/rootstrap/debian/rules 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/debian/rules 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,82 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=3
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+# Add here commands to configure the package.
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+# Add here commands to compile the package.
+ $(MAKE)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+# Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+# Add here commands to install the package into debian/rootstrap.
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/rootstrap
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+# dh_installdebconf
+ dh_installdocs
+ dh_installexamples
+# dh_installmenu
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+# dh_installcron
+# dh_installman
+ dh_installinfo
+# dh_undocumented
+ dh_installchangelogs
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_makeshlibs
+ dh_installdeb
+# dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on: trunk/src/rootstrap/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/rootstrap/dhclient-script
===================================================================
--- trunk/src/rootstrap/dhclient-script 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/dhclient-script 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+if [ "x$old_ip_address" = x ] || [ "x$old_ip_address" != "x$new_ip_address" ] \
+ || [ "x$reason" = xBOUND ] || [ "x$reason" = xREBOOT ]; then
+ ifconfig $interface inet $new_ip_address $new_subnet_arg $new_broadcast_arg
+ for router in $new_routers; do
+ route add default gw $router
+ done
+fi
Added: trunk/src/rootstrap/modules/base-config
===================================================================
--- trunk/src/rootstrap/modules/base-config 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/base-config 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,34 @@
+#!/bin/sh -e
+
+DEBIAN_FRONTEND=noninteractive
+export DEBIAN_FRONTEND
+
+if ! test -x $TARGET/usr/bin/debconf-set-selections; then
+ echo "debconf is too old for us to seed the database; not running base-config"
+ exit 0
+fi
+
+# set root password - We can't do this through base-config because the
+# passwd .config script clears the database before asking for the
+# password
+
+if [ -n "$root_password" ]; then
+ chroot $TARGET chpasswd <<"EOF"
+root:$root_password
+EOF
+fi
+
+# apt-setup insists on invoking clear(1)
+TERM=vt100
+export TERM
+# let apt-setup believe we're editing sources.list by hand; we already set it up
+EDITOR=touch
+export EDITOR
+
+chroot $TARGET debconf-set-selections <<"EOF"
+passwd passwd/make-user boolean false
+base-config apt-setup/uri_type text edit sources list by hand
+base-config base-config/pkgsel select nothing - you may manually run apt-get or any of the above later
+EOF
+
+chroot $TARGET base-config
Added: trunk/src/rootstrap/modules/debian
===================================================================
--- trunk/src/rootstrap/modules/debian 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/debian 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,98 @@
+#!/bin/sh -e
+
+divert() {
+ prog="$1"
+ mv $prog $prog.real
+ cat > $prog <<EOF
+#!/bin/sh
+
+echo "Fake $prog called, doing nothing"
+EOF
+ chmod 755 $prog
+}
+
+undivert() {
+ prog="$1"
+ mv $prog.real $prog
+}
+
+DEBIAN_FRONTEND=noninteractive
+export DEBIAN_FRONTEND
+
+if test -n "$exclude"; then
+ exclude=`echo $exclude | tr ' ' ,`
+ opts="--exclude=$exclude"
+fi
+
+if test -n "$include"; then
+ include=`echo $include | tr ' ' ,`
+ opts="$opts --include=$include"
+fi
+
+if test -n "$basedebs"; then
+ opts="$opts --unpack-tarball $basedebs"
+fi
+
+debootstrap $opts $dist $TARGET $mirror $script
+
+echo "deb $mirror $dist main" > $TARGET/etc/apt/sources.list
+
+rm -f $TARGET/var/lib/apt/lists/debootstrap.*
+
+if test -z "$keepdebs"; then
+ rm -f $TARGET/var/cache/apt/archives/*.deb
+fi
+
+echo $purge | tr ' ' '\n' | xargs --no-run-if-empty -t \
+ chroot $TARGET dpkg --purge
+
+echo $(hostname) > $TARGET/etc/hostname
+if [ -f /etc/hosts ]; then
+ install -m 644 /etc/hosts $TARGET/etc/hosts
+fi
+
+if test -n "$install"; then
+ divert $TARGET/sbin/start-stop-daemon
+ chroot $TARGET mount -t proc proc /proc
+ chroot $TARGET apt-get update
+ chroot $TARGET apt-get -y install $install
+ echo "Killing any processes running on the target fs:"
+ # kill any processes using the target fs
+ fuser -k -v -m $TARGET || true
+ chroot $TARGET umount /proc
+ undivert $TARGET/sbin/start-stop-daemon
+fi
+
+if [ "$netconfig" != "no" ]; then
+ . /tmp/rootstrap.netconf
+ cat <<EOF >> $TARGET/etc/network/interfaces
+auto lo
+iface lo inet loopback
+
+auto $interface
+EOF
+ if [ "$address" = "dhcp" ]; then
+ cat <<EOF >> $TARGET/etc/network/interfaces
+iface $interface inet dhcp
+EOF
+ else
+ cat <<EOF >> $TARGET/etc/network/interfaces
+iface $interface inet static
+ address $address
+ netmask $netmask
+ gateway $gateway
+EOF
+ fi
+ if [ ! -e $TARGET/etc/resolv.conf ]; then
+ if [ -n "$domain" ]; then
+ cat <<EOF >> $TARGET/etc/resolv.conf
+search $domain
+EOF
+ fi
+ if [ -n "$nameserver" ]; then
+ cat <<EOF >> $TARGET/etc/resolv.conf
+nameserver $nameserver
+EOF
+ fi
+ fi
+fi
Added: trunk/src/rootstrap/modules/docpurge
===================================================================
--- trunk/src/rootstrap/modules/docpurge 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/docpurge 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+rm -rf $TARGET/usr/share/doc $TARGET/usr/share/man
Added: trunk/src/rootstrap/modules/localepurge
===================================================================
--- trunk/src/rootstrap/modules/localepurge 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/localepurge 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+for k in $keep; do
+ opts="$opts ! -name $k"
+done
+
+find $TARGET/usr/share/locale -maxdepth 1 -mindepth 1 $opts \
+ | xargs --no-run-if-empty rm -rf
Added: trunk/src/rootstrap/modules/mkfs
===================================================================
--- trunk/src/rootstrap/modules/mkfs 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/mkfs 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+# which others support -q?
+if [ $fstype = "ext2" -o $fstype = "ext3" ]; then
+ options="-q"
+fi
+
+mkfs.$fstype $options /dev/ubd/1
Added: trunk/src/rootstrap/modules/mkisofs
===================================================================
--- trunk/src/rootstrap/modules/mkisofs 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/mkisofs 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+if test -z "$output"; then
+ output="rootstrap.iso"
+fi
+
+mkisofs -R -q -o $WORKDIR/$output $options $TARGET
Added: trunk/src/rootstrap/modules/mount
===================================================================
--- trunk/src/rootstrap/modules/mount 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/mount 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+mount -n -t $fstype /dev/ubd/1 $TARGET
Added: trunk/src/rootstrap/modules/network
===================================================================
--- trunk/src/rootstrap/modules/network 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/network 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,37 @@
+#!/bin/sh -e
+
+if [ "$uml" = "dhcp" ]; then
+ ifconfig $interface up
+ # First try dhclient3, then dhclient
+ if ! dhclient3 -lf /tmp/dhclient.leases -sf /etc/rootstrap/dhclient-script; then
+ echo "dhclient3 failed, trying dhclient"
+ cp /etc/rootstrap/dhclient-script /etc
+ dhclient -lf /tmp/dhclient.leases $interface
+ fi
+else
+ ifconfig $interface $uml netmask $netmask
+
+ if [ -n "$gateway" ]; then
+ route add default gw $gateway
+ fi
+fi
+
+CONF=/tmp/rootstrap.netconf
+echo "interface=$interface" > $CONF
+echo "address=$uml" >> $CONF
+echo "netmask=$netmask" >> $CONF
+echo "gateway=$gateway" >> $CONF
+
+if test -n "$domain"; then
+ echo "domain $domain" > /etc/resolv.conf
+fi
+
+if test -n "$nameserver"; then
+ echo "nameserver $nameserver" >> /etc/resolv.conf
+fi
+
+if [ -z "$hostname" ]; then
+ hostname=rootstrap
+fi
+hostname "$hostname"
+echo "127.0.0.1 localhost $hostname.$domain $hostname" > /etc/hosts
Added: trunk/src/rootstrap/modules/tasksel
===================================================================
--- trunk/src/rootstrap/modules/tasksel 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/tasksel 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+if ! test -n "$flags"; then
+ exit 0
+fi
+
+chroot $TARGET dselect update
+chroot $TARGET mount /proc
+yes '' | chroot $TARGET tasksel $flags
+chroot $TARGET umount /proc
+chroot $TARGET apt-get clean
Added: trunk/src/rootstrap/modules/uml
===================================================================
--- trunk/src/rootstrap/modules/uml 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/uml 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+# Make bootable without DevFS
+mknod $TARGET/dev/ubd0 b 98 0
+
+chroot $TARGET /bin/sh -c 'cd /dev && ./MAKEDEV ubd'
+
+cat <<EOF > $TARGET/etc/fstab
+/dev/ubd0 / $fstype defaults 0 1
+proc /proc proc defaults 0 0
+EOF
+
+if [ "$install_modules" = "yes" -a -d /usr/lib/uml/modules ]; then
+ cp -R /usr/lib/uml/modules/* $TARGET/lib/modules
+fi
Added: trunk/src/rootstrap/modules/umount
===================================================================
--- trunk/src/rootstrap/modules/umount 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/modules/umount 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+umount -n $TARGET/proc || true
+umount -n $TARGET
Added: trunk/src/rootstrap/rootstrap
===================================================================
--- trunk/src/rootstrap/rootstrap 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/rootstrap 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+
+# vim: tabstop=4 noexpandtab
+#
+# rootstrap - Quickly and easily build Linux filesystem images
+# Copyright (C) 2002 Matt Zimmerman <mdz at debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+import os
+import sys
+import getopt
+import ConfigParser
+import shutil
+
+def usage(exitcode):
+ sys.stderr.write("Usage: rootstrap [options] <output image file>\n")
+ sys.exit(exitcode)
+
+config = ConfigParser.ConfigParser()
+config.readfp(open('/etc/rootstrap/rootstrap.conf'))
+config.read(('rootstrap.conf',))
+
+try:
+ (optlist,args) = getopt.getopt(sys.argv[1:], 's:u:o:c:',
+ ['image-size=', 'umlarg=', 'config='])
+except getopt.GetoptError:
+ usage(1)
+
+if len(args) < 1:
+ usage(1)
+
+# So that we can find tune2fs, resize2fs and such
+os.environ['PATH'] += ':/sbin:/usr/sbin'
+
+imagefile = args[0]
+imagesize = config.getint('global', 'initialsize')
+log = sys.stdout
+umlargs = ['linux']
+umlargs_extra = []
+
+for opt,arg in optlist:
+ if opt in ('-s', '--image-size'):
+ imagesize = long(arg)
+ elif opt in ('-o',):
+ log = open(arg,"w")
+ os.dup2(log.fileno(), sys.stdout.fileno())
+ elif opt in ('-c', '--config'):
+ umlargs_extra.append('rsconfig=%s' % os.path.abspath(os.path.expanduser(arg)))
+ elif opt in ('-u', '--umlarg'):
+ umlargs_extra.extend(arg.split())
+
+if config.has_option('network', 'interface'):
+ netif = config.get('network', 'interface', None)
+ if netif != None:
+ transport = config.get('network', 'transport')
+ if transport == 'tuntap':
+ if config.has_option('network','host_if'):
+ # Preconfigured tap
+ host_if = config.get('network','host_if')
+ else:
+ host_if = ''
+ hostaddr = config.get('network', 'host')
+ umlargs.append('%s=%s,%s,,%s' % (netif,transport,host_if,hostaddr))
+ elif transport == 'slirp':
+ umlargs.append('%s=slirp,,%s' % (netif, config.get('network','slirp','slirp')))
+ elif transport == 'daemon':
+ if config.has_option('network', 'control'):
+ umlargs.append('%s=daemon,,,%s' % (netif,
+ config.get('network', 'control'),
+ ))
+ else:
+ umlargs.append('%s=daemon' % netif)
+ else:
+ sys.stderr.write('Unsupported transport: %s' % transport)
+ sys.exit(1)
+
+umlargs.extend(umlargs_extra)
+
+umlargs.extend(['con0=fd:0,fd:1',
+ 'con=pty',
+ 'root=/dev/root',
+ 'rootflags=/',
+ 'rootfstype=hostfs',
+ 'ubd1=' + imagefile,
+ 'init=/usr/lib/rootstrap/builder',
+ 'devfs=mount',
+ 'rsworkdir=' + os.getcwd()])
+if config.has_option('global', 'umlargs'):
+ umlargs.extend(config.get('global', 'umlargs').split())
+
+if os.path.isfile(imagefile):
+ os.remove(imagefile)
+
+if not os.path.exists(imagefile):
+ image = open(imagefile,'w')
+ image.truncate(imagesize * 1048576L)
+ image.close()
+
+if os.spawnvpe(os.P_WAIT,umlargs[0], umlargs, os.environ) != 0:
+ sys.stderr.write("UML exited with non-zero status, aborting\n")
+ sys.exit(1)
+
+if config.has_option('global', 'freespace') and os.path.isfile(imagefile):
+ freespace_wanted = long(config.getint('global', 'freespace'))
+ if freespace_wanted != 0:
+ tune2fs = os.popen('tune2fs -l ' + imagefile)
+ freeblocks_natural = -1L
+ block_size = -1L
+ for line in tune2fs.readlines():
+ if line.find(':') == -1:
+ continue
+ label, value = line.split(':', 1)
+ if label == 'Block count':
+ size_natural = long(value)
+ elif label == 'Free blocks':
+ freeblocks_natural = long(value)
+ elif label == 'Block size':
+ block_size = long(value)
+
+ tune2fs.close()
+
+ if block_size == -1:
+ sys.stderr.write("Warning: Unable to determine block size, not resizing\n")
+ else:
+ print "Resizing filesystem..."
+ if freeblocks_natural == -1:
+ sys.stderr.write("Warning: Unable to determine free space, not resizing\n")
+ else:
+ freeblocks_wanted = freespace_wanted * block_size
+ if freeblocks_natural != freeblocks_wanted:
+ size_wanted = size_natural - freeblocks_natural + freeblocks_wanted
+ resize2fs = os.popen('resize2fs -f %s %s 2>&1' % (imagefile, size_wanted))
+ sys.stdout.write(resize2fs.read())
+ image = open(imagefile, 'r+')
+ image.truncate(size_wanted * block_size)
+ image.close()
Property changes on: trunk/src/rootstrap/rootstrap
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/src/rootstrap/rootstrap.conf
===================================================================
--- trunk/src/rootstrap/rootstrap.conf 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/rootstrap.conf 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,119 @@
+#
+# Global settings, these are passed on to all modules
+#
+[global]
+fstype=ext2
+
+# How large to create the initial image (MB). Be generous, as image
+# creation will fail if it is too small, and it will be created as a
+# sparse file, making it relatively inexpensive
+initialsize=1024
+
+# Will be resized to leave this much free space (MB) when building is
+# complete. Leave unset or set to 0 to disable resizing.
+freespace=0
+
+# Which modules to invoke. Each module can have its own section
+# below, with module-specific settings
+modules=network mkfs mount debian uml umount
+
+# Global environment variables
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+# Use of a caching proxy is highly recommended where a local mirror is
+# not available, so that packages are not fetched many times
+# unnecessarily. I use squid.
+#http_proxy=http://192.168.10.1:3128
+
+#
+# Networking
+#
+# required unless you have a local copy of all packages to be installed
+# these settings are only used during installation
+
+[network]
+
+#hostname=rootstrap
+
+# TUN/TAP configuration
+
+# For proxy ARP, use host=<your host's LAN IP address> and
+# uml=<a free LAN IP address for UML's use>
+
+# For a routing configuration, or if the installation process does not
+# need to reach anywhere except the host, use a separate RFC1918
+# subnet for the virtual network between the host and UML.
+
+#interface=eth0
+#transport=tuntap
+#host=192.168.10.1
+#uml=192.168.10.2
+#netmask=255.255.255.252
+
+# For a preconfigured tap device (see tunctl(1))
+#host_if=tap0
+
+# Use this for slirp
+#interface=eth0
+#transport=slirp
+#host=
+#uml=10.0.2.15
+#nameserver=10.0.2.3
+#gateway=10.0.2.2
+#netmask=255.255.0.0
+#slirp=slirp-fullbolt
+
+# Use this for uml_switch. uml-utilities will automatically start one
+# up, and users in the uml-net group can access it. Connect it to
+# a tap device to access the host (see /etc/default/uml-utilities)
+#interface=eth0
+#transport=daemon
+#uml=192.168.0.2
+#netmask=255.255.255.0
+#control=/var/run/uml-utilities/uml_switch.ctl
+#data=/var/run/uml-utilities/uml_switch.data
+
+# Gateway address (optional)
+# Note: you must have IP forwarding set up, or use proxy ARP, in order
+# to reach external hosts. See the User-Mode Linux documentation.
+#gateway=192.168.10.1
+
+# DNS configuration
+# optional if you are fetching packages through a proxy
+
+#domain=example.com
+#nameserver=192.168.10.1
+
+#
+# Debian module
+#
+[debian]
+dist=woody
+
+# A local mirror is best, a caching proxy (such as squid) is almost as
+# good
+
+mirror=http://http.us.debian.org/debian
+
+# Packages which should not be installed in the first place (be sure
+# you know what you're doing)
+exclude=pcmcia-cs setserial
+
+# Packages which should be purged after the initial install
+#<purge=base-config console-common console-tools console-data console-tools-libs
+
+# Extra packages to install via debootstrap
+#include=myfavoritepackage someotherpackage
+
+# Extra packages to install via apt after initial debootstrap install
+#install=myfavoritepackage someotherpackage
+
+[base-config]
+root_password=rootstrap
+
+[tasksel]
+# This should always include -n. See tasksel(8)
+#flags=-n -s
+
+[uml]
+install_modules=yes
Added: trunk/src/rootstrap/rootstrap.sgml
===================================================================
--- trunk/src/rootstrap/rootstrap.sgml 2006-04-08 10:58:31 UTC (rev 44)
+++ trunk/src/rootstrap/rootstrap.sgml 2006-04-08 11:03:31 UTC (rev 45)
@@ -0,0 +1,471 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+ -->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Matt</firstname>">
+ <!ENTITY dhsurname "<surname>Zimmerman</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>March 12, 2002</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>mdz at debian.org</email>">
+ <!ENTITY dhusername "Matt Zimmerman">
+ <!ENTITY dhucpackage "<refentrytitle>rootstrap</refentrytitle>">
+ <!ENTITY dhpackage "rootstrap">
+
+ <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+]>
+
+<refentry>
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2002</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+ <refmeta>
+ &dhucpackage;
+
+ &dhsection;
+ </refmeta>
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+
+ <refpurpose>Construct a root filesystem image in a file</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>rootstrap</command>
+ <arg choice=opt
+ rep=repeat><replaceable>options</replaceable></arg>
+
+ <arg choice=req><replaceable>imagefile</replaceable></arg>
+
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>
+ rootstrap is a tool for creating root filesystem images. It was
+ written primarily for use with User-Mode Linux, but may be
+ useful for other purposes as well.
+ </para>
+
+ <para>
+ Because it uses User-Mode Linux to bootstrap itself, rootstrap
+ can be used without root privileges on the host system, which
+ are normally required for this task in order to use chroot(2)
+ and mount and unmount filesystems. Rootstrap boots UML and uses
+ tools from the host filesystem to perform installation and
+ configuration tasks.
+ </para>
+
+ </refsect1>
+ <refsect1>
+ <title>OPTIONS</title>
+
+ <variablelist>
+ <varlistentry>
+ <term>-s, --image-size</term>
+ <listitem>
+ <para>
+ Sets the initial size of the image, in megabytes,
+ overriding the initialsize option in rootstrap.conf.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-o <replaceable>logfile</replaceable></term>
+ <listitem>
+ <para>
+ Log the output of the creation process to
+ <replaceable>logfile</replaceable> instead of to standard
+ output.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-u <replaceable>args</replaceable>, --umlargs <replaceable>args</replaceable></term>
+ <listitem>
+ <para>
+ Pass additional arguments to user-mode linux when booting
+ to create the image. Supplements the 'umlargs' option in
+ rootstrap.conf.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Configuration</title>
+
+ <para>
+ The configuration file consists of sections, starting with a
+ "[section]" header, followed by "option: value" entries, with
+ continuations and such in the style of RFC 822.
+ </para>
+
+ <para>
+ With the exception of the special section "global", sections are
+ named after a corresponding module. When that module is
+ executed, it receives the option/value pairs in its section as
+ environment variables. All modules inherit global options as
+ environment variables, except where overridden by options within
+ their specific section. At least PATH must be set here, in
+ addition to the required parameters listed below under [global].
+ </para>
+
+ <para>
+ Documentation for configurable modules distributed with
+ rootstrap is included below. This section is currently
+ incomplete.
+ </para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Modules</title>
+
+ <refsect2>
+ <title>[global]</title>
+
+ <para>
+ Contains configuration options that affect the operation of
+ rootstrap itself, or several modules.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term>fstype</term>
+ <listitem>
+ <para>
+ The type of filesystem to create (ext2, ext3, reiserfs,
+ etc.)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>initialsize</term>
+ <listitem>
+ <para>
+ The initial size of the filesystem image (in megabytes).
+ This must be large enough to contain a complete
+ installed system as produced by the selected modules.
+ It will be created sparsely, so additional space is not
+ entirely allocated until it is used.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>freespace</term>
+ <listitem>
+ <para>
+ The amount of free space to leave on the filesystem (in
+ megabytes). The filesystem will be resized, if
+ possible, to adjust the amount of free space to
+ approximately this amount.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>modules</term>
+ <listitem>
+ <para>
+ The list of modules to invoke, in order. Each module
+ will be searched for in several directories, listed in
+ the FILES section below, and passed environment
+ variables based on the options set in the corresponding
+ section of the configuration file.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect2>
+
+ <refsect2>
+ <title>[network]</title>
+
+ <para>
+ Network configuration. This module configures virtual
+ networking with the user-mode Linux system used to build the
+ filesystem image. Its presence is not strictly necessary, if
+ the selected modules do not require network access (for
+ example, with a local package mirror) and the network module
+ is not included in the global "modules" list.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term>interface</term>
+ <listitem>
+ <para>
+ The name of the UML network interface to configure,
+ typically "eth0". This parameter is mandatory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>host</term>
+ <listitem>
+ <para>
+ The IP address of the host side of the interface (the
+ host on which rootstrap is run). This parameter is
+ mandatory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>uml</term>
+ <listitem>
+ <para>
+ The IP address of the UML side of the interface (where
+ the system is being built). This parameter is mandatory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>transport</term>
+ <listitem>
+ <para>
+ The type of virtual networking interface to be used.
+ Typically "tuntap". This parameter is mandatory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>netmask</term>
+ <listitem>
+ <para>
+ The netmask for the network interface (applies to both
+ sides). This parameter is mandatory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>gateway</term>
+ <listitem>
+ <para>
+ A default gateway to be used by the user-mode Linux
+ system. This parameter is optional.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </refsect2>
+
+ <refsect2>
+ <title>[debian]</title>
+
+ <para>
+ Debian installation. This module installs a basic Debian
+ system using debootstrap.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term>dist</term>
+ <listitem>
+ <para>
+ The distribution to install (e.g., potato, woody, etc.)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>mirror</term>
+ <listitem>
+ <para>
+ A URL for a Debian archive containing the base
+ packages. This must be a URL understood by debootstrap,
+ which as of this writing includes URLs understood by
+ wget, and file: URLs.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>exclude</term>
+ <listitem>
+ <para>
+ A list of packages which should be excluded (never
+ installed at all). It is quite possible to produce a
+ broken system, or fail to build a system at all, if this
+ option is used improperly. It is useful for excluding
+ packages, such as pcmcia-cs, which are typically not
+ necessary for UML and other applications.
+ </para>
+
+ <para>
+ Corresponds to debootstrap's --exclude option
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>purge</term>
+ <listitem>
+ <para>
+ A list of packages which should be removed after
+ installation is complete. Use this for packages which
+ are required during installation, but may be removed
+ afterward. The same warning applies as with the exclude
+ option.
+ </para>
+
+ <para>
+ Packages are removed with dpkg --purge.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>include</term>
+ <listitem>
+ <para>
+ A list of packages which should be included in the
+ initial set of packages to install.
+ </para>
+
+ <para>
+ Corresponds to debootstrap's --include option
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </refsect2>
+
+ <refsect2>
+ <title>Custom modules</title>
+
+ <para>
+ Custom modules can very easily be used by rootstrap, in
+ addition to (or in place of) the supplied modules. See FILES
+ below for locations that are searched for modules.
+ </para>
+
+ <para>
+ When a module is invoked, the filesystem being created is
+ mounted on $TARGET. /etc and /tmp are tmpfs filesystems
+ internal to the UML system, while the root filesystem is a
+ hostfs mount of the system where rootstrap is running. This
+ means that most software on the host system should be
+ available and work as expected. The working directory where
+ rootstrap is run is available as $WORKDIR. The environment is
+ generated from the configuration file as described above.
+ </para>
+ </refsect2>
+
+ </refsect1>
+
+ <refsect1>
+ <title>FILES</title>
+
+ <variablelist>
+ <varlistentry>
+ <term>/etc/rootstrap/rootstrap.conf</term>
+ <listitem>
+ <para>
+ System-wide default configuration
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>rootstrap.conf</term>
+ <listitem>
+ <para>
+ Local overrides
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>/usr/lib/rootstrap/modules</term>
+ <listitem>
+ <para>
+ Modules distributed with rootstrap
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>/etc/rootstrap/modules</term>
+ <listitem>
+ <para>
+ System-wide overrides and additional modules
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>modules</term>
+ <listitem>
+ <para>
+ Local overrides and additional modules
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHOR</title>
+
+ <para>Rootstrap was written by &dhusername; &dhemail;</para>
+
+ </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
More information about the Pkg-uml-commit
mailing list