vserver-debiantools-0.8.1/0000775000000000000000000000000011615711203012402 5ustar vserver-debiantools-0.8.1/debian/0000775000000000000000000000000011615711203013624 5ustar vserver-debiantools-0.8.1/debian/rules0000775000000000000000000000330111173250420014677 0ustar #!/usr/bin/make -f # -*- makefile -*- # 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 CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif 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/vserver-debiantools. $(MAKE) install DESTDIR=$(CURDIR)/debian/vserver-debiantools # 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_installchangelogs dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_python # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure vserver-debiantools-0.8.1/debian/compat0000664000000000000000000000000211173250420015020 0ustar 4 vserver-debiantools-0.8.1/debian/changelog0000664000000000000000000003650511615711145015514 0ustar vserver-debiantools (0.8.1) unstable; urgency=low * Debian is spelled with a capital D. Closes: #627624. -- Ola Lundqvist Tue, 02 Aug 2011 07:59:26 +0200 vserver-debiantools (0.8.0) unstable; urgency=low * Removed the support for apt.conf copy from host as this cause failures in certain cases. Closes: #600738. -- Ola Lundqvist Wed, 03 Nov 2010 21:11:35 +0100 vserver-debiantools (0.7.2) unstable; urgency=low * Changes to allow install on squeeze. Without this change it is likely to fail. -- Ola Lundqvist Sat, 11 Sep 2010 21:21:24 +0200 vserver-debiantools (0.7.1) unstable; urgency=medium * Spelling correction. -- Ola Lundqvist Sat, 04 Sep 2010 18:52:41 +0200 vserver-debiantools (0.7) unstable; urgency=medium * Support for squeeze as Debian release. * Correction to a potential data overwrite issue. Closes: #579660. Thanks to Olivier Delemar for the patch. -- Ola Lundqvist Sat, 04 Sep 2010 10:43:58 +0200 vserver-debiantools (0.6.5) unstable; urgency=low * Updated hostname check to allow for single letter hostnames. Thanks to Yann Dirson that provided the final fix for this. Closes: #575367, #409862. -- Ola Lundqvist Thu, 01 Apr 2010 06:38:18 +0200 vserver-debiantools (0.6.4) unstable; urgency=low * Correction so that installation also works correctly on hosts with a point to point connection to the internet. Closes: #539448. Thanks to Stefan Tomanek for reporting and providing the solution to this problem. -- Ola Lundqvist Mon, 03 Aug 2009 07:12:27 +0200 vserver-debiantools (0.6.3) unstable; urgency=medium * Correction so that apt-get will be run instead of removed dselect. Closes: #507662. -- Ola Lundqvist Fri, 5 Dec 2008 22:09:55 +0100 vserver-debiantools (0.6.2) unstable; urgency=high * Correction in last version made it impossible to build any vserver. Correction for that problem. Closes: #482155. -- Ola Lundqvist Sat, 14 Jun 2008 13:01:37 +0200 vserver-debiantools (0.6.1) unstable; urgency=low * Can now handle empty INSTALL_PACKAGES or REMOVE_PACKAGES lines in a proper way. Closes: #482155. -- Ola Lundqvist Tue, 27 May 2008 07:42:30 +0200 vserver-debiantools (0.6.0) unstable; urgency=low * Now updated to support lenny, closes: #469365. * Correction for find option orders, closes: #421571. * Applied patch from Vincent Bernat to allow post install hooks in the host as well. Closes: #467293. -- Ola Lundqvist Fri, 21 Mar 2008 13:07:30 +0100 vserver-debiantools (0.5.1) unstable; urgency=low * Change template name substitutes to avoid binary file modifications. Closes: #469861, #219233. * Applied patch from Tijs van Dam to handle host ip in a correct way in both newvserver and newnfsvserver. Closes: #453635. -- Ola Lundqvist Fri, 21 Mar 2008 12:45:54 +0100 vserver-debiantools (0.5.0) unstable; urgency=low * Applied patch from Jochen Voss to make it possible to do fully unattended installs, closes: #445554. * Applied same patch to newnfsvserver as well. -- Ola Lundqvist Sun, 7 Oct 2007 12:33:00 +0200 vserver-debiantools (0.4.1) unstable; urgency=low * Correction of a minor path problem spotted by Jochen Voss . -- Ola Lundqvist Tue, 2 Oct 2007 22:01:14 +0200 vserver-debiantools (0.4.0) unstable; urgency=low * Correction for VROOTDIR assignment. Thanks to Justin Pryzby for spotting this. * Applied patch from Jochen Voss that make only one of hostname or ip option necessary if a nameserver is available. Closes: #444886. * Modified the patch so that dnsutils is not required, only recommended. * Applied patch from Jochen Voss to allow alternative mirrors for security and non-us(woody). Closes: #444868. * Make sure to strip trailing slashes for the other mirrors as well. * Manually merged the patches from Justin to apply on newnfsvserver.sh as well as some other merges. -- Ola Lundqvist Tue, 2 Oct 2007 08:31:27 +0200 vserver-debiantools (0.3.6) unstable; urgency=low * Applied patch from Jochen Voss to make sure that 127.0.0.1 is not used by the nameserver, closes: #426796. * Added iproute to the dependencies, because of the above changes and updated a number of copyright statements. -- Ola Lundqvist Mon, 20 Aug 2007 08:39:23 +0200 vserver-debiantools (0.3.5) unstable; urgency=low * No longer modify motd file as it is a symbolic link and pointing to the main server at rewrite. It is automatically rewritten anyway on vserver startup. Closes: #417597. Thanks to Vagrant Cascadian for pointing out this problem. -- Ola Lundqvist Tue, 10 Apr 2007 05:21:09 +0200 vserver-debiantools (0.3.4) unstable; urgency=medium * Changed documentation to show that etch is the default. * Updated the README file with some history. * Updated version information and made so that it is shown for all applications. -- Ola Lundqvist Sat, 9 Dec 2006 11:42:38 +0100 vserver-debiantools (0.3.3) unstable; urgency=low * Correction in how to handle new configuration scheme in dupvserver. -- Ola Lundqvist Mon, 28 Aug 2006 15:25:11 +0200 vserver-debiantools (0.3.2) unstable; urgency=low * Ignore the lintian error about syntax error. sh -n do not honor the shopt -s extglob call in the beginning, closes: #384639. -- Ola Lundqvist Sun, 27 Aug 2006 22:27:57 +0200 vserver-debiantools (0.3.1) unstable; urgency=low * Applied patch from Miroslav Kure , to correct a non-US issue, closes: #384641. -- Ola Lundqvist Sun, 27 Aug 2006 11:57:43 +0200 vserver-debiantools (0.3.0) unstable; urgency=low * Added support for new config scheme to dupvserver, closes: #307979. * Added support for new --context option to newnfsvserver and newvserver, closes: #376087. * Removed support for vreboot from newnfsvserver as it is considered as a legacy function, closes: #310952. * Correction of syntax error in newvserver, newnfsvserver and stripserver. -- Ola Lundqvist Tue, 22 Aug 2006 21:47:08 +0200 vserver-debiantools (0.2.10) unstable; urgency=low * Allow hostnames of less than 5 characters, thanks to Miroslav Kure , closes: #383672. * Applied patch from Miroslav Kure , to make newvserver behave better regarding locales, closes: #383682. Applied this patch against newnfsvserver and stripserver as well. * Corrected usage instructions for dupvserver, closes: #383675. * Make etch default distribution, closes: #383914. * Applied patch from Miroslav Kure , to make sure that tzconfig is preferred over tzsetup and only executed if exists, closes: #383911. * Do not install non-us for sarge and later dists and also remove contrib and non-free by default, closes: #383699. -- Ola Lundqvist Sun, 20 Aug 2006 20:12:09 +0200 vserver-debiantools (0.2.9) unstable; urgency=low * Now default to /etc/vservers/.defaults/vdirbase for all scripts and not just newvserver. * Removed a number of packages from INSTALL_PACKAGES in some of the scripts. * Depend on more recent version of debootstrap. * Add locales package to INSTALL_PACAKGES if LANG variable is set to anything other than C. -- Ola Lundqvist Tue, 18 Jul 2006 00:41:39 +0200 vserver-debiantools (0.2.8) unstable; urgency=low * Changed debhelper from build-depends-indep to build-depends. * Updated to standards version 3.7.2. * Correction of license information, specifically FSF address in different files. * Correction of manpage unknown character issue. -- Ola Lundqvist Sun, 16 Jul 2006 10:19:58 +0200 vserver-debiantools (0.2.7) unstable; urgency=low * Removed --resolve-deps as it is on by default. This also mean that this will work on sarge as well, closes: #368971. Thanks to Alexander Gerasiov for the information on how to correct this. * Syntax corrections based on what lintian tell. -- Ola Lundqvist Mon, 29 May 2006 20:59:35 +0200 vserver-debiantools (0.2.6) unstable; urgency=low * Check VxID in addition to s_context, closes: #327609. * Updated copyright file (FSF address). * Updated copyright years. * Updated standards version to 3.6.2. * Changed build depends to build depends indep. * Corrected quote in stripserver.sh, closes: #347458. -- Ola Lundqvist Sat, 28 Jan 2006 21:58:30 +0100 vserver-debiantools (0.2.5) unstable; urgency=low * Added --resolve-deps to vserver building, closes: #324656. Thanks to Eric MC Declerck for pointing out this. -- Ola Lundqvist Sun, 9 Oct 2005 20:41:54 +0200 vserver-debiantools (0.2.4) unstable; urgency=low * Changed dependency so it can be used with sarge too. The changes needed was added in the last upload of sarge install. -- Ola Lundqvist Sun, 31 Jul 2005 11:29:40 +0200 vserver-debiantools (0.2.3) unstable; urgency=medium * Inittab is now generated instead of simply provided. Thanks to Thomas Gelf for that fix. * Also made sure that update-rc.d will not add links on package upgrades. -- Ola Lundqvist Tue, 3 May 2005 19:42:23 +0200 vserver-debiantools (0.2.2) unstable; urgency=low * Added support for apt.conf.d to allow for http proxy, closes: #306401. Thanks to Daniel van Eeden for the solution. -- Ola Lundqvist Tue, 26 Apr 2005 12:54:42 +0200 vserver-debiantools (0.2.1) unstable; urgency=low * Fixed minor issue with package cache system, closes: #264912. -- Ola Lundqvist Wed, 20 Apr 2005 22:25:54 +0200 vserver-debiantools (0.2.0) unstable; urgency=low * Applied patch from Daniel Hermann that allow for netmasks to IP. * Applied patch from Daniel Hermann to allow newvserver to use the vserver build system instead of debootstrap directly, closes: #305155. This allow for the new configuration structure available in latest util-vserver tools. * Using this method cause different default capabilities, closes: #197051. * Readded package caching and made an option to allow it. * Added dependency on util-vserver becuase of this cleanup. * Updated README to accnowledte the work of Daniel Hermann. * Rewrote hostname check to allow digit in the beginning if it exist at least one alpha character, closes: #251569. * Removed two options from the manpage. * Changed all defaults to sarge. * No longer source util-vserver-vars as it has been moved from /etc to /usr/lib/util-vserver. * Added apt-get autoclean to package caching system. -- Ola Lundqvist Mon, 19 Apr 2005 17:45:15 +0200 vserver-debiantools (0.1.10) unstable; urgency=low * Added support for util-vserver 0.30.204 and later versions. -- Ola Lundqvist Sat, 12 Mar 2005 14:45:25 +0100 vserver-debiantools (0.1.9) unstable; urgency=low * Changed the location of vreboot from /usr/lib/vserver to /usr/lib/util-vserver in the newvserver.sh, newnfsvserver.sh and stripserver.sh scripts in order to allow it to be installed to new hosts, closes: #293435. -- Ola Lundqvist Sat, 5 Feb 2005 21:11:15 +0100 vserver-debiantools (0.1.8) unstable; urgency=low * Fixed a minor typo in newvserver script, closes: #289023. * Added source of newvserver-vars config in newnfsvserver script too. * Renamed stripserver manpage to correct name from newvserver, closes: #290355. * Made it possible to use file:/ as mirror target, closes: #239819. -- Ola Lundqvist Mon, 31 Jan 2005 21:52:48 +0100 vserver-debiantools (0.1.7) unstable; urgency=high * Changed to architecture all. * Made sure that eximconfig is not run unless it is a woody dist. * Changed from apt-get remove to dpkg -P to make sure that packages that should not exist is removed. -- Ola Lundqvist Sat, 8 Jan 2005 12:42:34 +0100 vserver-debiantools (0.1.6) unstable; urgency=low * Fixed so that vserver config IPROOTDEV take interface argument from command line or newvserver config, closes: #277541. * Updated manpage to show defaults, closes: #277546. -- Ola Lundqvist Fri, 22 Oct 2004 19:31:52 +0200 vserver-debiantools (0.1.5) unstable; urgency=high * Fixed problem creating ARCHIVE dir. * Changed separator in regexp to allow submasks in dupvserver, closes: #273423. -- Ola Lundqvist Tue, 5 Oct 2004 22:54:14 +0200 vserver-debiantools (0.1.4) unstable; urgency=high * Fix in handling of /dev in newvserver. * This includes that the directory /var/lib/vserver-debiantools is added. * Added dependency on the needed version of debootstrap. * Now sources.list is created with the selected dist instead of stable hard-coded. -- Ola Lundqvist Mon, 30 Aug 2004 19:23:53 +0200 vserver-debiantools (0.1.3) unstable; urgency=high * Problem with having multiple distributions share the same ARCHIVES directory. This a very important fix. -- Ola Lundqvist Mon, 30 Aug 2004 19:23:53 +0200 vserver-debiantools (0.1.2) unstable; urgency=high * Changed so that newvserver do not create a config file with ulimit -u option. That is not POSIX compatible. User can change that manually later. * Added GPL statements where they should be. -- Ola Lundqvist Mon, 30 Aug 2004 12:10:43 +0200 vserver-debiantools (0.1.1) unstable; urgency=low * Updated manpages so they look nice. * Changed so it works with util-vserver. This means that it will not work with vserver. This is not a problem since vserver will be removed from Debian. * Added possibility to have a configuration file for newvserver in /etc/vservers/newvserver-vars * Dependency in rsync, closes: #237435. * Added stdout stderr symlinks in /dev, closes: #209129. * Added possibility of post install script, closes: #222819. Thanks to Olujimi Brown . * Fixed sparc issue, closes: #257861. Thanks to Helmut Toplitzer for the simple fix. * Changed so it should work on sarge. Make that the default distribution, closes: #239536. * Added conflict on vserver as it provides the same tools. * Made INSTALL_PACKAGES empty. User has to edit that, it is not up to me as a maintainer. -- Ola Lundqvist Wed, 11 Aug 2004 11:56:46 +0200 vserver-debiantools (0.1.0) unstable; urgency=low * Initial Release. This is a split of the vserver package. The debian specific addon scripts is gathered in this package. -- Ola Lundqvist Wed, 28 Jul 2004 19:27:18 +0200 vserver-debiantools-0.8.1/debian/copyright0000664000000000000000000000300511440404572015561 0ustar This package was debianized by Ola Lundqvist on Wed, 28 Jul 2004 19:27:18 +0200. Upstream Authors: Ola Lundqvist Paul Sladen Mark Lawrence Copyright: Copyright (C) 2002-2010 Ola Lundqvist Copyright (C) 2008 Vincent Bernat Copyright (C) 2007 Tijs van Dam Copyright (C) 2007 Jochen Voss Copyright (C) 2006 Miroslav Kure Copyright (C) 2005 Thomas Gelf Copyright (C) 2005 Daniel Hermann Copyright (C) 2002 Paul Sladen Copyright (C) 2002 Mark Lawrence This 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, or (at your option) any later version. This 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 with your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the source package as the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. vserver-debiantools-0.8.1/debian/control0000664000000000000000000000126511615711012015231 0ustar Source: vserver-debiantools Section: utils Priority: optional Maintainer: Ola Lundqvist Build-Depends: debhelper (>= 4.0.0) Build-Depends-Indep: perl Standards-Version: 3.7.2 Package: vserver-debiantools Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, util-vserver (>= 0.30.204-5sarge2), debootstrap (>= 0.3.3), binutils, rsync, iproute Recommends: dnsutils Conflicts: vserver Description: Tools to manage Debian virtual servers This package contain tools to manage Debian based virtual servers. There are tools to create and duplicate a virtual server. There is also a tool to strip a copy of a normal Debian installation from hardware dependent things. vserver-debiantools-0.8.1/debian/docs0000664000000000000000000000000711173250420014472 0ustar README vserver-debiantools-0.8.1/patches/0000775000000000000000000000000011615711203014031 5ustar vserver-debiantools-0.8.1/patches/426796.patch0000664000000000000000000000227111173250420015633 0ustar Hi, this is a suggested fix for bug #426796: if the host uses 127.0.0.1 as a nameserver, this cannot be used as a nameserver inside the container. One (partial) solution would be, to replace 127.0.0.1 with the host address on the interface given for the vserver subnet. This mewthod could be implemented by the following patch: ---------------------------------------------------------------------- --- /usr/sbin/newvserver.orig 2007-04-10 04:49:31.000000000 +0100 +++ /usr/sbin/newvserver 2007-08-19 16:59:27.000000000 +0100 @@ -477,7 +477,10 @@ EOF # grab DNS servers from the host-server for `resolv.conf' -(echo search $VDOMAIN ; grep '^nameserver' /etc/resolv.conf) \ +HOST_IP=$(ip -o addr show dev $INTERFACE primary scope global | \ + sed -n 's;.*inet \([^/]*\)/.*;\1;p') +(echo search $VDOMAIN; + grep '^nameserver' /etc/resolv.conf | sed "s/127.0.0.1/$HOST_IP/") \ > "$VROOTDIR/$VHOST/etc/resolv.conf" # If there is a proxy server statement in-use in the Host server, copy it across ---------------------------------------------------------------------- This will work as long as the hosts nameserver listens on $INTERFACE. I hope this helps, Jochen -- http://seehuhn.de/ vserver-debiantools-0.8.1/patches/hostname-ip-from-nameserver.patch0000664000000000000000000000644511173250420022413 0ustar diff -ur vserver-debiantools-0.3.6.1/debian/control vserver-debiantools-0.3.6.2/debian/control --- vserver-debiantools-0.3.6.1/debian/control 2007-08-20 07:37:48.000000000 +0100 +++ vserver-debiantools-0.3.6.2/debian/control 2007-10-01 16:17:00.000000000 +0100 @@ -8,7 +8,7 @@ Package: vserver-debiantools Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, util-vserver (>= 0.30.204-5sarge2), debootstrap (>= 0.3.3), binutils, rsync, iproute +Depends: ${shlibs:Depends}, ${misc:Depends}, util-vserver (>= 0.30.204-5sarge2), debootstrap (>= 0.3.3), binutils, rsync, iproute, dnsutils Conflicts: vserver Description: Tools to manage debian virtual servers This package contain tools to manage debian based virtual servers. diff -ur vserver-debiantools-0.3.6.1/newvserver.sh vserver-debiantools-0.3.6.2/newvserver.sh --- vserver-debiantools-0.3.6.1/newvserver.sh 2007-10-01 14:22:34.000000000 +0100 +++ vserver-debiantools-0.3.6.2/newvserver.sh 2007-10-01 21:38:05.000000000 +0100 @@ -122,12 +122,17 @@ --pkgcache Package caching. -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory + Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver (syntax: --ip [/]) + Either --ip or --domain/--hostname may be omitted if the + corresponding information can be found via a name server + query. + You can also set variables in /etc/vservers/newvserver-vars. EOF @@ -268,18 +273,6 @@ case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) IP="$2" - # get netmask - IP_NETMASK=${IP##*/} - test "$IP_NETMASK" != "$1" || IP_NETMASK= - IP_ADDR=${IP%%/${IP_NETMASK}} - # if IP_NETMASK contains no ".", it is - # interpreted as IP_PREFIX - IP_PREFIX= - test "${IP_NETMASK%%.*}" != "${IP_NETMASK}" \ - || { - IP_PREFIX=$IP_NETMASK - IP_NETMASK= - } ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 @@ -348,12 +341,32 @@ parse_args $@ +if [ -n "$IP" -a \( -z "$VHOST" -o -z "$VDOMAIN" \) ]; then + tmp=$(dig +short -x $(echo $IP | sed 's;/[0-9]*$;;')) + if [ -n "$tmp" ]; then + if [ -z "$VHOST" ]; then + VHOST=$(echo $tmp | sed 's/\..*//') + fi + if [ -z "$VDOMAIN" ]; then + VDOMAIN=$(echo $tmp | sed 's/[^.]*\.//') + fi + fi +fi + +if [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$INTERFACE" -a -z "$IP" ]; then + prefix=$(ip -o addr show dev "$INTERFACE" primary scope global | \ + sed -n 's;.*inet [0-9.]*/\([0-9]*\).*;\1;p') + IP="$(dig +short "$VHOST.$VDOMAIN")/$prefix" +fi + if ! [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$IP" ]; then echo "${0##*/} error: --hostname, --domain and --ip are required" 1>&2 usage exit 1 fi +IP_ADDR=${IP%%/*} + # Strip final slashes off a couple of things MIRROR="${MIRROR%/}" VROOTDIR="${VROOTDIR%/}" @@ -472,15 +485,12 @@ $IP_ADDR $VHOST.$VDOMAIN $VHOST # The following lines are desirable for IPv6 capable hosts -# (added automatically by netbase upgrade) - ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts - EOF # grab DNS servers from the host-server for `resolv.conf' vserver-debiantools-0.8.1/patches/util-vserver-newvserver-cleanup.diff0000664000000000000000000001471011173250420023164 0ustar From: Daniel Hermann --- newvserver.orig 2005-04-17 17:46:11.000000000 +0200 +++ newvserver 2005-04-17 18:54:08.000000000 +0200 @@ -62,9 +62,6 @@ # Default network interface for vservers: INTERFACE="eth0" -# Copy vreboot/vhalt/vshutdown utility into /usr/local/sbin/ -COPY_VREBOOT="true" - if [ -r /etc/vservers/util-vserver-vars ] ; then . /etc/vservers/util-vserver-vars fi @@ -96,15 +93,13 @@ { cat << EOF Usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 -Creates a new Debian vserver by downloading packages via HTTP/FTP +Creates a new Debian vserver by calling "vserver ... build" Options: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) - --copy-vreboot install "vreboot/vshutdown/vhalt" - --no-copy-vreboot don't install "vreboot/vshutdown/vhalt" --dist defaults to "sarge", passed to debootstrap. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. @@ -184,14 +179,6 @@ fi shift 2 ;; - --copy-vreboot) - COPY_VREBOOT="true" - shift - ;; - --no-copy-vreboot) - COPY_VREBOOT="" - shift - ;; --dist) case "$2" in [a-z]*) @@ -341,16 +328,6 @@ ############################################################################## -# Check we've got debootstrap available -if [ ! -x /usr/sbin/debootstrap ]; then - cat << EOF 1>&2 -${0##*/}: Requires the debootstrap package to bootstrap Debian - Debian Host: apt-get install debootstrap - RPM Host: rpm -i http://people.debian.org/~blade/install/debootstrap/debootstrap-0.1.17.3-2.i386.rpm -EOF - exit 1 -fi - if ! cat /proc/self/status | grep '^s_context:[^0-9]0$'; then echo "${0##*/} error:" echo " Must be run from the host server (security context 0)" 1>&2 @@ -364,33 +341,19 @@ exit 1 fi -# check for /vserver/$VHOST/etc/ incase we are on pre-mounted LVM partition -# (used to just check for "/vserver/$VHOST/" existing -if [ -d "$VROOTDIR/$VHOST/etc/" -o -f "/etc/vservers/$VHOST.conf" ] ; then - cat << EOF 1>&2 -${0##*/} error: Virtual Server "$VHOST" appears to already exist - check "/etc/vservers/$VHOST.conf" or "/vservers/$VHOST/etc/"; -EOF - exit 1 -fi - -# This is used to keep a cache of the downloaded .deb packges for next install -if [ -d "$VROOTDIR/ARCHIVES/$DIST" ]; then - mkdir -p "$VROOTDIR/$VHOST/var/cache/apt/archives" - cp -a "$VROOTDIR/ARCHIVES/$DIST/"*.deb "$VROOTDIR/$VHOST/var/cache/apt/archives" > /dev/null 2>&1 -fi - # We only want to pass the Architecture if we need to (autodectected otherwise) if [ -n "$ARCH" ]; then ARCH_ARGUMENT="--arch $ARCH" fi -# Fire off `debootstrap' to do all the hard work -# like downloading and installing -if ! /usr/sbin/debootstrap $ARCH_ARGUMENT \ - "--include=$INSTALL_PACKAGES" "--exclude=$REMOVE_PACKAGES" \ - "$DIST" "$VROOTDIR/$VHOST" "$MIRROR" ; then - echo "${0##*/}: error: debootstrap failure. Cannot continue." +## use "vserver ... build" to build the new vserver +if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ + --rootdir "$VROOTDIR" --hostname "$VHOST" --interface "$INTERFACE:$IP" \ + -- -d "$DIST" -m "$MIRROR" \ + -- $ARCH_ARGUMENT \ + --include="$INSTALL_PACKAGES" --exclude="$REMOVE_PACKAGES" + then + echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi @@ -406,15 +369,8 @@ EOF -# Fix up the available device nodes, for security +# Fix up the available device nodes (mostly done by vserver-build above) if cd "$VROOTDIR/$VHOST/dev"; then - mkdir -p /var/lib/vserver-debiantools - tar cfp /var/lib/vserver-debiantools/dev.tar.$$ full null ptmx random tty urandom zero - rm -rf * - tar xfp /var/lib/vserver-debiantools/dev.tar.$$ - rm -f /var/lib/vserver-debiantools/dev.tar.$$ - mkdir pts - mkdir shm ln -s /proc/self/fd fd ln -s fd/2 stderr ln -s fd/0 stdin @@ -467,14 +423,6 @@ proc /proc proc defaults 0 0 EOF -# The new vserver patch now automatically mounts /proc -# Debian needs /dev/pts mounting "gid=5,mode=620" by vserver -cat << EOF > "$VROOTDIR/$VHOST/etc/mtab" -/dev/hdv1 / vfs none 0 0 -proc /proc proc rw 0 0 -devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -EOF - # Create a reduced inittab that doesn't start getty on the consoles cat << EOF > "$VROOTDIR/$VHOST/etc/inittab" # /etc/inittab: init(8) configuration. @@ -549,22 +497,6 @@ EOF -# Create default /etc/vservers entry -cat << EOF > /etc/vservers/$VHOST.conf -S_HOSTNAME="$VHOST" -IPROOT="$IP" -IPROOTDEV="$INTERFACE" -ONBOOT="yes" -S_NICE="" -S_FLAGS="lock nproc$FAKEINIT" -ULIMIT="-H -n 1024" -S_CAPS="CAP_NET_RAW" - -# *NOT* DNS domain name, for NIS only -S_DOMAINNAME="" - -EOF - if [ -n "$EXTRA_PACKAGES" ]; then EXTRA_PACKAGES_INSTALL="apt-get --assume-yes install ${EXTRA_PACKAGES//,/ }" fi @@ -601,6 +533,9 @@ EOF +## start vserver before we can exec anything inside it +vserver $VHOST start + # Run the above commands from within the server chmod 755 $VROOTDIR/$VHOST/vserver-config.sh vserver $VHOST exec /vserver-config.sh @@ -622,30 +557,12 @@ chmod 600 "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" fi -# Install the vreboot/rebootmgr utility--hopefully this will disappear soon -VREBOOT_LOCATION="/usr/lib/util-vserver/vreboot" -if [ "$COPY_VREBOOT" == "true" -a -x "$VREBOOT_LOCATION" ]; then - cp -a "$VREBOOT_LOCATION" "$VROOTDIR/$VHOST/usr/local/sbin/" - chmod 750 "$VROOTDIR/$VHOST/usr/local/sbin/vreboot" - # ln -s "$VROOTDIR/$VHOST/usr/local/sbin/"{vshutdown,vreboot} - # ln -s "$VROOTDIR/$VHOST/usr/local/sbin/"{vhalt,vreboot} -fi - -# Stop all the processes that were started inside the server -export PREVLEVEL=2 -vserver $VHOST exec /etc/init.d/rc 0 +## stop the vserver vserver $VHOST stop -# Populate the archive for future virtual servers -if [ ! -d $VROOTDIR/ARCHIVES/$DIST ]; then - mkdir -p $VROOTDIR/ARCHIVES/$DIST -fi -cp $VROOTDIR/$VHOST/var/cache/apt/archives/*.deb $VROOTDIR/ARCHIVES/$DIST - -echo "Restarting rebootmgr." -invoke-rc.d rebootmgr restart echo -echo "You should now adjust /etc/vservers/$VHOST.conf to suit your needs," +echo "You should now adjust the configuration in /etc/vservers/$VHOST/" +echo "to suit your needs," echo "or else just go ahead and type \`vserver $VHOST start' to start" echo "your new virtual server. debian/rules!" echo vserver-debiantools-0.8.1/patches/newnfsvserver-nonus.diff0000664000000000000000000000060611173250420020740 0ustar --- newnfsvserver.sh.old 2006-08-25 18:36:46.000000000 +0200 +++ newnfsvserver.sh 2006-08-25 18:37:22.000000000 +0200 @@ -398,7 +398,7 @@ fi # Make it so that apt and friends work -if [ "sarge" == "$DIST" ] && [ "woody" == "$DIST" ] ; then +if [ "woody" == "$DIST" ] ; then cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main vserver-debiantools-0.8.1/patches/preposthook.patch0000664000000000000000000000601011173250420017422 0ustar diff -Naur vserver-debiantools-0.5.0.ori/newvserver.pod vserver-debiantools-0.5.0/newvserver.pod --- vserver-debiantools-0.5.0.ori/newnfsvserver.pod 2007-10-07 12:32:10.000000000 +0200 +++ vserver-debiantools-0.5.0/newnfsvserver.pod 2008-02-25 21:18:20.000000000 +0100 @@ -20,7 +20,10 @@ --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --post-install-script - script to run after the installation finishes. + script to run after the installation finishes inside vserver. + --post-install-host-script + script to run after the installation finishes outside vserver + and before post-install script. --interface interface for IP addresses (default "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) Default: http://ftp.uk.debian.org/debian @@ -64,6 +67,12 @@ vserver installation. POST_INSTALL_SCRIPT="" +Absolute path location of a script that you want to run after the +vserver installation but before the previous script and outside +vserver context. This can be used for example to copy +/etc/apt/sources.list from host. +POST_INSTALL_HOST_SCRIPT="" + Architecture: overide on non-Debian host such as Redhat otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" diff -Naur vserver-debiantools-0.5.0.ori/newvserver.sh vserver-debiantools-0.5.0/newvserver.sh --- vserver-debiantools-0.5.0.ori/newnfsvserver.sh 2007-10-07 12:32:10.000000000 +0200 +++ vserver-debiantools-0.5.0/newvnfsserver.sh 2008-02-25 21:16:43.000000000 +0100 @@ -57,9 +57,13 @@ # sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot mountvirtfs mountall.sh mountnfs.sh ifupdown" -# Post installation script +# Post installation script, run inside vserver guest context POST_INSTALL_SCRIPT="" +# Post installation script, run inside vserver host context and before +# POST_INSTALL_SCRIPT +POST_INSTALL_HOST_SCRIPT="" + # Architecture: overide on non-Debian host such as Redhat # otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" @@ -213,6 +217,16 @@ fi shift 2 ;; + --post-install-host-script) + if [ -r "$2" ] ; then + POST_INSTALL_HOST_SCRIPT="$2" + echo "Script $2 found." + else + echo "Error, can not locate the script $2." + exit 1 + fi + shift 2 + ;; --dist) case "$2" in [a-z]*) @@ -641,6 +655,11 @@ EOF +# Run the post-installation script from outside the server +if [ -n "$POST_INSTALL_HOST_SCRIPT" ]; then + "$POST_INSTALL_HOST_SCRIPT" +fi + ## start vserver before we can exec anything inside it vserver $VHOST start vserver-debiantools-0.8.1/patches/unattended-install.patch0000664000000000000000000000614611173250420020656 0ustar diff -ur vserver-debiantools-0.4.1/newvserver.pod vserver-debiantools-0.4.1.1/newvserver.pod --- vserver-debiantools-0.4.1/newvserver.pod 2007-10-02 07:33:57.000000000 +0100 +++ vserver-debiantools-0.4.1.1/newvserver.pod 2007-10-06 19:40:49.000000000 +0100 @@ -87,6 +87,12 @@ Package caching: PKGCACHE=1 +The name of a debconf database to be read by debconf's file driver. +This can be used to store the answers for debconf questions during +install and thus allows for unattended installation. See the +debconf.conf(5) manual page for the file format. +DEBCONF_FILE_DB="" + =head1 AUTHOR Author of the manual page is Ola Lundqvist diff -ur vserver-debiantools-0.4.1/newvserver.sh vserver-debiantools-0.4.1.1/newvserver.sh --- vserver-debiantools-0.4.1/newvserver.sh 2007-10-02 21:00:29.000000000 +0100 +++ vserver-debiantools-0.4.1.1/newvserver.sh 2007-10-06 19:40:46.000000000 +0100 @@ -83,6 +83,12 @@ # Package caching PKGCACHE=0 +# The name of a debconf database to be read by debconf's file driver. +# This can be used to store the answers for debconf questions during +# install and thus allows for unattended installation. See the +# debconf.conf(5) manual page for the file format. +DEBCONF_FILE_DB="" + if [ -r /etc/vservers/newvserver-vars ] ; then . /etc/vservers/newvserver-vars fi @@ -576,6 +582,20 @@ EXTRA_PACKAGES_INSTALL="apt-get --assume-yes install ${EXTRA_PACKAGES//,/ }" fi +if [ -f /etc/timezone ]; then + tz=$(cat /etc/timezone) + zonefile="$VROOTDIR/$VHOST/usr/share/zoneinfo/$tz" + if [ -f "$zonefile" ]; then + echo "$tz" >$VROOTDIR/$VHOST/etc/timezone + cp "$zonefile" "$VROOTDIR/$VHOST/etc/localtime" + fi +fi + +if [ -n "$DEBCONF_FILE_DB" ]; then + cp "$DEBCONF_FILE_DB" "$VROOTDIR/$VHOST/config.dat" + SET_DEBCONF_OVERRIDE='export DEBCONF_DB_OVERRIDE="File{/config.dat}"' +fi + # ------------------------------------------------------------ # From here on we do things live in the server # Generate the script that runs the rest of the setup from within the @@ -583,19 +603,23 @@ cat << EOF > "$VROOTDIR/$VHOST/vserver-config.sh" #!/bin/sh +$SET_DEBCONF_OVERRIDE + [ -x /usr/sbin/locale-gen ] && /usr/sbin/locale-gen dselect update -# tzsetup was part of base-config which is gone since etch -# tzconfig is part of libc, so it should be ubiquitious -if [ -x /usr/sbin/tzsetup ]; then - /usr/sbin/tzsetup -y -elif [ -x /usr/sbin/tzconfig ]; then - /usr/sbin/tzconfig +if [ ! -f /etc/timezone ]; then + # tzsetup was part of base-config which is gone since etch + # tzconfig is part of libc, so it should be ubiquitious + if [ -x /usr/sbin/tzsetup ]; then + /usr/sbin/tzsetup -y + elif [ -x /usr/sbin/tzconfig ]; then + /usr/sbin/tzconfig + fi fi -dpkg-reconfigure passwd +dpkg-reconfigure -u passwd tasksel @@ -624,6 +648,8 @@ chmod 755 $VROOTDIR/$VHOST/vserver-config.sh vserver $VHOST exec /vserver-config.sh rm -f $VROOTDIR/$VHOST/vserver-config.sh +rm -f "$VROOTDIR/$VHOST/config.dat" +rm -f "$VROOTDIR/$VHOST/config.dat-old" # Run the post-installation script from within the server if [ -n "$POST_INSTALL_SCRIPT" ]; then vserver-debiantools-0.8.1/patches/newvserver-tzconfig.diff0000664000000000000000000000066011173250420020712 0ustar --- newvserver.old 2006-08-20 18:21:53.000000000 +0200 +++ newvserver 2006-08-20 18:59:14.000000000 +0200 @@ -538,7 +538,13 @@ dselect update -tzsetup -y +# tzsetup was part of base-config which is gone since etch +# tzconfig is part of libc, so it should be ubiquitious +if [ -x /usr/sbin/tzsetup ]; then + /usr/sbin/tzsetup -y +elif [ -x /usr/sbin/tzconfig ]; then + /usr/sbin/tzconfig +fi dpkg-reconfigure passwd vserver-debiantools-0.8.1/patches/security-non-us-configurable.patch0000664000000000000000000000357411173250420022603 0ustar diff -ur vserver-debiantools-0.3.6/newvserver.sh vserver-debiantools-0.3.6.1/newvserver.sh --- vserver-debiantools-0.3.6/newvserver.sh 2007-08-20 07:43:58.000000000 +0100 +++ vserver-debiantools-0.3.6.1/newvserver.sh 2007-10-01 14:22:34.000000000 +0100 @@ -71,6 +71,12 @@ # Local or nearest location of a debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" +# debian-non-US mirror (must include the '/debian-non-US', only used for woody) +MIRROR_NON_US="http://non-us.debian.org/debian-non-US" + +# mirror for security updates +MIRROR_SECURITY="http://security.debian.org" + # Default network interface for vservers: INTERFACE="eth0" @@ -431,10 +437,10 @@ deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main -deb http://non-us.debian.org/debian-non-US $DIST/non-US main -deb-src http://non-us.debian.org/debian-non-US $DIST/non-US main +deb $MIRROR_NON_US $DIST/non-US main +deb-src $MIRROR_NON_US $DIST/non-US main -deb http://security.debian.org $DIST/updates main +deb $MIRROR_SECURITY $DIST/updates main EOF else @@ -442,7 +448,7 @@ deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main -deb http://security.debian.org $DIST/updates main +deb $MIRROR_SECURITY $DIST/updates main EOF fi diff -ur vserver-debiantools-0.3.6/newvserver.pod vserver-debiantools-0.3.6.1/newvserver.pod --- vserver-debiantools-0.3.6/newvserver.pod 2006-12-09 10:31:06.000000000 +0000 +++ vserver-debiantools-0.3.6.1/newvserver.pod 2007-10-01 14:22:00.000000000 +0100 @@ -75,6 +75,12 @@ Local or nearest location of a debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" +debian-non-US mirror (must include the '/debian-non-US', only used for woody) +MIRROR_NON_US="http://non-us.debian.org/debian-non-US" + +mirror for security updates +MIRROR_SECURITY="http://security.debian.org" + Default network interface for vservers: INTERFACE="eth0" vserver-debiantools-0.8.1/patches/ip-fix-netmask.diff0000664000000000000000000000260211173250420017515 0ustar --- newvserver.20050418 2005-04-19 16:47:51.000000000 +0200 +++ newvserver 2005-04-19 16:59:20.000000000 +0200 @@ -92,7 +92,7 @@ full_usage () { cat << EOF -Usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 +Usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4/24 Creates a new Debian vserver by calling "vserver ... build" Options: @@ -112,6 +112,7 @@ --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver + (syntax: --ip [/]) You can also set variables in /etc/vservers/newvserver-vars. @@ -244,6 +245,18 @@ case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) IP="$2" + # get netmask + IP_NETMASK=${IP##*/} + test "$IP_NETMASK" != "$1" || IP_NETMASK= + IP_ADDR=${IP%%/${IP_NETMASK}} + # if IP_NETMASK contains no ".", it is + # interpreted as IP_PREFIX + IP_PREFIX= + test "${IP_NETMASK%%.*}" != "${IP_NETMASK}" \ + || { + IP_PREFIX=$IP_NETMASK + IP_NETMASK= + } ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 @@ -385,7 +398,7 @@ # /etc/hosts 127.0.0.1 localhost -$IP $VHOST.$VDOMAIN $VHOST +$IP_ADDR $VHOST.$VDOMAIN $VHOST # The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade) vserver-debiantools-0.8.1/patches/newvserver-nonus.diff0000664000000000000000000000060011173250420020223 0ustar --- newvserver.sh.old 2006-08-25 18:26:45.000000000 +0200 +++ newvserver.sh 2006-08-25 18:36:10.000000000 +0200 @@ -424,7 +424,7 @@ fi # Make it so that apt and friends work -if [ "sarge" == "$DIST" ] && [ "woody" == "$DIST" ] ; then +if [ "woody" == "$DIST" ] ; then cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main vserver-debiantools-0.8.1/patches/newvserver-locale.diff0000664000000000000000000000136711173250420020333 0ustar --- newvserver.old 2006-07-18 00:54:00.000000000 +0200 +++ newvserver 2006-08-18 21:59:06.000000000 +0200 @@ -401,9 +401,9 @@ # Create a locale.gen if needed. if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then if [ ! -e "$VROOTDIR/$VHOST/etc/locale.gen" ] ; then - echo $LANG > "$VROOTDIR/$VHOST/etc/locale.gen" + echo $LANG $(locale charmap) > "$VROOTDIR/$VHOST/etc/locale.gen" elif ! grep $LANG "$VROOTDIR/$VHOST/etc/locale.gen" > /dev/null ; then - echo $LANG >> "$VROOTDIR/$VHOST/etc/locale.gen" + echo $LANG $(locale charmap) >> "$VROOTDIR/$VHOST/etc/locale.gen" fi fi @@ -536,6 +536,8 @@ cat << EOF > "$VROOTDIR/$VHOST/vserver-config.sh" #!/bin/sh +[ -x /usr/sbin/locale-gen ] && /usr/sbin/locale-gen + dselect update tzsetup -y vserver-debiantools-0.8.1/newvserver.sh0000664000000000000000000005522311615710507015161 0ustar #!/bin/bash VERSION='0.8' # # Copyright (C) 2002-2010 Ola Lundqvist # Copyright (C) 2009 Stefan Tomanek # Copyright (C) 2008 Vincent Bernat # Copyright (C) 2007 Tijs van Dam # Copyright (C) 2007 Jochen Voss # Copyright (C) 2006 Miroslav Kure # Copyright (C) 2005 Thomas Gelf # Copyright (C) 2005 Daniel Hermann # Copyright (C) 2002 Paul Sladen # Copyright (C) 2002 Mark Lawrence # # This 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, or (at your option) any later # version. # # This 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 with # the source package as the file COPYING. If not, write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. # # Install a virtual Debian server (vserver) from a Debian HTTP/FTP archive # # ---------------------------------------------------------------- # Configurable items: shopt -s extglob # No context id set by default CONTEXT= # Root directory of your virtual servers (probably shouldn't change this) # Support for 0.30.203 and above of util-vserver VROOTDIR="/etc/vservers/.defaults/vdirbase" # Packages to install in addition to the base defaults # MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) INSTALL_PACKAGES="" if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then INSTALL_PACKAGES="$INSTALL_PACKAGES locales" fi # Packages installed from within the vserver after it has # been setup (seperated by "," commas) EXTRA_PACKAGES="" # Packages to remove from the base defaults (seperated by "," commas) #REMOVE_PACKAGES="dhcp-client,lilo,makedev,pcmcia-cs,ppp,pppconfig,pppoe,pppoeconf,setserial,syslinux,nano,fdutils,iptables,libpcap0,pciutils" REMOVE_PACKAGES="sparc-utils,dhcp-client,lilo,makedev,pcmcia-cs,ppp,pppconfig,pppoe,pppoeconf,setserial,syslinux,fdutils,libpcap0,iptables,pciutils" # sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot mountvirtfs mountall.sh mountnfs.sh ifupdown" # Post installation script, run inside vserver guest context POST_INSTALL_SCRIPT="" # Post installation script, run inside vserver host context and before # POST_INSTALL_SCRIPT POST_INSTALL_HOST_SCRIPT="" # Architecture: overide on non-Debian host such as Redhat # otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" # Which Debian distribution # (warning: this has only been tested with # woody, sarge, etch, lenny and squeeze) DIST="squeeze" # Local or nearest location of a Debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" # Debian-non-US mirror (must include the '/debian-non-US', only used for woody) MIRROR_NON_US="http://non-us.debian.org/debian-non-US" # mirror for security updates MIRROR_SECURITY="http://security.debian.org" # Default network interface for vservers: INTERFACE="eth0" # Package caching PKGCACHE=0 # The name of a debconf database to be read by debconf's file driver. # This can be used to store the answers for debconf questions during # install and thus allows for unattended installation. See the # debconf.conf(5) manual page for the file format. DEBCONF_FILE_DB="" if [ -r /etc/vservers/newvserver-vars ] ; then . /etc/vservers/newvserver-vars fi # ---------------------------------------------------------------- # Nothing from here on should need changing. # ---------------------------------------------------------------- # NOTE: debootstrap handles multiple MIRRORs, so there is no reason why # we shouldn't too--that way we could just let it build /etc/apt/sources.list usage () { cat << EOF 1>&2 usage: ${0##*/} --hostname x --domain y.z --ip 1.2.3.4/24 [OPTIONS] (see --help for more information) EOF } full_usage () { cat << EOF Usage: ${0##*/} --hostname x --domain y.z --ip 1.2.3.4/24 [OPTIONS] Creates a new Debian vserver by calling "vserver ... build" Options: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) --dist defaults to "squeeze", passed to debootstrap. --context n Set the context id to be used. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --interface interface for IP addresses (if not "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" --pkgcache Package caching. -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver (syntax: --ip [/]) Either --ip or --domain/--hostname may be omitted if the corresponding information can be found via a name server query. For this to work the dnsutils package must be installed. You can also set variables in /etc/vservers/newvserver-vars. EOF } full_version () { cat << EOF ${0##*/} version $VERSION Copyright (C) 2002-2010 Ola Lundqvist Copyright (C) 2008 Vincent Bernat Copyright (C) 2007 Tijs van Dam Copyright (C) 2007 Jochen Voss Copyright (C) 2006 Miroslav Kure Copyright (C) 2005 Thomas Gelf Copyright (C) 2005 Daniel Hermann Copyright (C) 2002 Paul Sladen Copyright (C) 2002 Mark Lawrence 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. EOF } parse_args () { while [ $# -gt 0 ] ; do #echo "parse_args() doing :$#: :$1: :$*:" case "$1" in --help|-h) full_usage shift exit 0 ;; --version|-V) full_version shift exit 0 ;; --arch) case "$2" in [a-z]*) ARCH="$2" ;; *) echo "${0##*/} error: $1 overrides dpkg autodetect on non-Debian host-servers" 1>&2 echo 'e.g. "i386"' 1>&2 exit 1 ;; esac shift 2 ;; --context) CONTEXT=$2 shift 2 ;; --conffile) if [ -r "$2" ] ; then . "$2" else echo "Error, can not load config file $2." exit 1 fi shift 2 ;; --post-install-script) if [ -r "$2" ] ; then POST_INSTALL_SCRIPT="$2" echo "Script $2 found." else echo "Error, can not locate the script $2." exit 1 fi shift 2 ;; --post-install-host-script) if [ -r "$2" ] ; then POST_INSTALL_HOST_SCRIPT="$2" echo "Script $2 found." else echo "Error, can not locate the script $2." exit 1 fi shift 2 ;; --dist) case "$2" in [a-z]*) DIST="$2" if [ "sarge" != "$2" ] && [ "woody" != "$2" ] && [ "etch" != "$2" ] && [ "lenny" != "$2" ] && [ "squeeze" != "$2" ] ; then echo "${0##*/} warning: I only know how to do \"woody\", \"sarge\", \"etch\", \"lenny\" and \"squeeze\", be careful!" 1>&2 fi ;; *) echo "${0##*/} error: $1 requires a Debian distribution" 1>&2 echo 'e.g. "woody", "sarge", "etch", "lenny" or "squeeze"' 1>&2 exit 1 ;; esac shift 2 ;; --domain) case "$2" in [a-z]*[a-z]) VDOMAIN="$2" ;; *) echo "${0##*/} error: $1 requires a dns domain-name" 1>&2 echo 'e.g. "example.com"' 1>&2 exit 1 ;; esac shift 2 ;; --fakeinit) # Note space at beginning--this gets tagged straight on FAKEINIT=" fakeinit" shift ;; --pkgcache) PKGCACHE=1 shift ;; --hostname) case "$2" in [a-z0-9]?(*([a-z0-9_-])[a-z0-9])) VHOST="$2" ;; *) echo "${0##*/} error: $1 must be a hostname for the vserver" 1>&2 echo 'e.g. "alpha"' 1>&2 exit 1 ;; esac shift 2 ;; --interface) case "$2" in [a-z]*) INTERFACE="$2" ;; *) echo "${0##*/} error: $1 must be followed by a network interface" 1>&2 echo 'e.g. "eth1"' 1>&2 exit 1 ;; esac shift 2 ;; --ip) # This does for an octet: ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;-) case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) IP="$2" ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 exit 1 ;; esac shift 2 ;; --mirror) case "$2" in [hf]*:/*) MIRROR="$2" ;; *) echo "${0##*/} error: $1 requires a Debian mirror" 1>&2 echo 'e.g. "http://ftp.uk.debian.org/debian"' 1>&2 exit 1 ;; esac shift 2 ;; --verbose|-v) export verbose="true" shift ;; --sshkeys) if [ -f "$2" ]; then SSH_KEYS="$2" else echo "${0##*/} error: $1 must be followed by a valid public-key-file!" 1>&2 echo 'e.g. "/root/.ssh/id_dsa.pub"' 1>&2 exit 1 fi shift 2 ;; --vsroot) case "$2" in /*) if [ -d "$2" ]; then VROOTDIR="$2" else echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers"' 1>&2 exit 1 fi ;; *) echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers"' 1>&2 exit 1 ;; esac shift 2 ;; -*) usage exit 1 ;; ?*) usage exit 1 ;; esac done } parse_args $@ if [ -x "$(which dig)" ] ; then if [ -n "$IP" -a \( -z "$VHOST" -o -z "$VDOMAIN" \) ]; then tmp=$(dig +short -x $(echo $IP | sed 's;/[0-9]*$;;')) if [ -n "$tmp" ]; then if [ -z "$VHOST" ]; then VHOST=$(echo $tmp | sed 's/\..*//') fi if [ -z "$VDOMAIN" ]; then VDOMAIN=$(echo $tmp | sed 's/[^.]*\.//') fi fi fi if [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$INTERFACE" -a -z "$IP" ]; then prefix=$(ip -o addr show dev "$INTERFACE" primary scope global | \ sed -n 's;.*inet [0-9.]*/\([0-9]*\).*;\1;p') IP="$(dig +short "$VHOST.$VDOMAIN")/$prefix" fi if ! [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$IP" ]; then echo "${0##*/} error: --hostname, --domain and --ip are required" 1>&2 usage exit 1 fi fi IP_ADDR=${IP%%/*} # Strip final slashes off a couple of things MIRROR="${MIRROR%/}" MIRROR_NON_US="${MIRROR_NON_US%/}" MIRROR_SECURITY="${MIRROR_SECURITY%/}" VROOTDIR="${VROOTDIR%/}" ############################################################################## # Arch specific issues # Dist specific issues ############################################################################## if ! cat /proc/self/status | grep '^\(VxID:[^0-9]0\|s_context:[^0-9]0\)$'; then echo "${0##*/} error:" echo " Must be run from the host server (security context 0)" 1>&2 echo ' on a "vserver/ctx-patch" enabled kernel' 1>&2 echo ' See: http://www.solucorp.qc.ca/miscprj/s_context.hc' 1>&2 exit 1 fi if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then echo "${0##*/} error: Must be run as root!" 1>&2 exit 1 fi aptcleanup() { apt-get autoclean -o Dir::Cache::Archives="$1" OLD="" for P in $(find "$1" -mindepth 1 -maxdepth 1 -name *.deb -printf "%f\n" | sed -e "s/_.*//;") ; do if [ "$P" == "$OLD" ] ; then rm -f "$1"/$P_* > /dev/null 2>&1 fi OLD=$P done } # This is used to keep a cache of the downloaded .deb packges for next install if [ -d "$VROOTDIR/ARCHIVES/$DIST" ] && [ $PKGCACHE -eq 1 ] ; then mkdir -p "$VROOTDIR/$VHOST/var/cache/apt/archives" if [ ! -d "$VROOTDIR/ARCHIVES/$DIST/partial" ] ; then # Needed to make apt-get autoclean work fine. mkdir "$VROOTDIR/ARCHIVES/$DIST/partial" fi echo "Clean package cache." aptcleanup "$VROOTDIR/ARCHIVES/$DIST" cp -a "$VROOTDIR/ARCHIVES/$DIST/"*.deb "$VROOTDIR/$VHOST/var/cache/apt/archives" > /dev/null 2>&1 fi # We only want to pass the Architecture if we need to (autodectected otherwise) if [ -n "$ARCH" ]; then ARCH_ARGUMENT="--arch $ARCH" fi # Function to optionally set a context id. CONTEXT_ARGUMENT= if [ -n "$CONTEXT" ] ; then CONTEXT_ARGUMENT="--context $CONTEXT" fi ## use "vserver ... build" to build the new vserver if [ -n "$INSTALL_PACKAGES" ] && [ -n "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --include="$INSTALL_PACKAGES" --exclude="$REMOVE_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi elif [ -n "$INSTALL_PACKAGES" ] && [ -z "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --include="$INSTALL_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi elif [ -z "$INSTALL_PACKAGES" ] && [ -n "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --exclude="$REMOVE_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi else if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi fi # Create a locale.gen if needed. if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then if [ ! -e "$VROOTDIR/$VHOST/etc/locale.gen" ] ; then echo $LANG $(locale charmap) > "$VROOTDIR/$VHOST/etc/locale.gen" elif ! grep $LANG "$VROOTDIR/$VHOST/etc/locale.gen" > /dev/null ; then echo $LANG $(locale charmap) >> "$VROOTDIR/$VHOST/etc/locale.gen" fi fi # Make it so that apt and friends work if [ "woody" == "$DIST" ] ; then cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main deb $MIRROR_NON_US $DIST/non-US main deb-src $MIRROR_NON_US $DIST/non-US main deb $MIRROR_SECURITY $DIST/updates main EOF else cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main deb $MIRROR_SECURITY $DIST/updates main EOF fi # Fix up the available device nodes (mostly done by vserver-build above) if cd "$VROOTDIR/$VHOST/dev"; then if [ ! -L fd ] && [ ! -e fd ] ; then ln -s /proc/self/fd fd fi if [ ! -L stderr ] && [ ! -e stderr ] ; then ln -s fd/2 stderr fi if [ ! -L stdin ] && [ ! -e stdin ] ; then ln -s fd/0 stdin fi if [ ! -L stdout ] && [ ! -e stdout ] ; then ln -s fd/1 stdout fi fi # Give the new host a hostname echo "$VHOST" > "$VROOTDIR/$VHOST/etc/hostname" # Set up the /etc/hosts file (needed for some parts of the base-config) cat << EOF > "$VROOTDIR/$VHOST/etc/hosts" # /etc/hosts 127.0.0.1 localhost $IP_ADDR $VHOST.$VDOMAIN $VHOST # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts EOF # grab DNS servers from the host-server for `resolv.conf' HOST_IP=$(ip -4 -o addr show primary scope global dev "$INTERFACE" | \ awk '$3 == "inet" {split($4,i,"/"); print i[1]; exit}') (echo search $VDOMAIN; grep '^nameserver' /etc/resolv.conf | sed "s/127.0.0.1/$HOST_IP/") \ > "$VROOTDIR/$VHOST/etc/resolv.conf" # If there is a proxy server statement in-use in the Host server, copy it across #if [ -f /etc/apt/apt.conf ]; then # cp /etc/apt/apt.conf $VROOTDIR/$VHOST/etc/apt/apt.conf #fi # support the apt.conf.d directories #if [ -d /etc/apt/apt.conf.d ] ; then # cp -a /etc/apt/apt.conf.d/* $VROOTDIR/$VHOST/etc/apt/apt.conf.d/ > /dev/null 2>&1 #fi # Create a dummy fstab cat << EOF > "$VROOTDIR/$VHOST/etc/fstab" # /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 EOF # Create a reduced inittab that doesn't start getty on the consoles if [ -e "$VROOTDIR/$VHOST/etc/inittab" ] ; then mv "$VROOTDIR/$VHOST/etc/inittab" "$VROOTDIR/$VHOST/etc/inittab.dist" && \ grep -v respawn\:/sbin/getty "$VROOTDIR/$VHOST/etc/inittab.dist" > \ "$VROOTDIR/$VHOST/etc/inittab" && rm -f "$VROOTDIR/$VHOST/etc/inittab.dist" fi # By default the Debian Install script runs zillions of cron jobs at # 0625 every morning. On a system with lots of vservers all trying to # scan the disk at the same time this causes $MAJOR disk-thrash. So # we randomize it a bit so that they run evenly between 1am and 7am, # avoiding the 5minutes either side of the hour when other stuff tends # to be scheduled. (BTW, this solution is Overkill!) # This looks over complicated--and it probably is...: # # a) We want the DAILY jobs to run between :05 and :55 minutes past # b) We want the WEEKLY job 3-5 minutes after the DAILY. # c) And the MONTHLY job 3-5 minutes after that. # d) Make sure all three jobs are started by 55minutes past (five-to) # ...if they were ever to all run on the same day! d1=$(($RANDOM % 3 + 3)); # between 3 and 5 d2=$(($RANDOM % 3 + 3)); # between 3 and 5 dt=$((50 - $d1 - $d2)); # between 0 and 44 DAILY=$(($RANDOM % $dt + 5)) # between 5 and 49 WEEKLY=$(($DAILY + $d1)) # between 8 and 52 MONTHLY=$(($WEEKLY + $d2)) # between 11 and 55 HOUR=$(($RANDOM % 6 + 1)) # between 1 and 7 (AM localtime) # Create replacement /etc/crontab with randomized times above cat << EOF > "$VROOTDIR/$VHOST/etc/crontab" # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the \`crontab\' # command to install the new version when you edit this file. # This file also has a username field, that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command $DAILY $HOUR * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily $WEEKLY $HOUR * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly $MONTHLY $HOUR 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly EOF if [ -n "$EXTRA_PACKAGES" ]; then EXTRA_PACKAGES_INSTALL="apt-get --assume-yes install ${EXTRA_PACKAGES//,/ }" fi if [ -f /etc/timezone ]; then tz=$(cat /etc/timezone) zonefile="$VROOTDIR/$VHOST/usr/share/zoneinfo/$tz" if [ -f "$zonefile" ]; then echo "$tz" >$VROOTDIR/$VHOST/etc/timezone cp "$zonefile" "$VROOTDIR/$VHOST/etc/localtime" fi fi if [ -n "$DEBCONF_FILE_DB" ]; then cp "$DEBCONF_FILE_DB" "$VROOTDIR/$VHOST/config.dat" SET_DEBCONF_OVERRIDE='export DEBCONF_DB_OVERRIDE="File{/config.dat}"' fi # ------------------------------------------------------------ # From here on we do things live in the server # Generate the script that runs the rest of the setup from within the # virtual server. cat << EOF > "$VROOTDIR/$VHOST/vserver-config.sh" #!/bin/sh $SET_DEBCONF_OVERRIDE [ -x /usr/sbin/locale-gen ] && /usr/sbin/locale-gen apt-get update if [ ! -f /etc/timezone ]; then # tzsetup was part of base-config which is gone since etch # tzconfig is part of libc, so it should be ubiquitious if [ -x /usr/sbin/tzsetup ]; then /usr/sbin/tzsetup -y elif [ -x /usr/sbin/tzconfig ]; then /usr/sbin/tzconfig fi fi dpkg-reconfigure -u passwd tasksel if [ "$DIST" == "woody" ]; then rm -f /etc/exim/exim.conf eximconfig fi # because the --exclude flag doesn\'t seem to work on debootstrap dpkg -P `echo $REMOVE_PACKAGES | sed -e 's/,/ /g'` for link in $REMOVE_LINKS do update-rc.d -f \$link remove update-rc.d -f \$link stop 90 3 . done $EXTRA_PACKAGES_INSTALL EOF # Run the post-installation script from outside the server if [ -n "$POST_INSTALL_HOST_SCRIPT" ]; then "$POST_INSTALL_HOST_SCRIPT" fi ## start vserver before we can exec anything inside it vserver $VHOST start # Run the above commands from within the server chmod 755 $VROOTDIR/$VHOST/vserver-config.sh vserver $VHOST exec /vserver-config.sh rm -f $VROOTDIR/$VHOST/vserver-config.sh rm -f "$VROOTDIR/$VHOST/config.dat" rm -f "$VROOTDIR/$VHOST/config.dat-old" # Run the post-installation script from within the server if [ -n "$POST_INSTALL_SCRIPT" ]; then cp "$POST_INSTALL_SCRIPT" $VROOTDIR/$VHOST/post_install_script chmod 755 $VROOTDIR/$VHOST/post_install_script vserver $VHOST exec /post_install_script rm -f $VROOTDIR/$VHOST/post_install_script fi # If you need to install your SSH management keys into the vserver if [ -f "$SSH_KEYS" ]; then mkdir -p "$VROOTDIR/$VHOST/root/.ssh" chmod 700 "$VROOTDIR/$VHOST/root/.ssh/" cat "$SSH_KEYS" >> "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" chmod 600 "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" fi ## stop the vserver vserver $VHOST stop # Populate the archive for future virtual servers if [ $PKGCACHE -eq 1 ] ; then if [ ! -d "$VROOTDIR/ARCHIVES/$DIST/partial" ] ; then mkdir -p "$VROOTDIR/ARCHIVES/$DIST/partial" fi cp "$VROOTDIR/$VHOST/"var/cache/apt/archives/*.deb "$VROOTDIR/ARCHIVES/$DIST" echo "Cleanup package cache." aptcleanup "$VROOTDIR/ARCHIVES/$DIST" fi echo echo "You should now adjust the configuration in /etc/vservers/$VHOST/" echo "to suit your needs," echo "or else just go ahead and type \`vserver $VHOST start' to start" echo "your new virtual server. debian/rules!" echo vserver-debiantools-0.8.1/COPYING0000664000000000000000000004310311173250420013434 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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 How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. vserver-debiantools-0.8.1/Makefile0000664000000000000000000000256711173250420014052 0ustar MANFILES=newvserver.1 newnfsvserver.1 dupvserver.1 stripserver.1 all: build-man build-man: $(MANFILES) newvserver.1: newvserver.pod pod2man --section=1 \ --release="Vserver " \ --date="`LANG=C date`" \ $^ > $@ newnfsvserver.1: newnfsvserver.pod pod2man --section=1 \ --release="Vserver " \ --date="`LANG=C date`" \ $^ > $@ dupvserver.1: dupvserver.pod pod2man --section=1 \ --release="Vserver " \ --date="`LANG=C date`" \ $^ > $@ stripserver.1: stripserver.pod pod2man --section=1 \ --release="Vserver " \ --date="`LANG=C date`" \ $^ > $@ install: install-sbin install-man install-conf install-var install-conf: newvserver-vars mkdir -p $(DESTDIR)/etc/vservers install -m 644 $^ $(DESTDIR)/etc/vservers install-sbin: newvserver.sh newnfsvserver.sh dupvserver.sh stripserver.sh mkdir -p $(DESTDIR)/usr/sbin install -m 755 $^ $(DESTDIR)/usr/sbin rename "s/.sh//;" $(DESTDIR)/usr/sbin/*.sh install-var: # Needed to make newvserver work as expected. mkdir -p $(DESTDIR)/var/lib/vserver-debiantools install-man: $(MANFILES) mkdir -p $(DESTDIR)/usr/share/man/man1 for m in $^ ; do \ gzip -9 -c $$m > $(DESTDIR)/usr/share/man/man1/$$m.gz ;\ done clean: clean-man clean-man: -rm *.1 vserver-debiantools-0.8.1/newnfsvserver.pod0000664000000000000000000000600211615710650016026 0ustar =head1 NAME newvserver - Creates a new Debian vserver by downloading packages via HTTP/FTP =head1 SYNOPSIS newvserver --hostname x --domain y.z --ip 1.2.3.4/24 [ OPTIONS ] =head1 DESCRIPTION =head1 OPTIONS Optional: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) --dist defaults to "squeeze", passed to debootstrap. --context n Set the context id to be used. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --interface interface for IP addresses (default "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) Default: http://ftp.uk.debian.org/debian --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver (syntax: --ip [/]) =head1 CONFIG FILE The following variables can be set in a configuration file. The configuration file is a normal shell file and is sourced to get the configuration variables. Packages to install in addition to the base defaults MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) INSTALL_PACKAGES="package1,package2" Packages installed from within the vserver after it has been setup (seperated by "," commas) EXTRA_PACKAGES="package1,package2" Packages to remove from the base defaults (seperated by "," commas) REMOVE_PACKAGES="package1,package2" Sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot" Architecture: overide on non-Debian host such as Redhat otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" Which Debian distribution (Warning. unstable and testing distributions change frequently so you can not expect it to work out of the box). DIST="squeeze" Local or nearest location of a Debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" Debian-non-US mirror (must include the '/debian-non-US', only used for woody) MIRROR_NON_US="http://non-us.debian.org/debian-non-US" mirror for security updates MIRROR_SECURITY="http://security.debian.org" Default network interface for vservers: INTERFACE="eth0" The name of a debconf database to be read by debconf's file driver. This can be used to store the answers for debconf questions during install and thus allows for unattended installation. See the debconf.conf(5) manual page for the file format. DEBCONF_FILE_DB="" =head1 AUTHOR Author of the manual page is Ola Lundqvist =head1 SEE ALSO util-vserver(1), dupvserver(1) =cut vserver-debiantools-0.8.1/newvserver-vars0000664000000000000000000000014311173250420015500 0ustar # Configuration file for newvserver # See man newvserver for the variables that you can set here. vserver-debiantools-0.8.1/dupvserver.pod0000664000000000000000000000174211440404640015317 0ustar =head1 NAME dupvserver - Creates a new Debian vserver by copying an other one. =head1 SYNOPSIS dupvserver [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 =head1 DESCRIPTION Copies a vserver using an other one. You can actually duplicate a running vserver without problems (unless the running applications can have problems with that). =head1 OPTIONS Optional: -h, --help this help -V, --version copyright and version information -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory --dev The network device to use for the new server --force Force duplication even if the new one exists Required: --from hostname for old vserver (eg. "alpha") --to hostname for new vserver (eg. "beta") --ip IPv4 address for new vserver =head1 AUTHOR Author of the manual page is Ola Lundqvist =head1 SEE ALSO util-vserver(1), newvserver(1) =cut vserver-debiantools-0.8.1/dupvserver.sh0000664000000000000000000001543311440404640015151 0ustar #!/bin/sh VERSION='0.7' # # Copyright (C) 2002-2010 Ola Lundqvist # Copyright (C) 2002 Paul Sladen # Copyright (C) 2002 Mark Lawrence # # This 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, or (at your option) any later # version. # # This 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 with # the source package as the file COPYING. If not, write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. VSERVERS_ROOT=/etc/vservers/.defaults/vdirbase if [ -r /etc/vservers.conf ] ; then . /etc/vservers.conf fi symlinkdest() { ls -l $* | sed -e "s|.*->[[:space:]]||;" } usage () { cat << EOF 1>&2 usage: ${0##*/} [OPTIONS] --ip n --from from --to to (see --help for more information) EOF } full_usage () { cat << EOF Usage: ${0##*/} [OPTIONS] --ip n --from from --to to Copy an old Debian vserver to a new name Copyright (C) 2002-2008 Ola Lundqvist Copyright (C) 2002 Paul Sladen Copyright (C) 2002 Mark Lawrence Options: -h, --help this help -V, --version copyright and version information -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory --dev The network device to use for the new server. --force Force duplication even if the new one eists. Required: --from hostname for old vserver (eg. "alpha") --to hostname for new vserver (eg. "beta") --ip IPv4 address for new vserver EOF } full_version () { cat << EOF ${0##*/} version $VERSION Copyright (C) 2002-2008 Ola Lundqvist Copyright (C) 2002 Mark Lawrence Copyright (C) 2002 Paul Sladen 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. EOF } parse_args () { while [ $# -gt 0 ] ; do #echo "parse_args() doing :$#: :$1: :$*:" case "$1" in --help|-h) full_usage shift exit 0 ;; --version|-V) full_version shift exit 0 ;; --dev) TODEV="$2" shift 2 ;; --force) FORCE=yes shift ;; --from) FROM="$2" shift 2 if [ ! -r "/etc/vservers/$FROM.conf" ] && [ ! -d "/etc/vservers/$FROM" ] ; then echo "ERROR: Vserver config for $FROM do not exist." exit 1 fi if [ -r "/etc/vservers/$FROM.conf" ] ; then . /etc/vservers/$FROM.conf FROMNAME=$S_HOSTNAME FROMIP=$IPROOT FROMDEV=$IPROOTDEV fi if [ -d "/etc/vservers/$FROM" ] ; then FROMNAME=$(cat /etc/vservers/$FROM/name) FROMIP=$(cat /etc/vservers/$FROM/interfaces/0/ip) FROMDEV=$(cat /etc/vservers/$FROM/interfaces/0/dev) fi ;; --to) TO="$2" shift 2 ;; --ip) # This does for an octet: ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;-) case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) TOIP="$2" ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 exit 1 ;; esac shift 2 ;; --verbose|-v) export verbose="true" shift ;; --vsroot) if [ -d "$2" ]; then VSERVERS_ROOT="$2" else echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers or /etc/vservers/.defaults/vdirbase"' 1>&2 exit 1 fi shift 2 ;; -*) usage exit 1 ;; ?*) usage exit 1 ;; esac done } parse_args $@ if ! [ -n "$FROM" -a -n "$TO" -a -n "$TOIP" ]; then echo "${0##*/} error: --from, --to and --ip are required" 1>&2 usage exit 1 fi if [ ! -d $VSERVERS_ROOT/$TO -o "$FORCE" = "yes" ] ; then mkdir -p $VSERVERS_ROOT/$TO rsync -a --delete \ --exclude=/proc --exclude=/dev/pts\ $VSERVERS_ROOT/$FROM/ $VSERVERS_ROOT/$TO mkdir -p $VSERVERS_ROOT/$TO/proc mkdir -p $VSERVERS_ROOT/$TO/dev/pts FINDTOREPNAME="$VSERVERS_ROOT/$TO/etc/hostname $VSERVERS_ROOT/$TO/etc/hosts $VSERVERS_ROOT/$TO/etc/motd" perl -pi -e "s#$FROM#$TO#g;" \ $FINDTOREPNAME if [ "$FROMIP" != "$TOIP" -o "$FORCE" = "yes" ] ; then FINDTOREPIP=$(rgrep -I "$FROMIP" $VSERVERS_ROOT/$TO/etc/ 2>&1 | sed -e "s/:.*//;" | grep -v "^grep$" | sort -u) if [ -n "$FINDTOREPIP" ] ; then perl -pi -e "s#$FROMIP#$TOIP#g;" \ $FINDTOREPIP fi fi echo "Changed the following files:" echo "$FINDTOREPNAME $FINDTOREPIP" | sort -u fi if [ -r /etc/vservers/$FROM.conf ] ; then if [ ! -r /etc/vservers/$TO.conf ] || [ "$FORCE" = "yes" ] ; then cp /etc/vservers/$FROM.conf /etc/vservers/$TO.conf perl -pi -e "s#$FROM#$TO#g;" \ /etc/vservers/$TO.conf if [ "$FROMIP" != "$TOIP" ] ; then perl -pi -e "s#$FROMIP#$TOIP#g;" \ /etc/vservers/$TO.conf fi if [ "$FROMDEV" != "$TODEV" -a -n "$TODEV" ] ; then perl -pi -e "s#$FROMDEV#$TODEV#g;" \ /etc/vservers/$TO.conf fi fi fi if [ -d /etc/vservers/$FROM ] ; then if [ ! -d /etc/vservers/$TO ] || [ "$FORCE" = "yes" ] ; then mkdir -p /etc/vservers/$TO rsync -a --delete \ /etc/vservers/$FROM/ /etc/vservers/$TO # Replace run if [ -L /etc/vservers/$TO/run ] ; then NEWRUN=$(symlinkdest /etc/vservers/$TO/run | sed -e "s|$FROM|$TO|;") rm -f /etc/vservers/$TO/run ln -s $NEWRUN /etc/vservers/$TO/run fi # Replace vdir if [ -L /etc/vservers/$TO/vdir ] ; then NEWVDIR=$(symlinkdest /etc/vservers/$TO/vdir | sed -e "s|$FROM|$TO|;") rm -f /etc/vservers/$TO/vdir ln -s $NEWVDIR /etc/vservers/$TO/vdir fi # Replace cache if [ -L /etc/vservers/$TO/cache ] ; then NEWCACHE=$(symlinkdest /etc/vservers/$TO/cache | sed -e "s|$FROM|$TO|;") rm -f /etc/vservers/$TO/cache ln -s $NEWCACHE /etc/vservers/$TO/cache fi # Replace some more echo $TO > /etc/vservers/$TO/name echo $TO > /etc/vservers/$TO/uts/nodename TT=$(find /etc/vservers/$TO/interfaces -type f -name name) if [ -n "$TT" ] ; then perl -pi -e "s#$FROM#$TO#g;" $TT fi if [ "$FROMIP" != "$TOIP" ] && [ -n "$FROMIP" ] && [ -n "$TOIP" ] ; then TT=$(find /etc/vservers/$TO/interfaces/ -type f -name ip) if [ -n "$TT" ] ; then perl -pi -e "s#$FROMIP#$TOIP#g;" $TT fi fi if [ "$FROMDEV" != "$TODEV" ] && [ -n "$FROMDEV" ] && [ -n "$TODEV" ] ; then TT=$(find /etc/vservers/$TO/interfaces/ -type f -name dev) perl -pi -e "s#$FROMDEV#$TODEV#g;" $TT fi fi fi vserver-debiantools-0.8.1/stripserver.sh0000664000000000000000000003730411615710405015340 0ustar #!/bin/bash VERSION='0.7' # # Copyright (C) 2002-2010 Ola Lundqvist # Copyright (C) 2006 Miroslav Kure # Copyright (C) 2002 Mark Lawrence # Copyright (C) 2002 Paul Sladen # # This 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, or (at your option) any later # version. # # This 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 with # the source package as the file COPYING. If not, write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. # # Strip a server so it can function as a virtual Debian server (vserver) # # ---------------------------------------------------------------------- # Configurable items: shopt -s extglob # Root directory of your virtual servers (probably shouldn't change this) VROOTDIR="/etc/vservers/.defaults/vdirbase" # Packages to install in addition to the base defaults # MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) INSTALL_PACKAGES="" if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then INSTALL_PACKAGES="$INSTALL_PACKAGES locales" fi # Packages installed from within the vserver after it has # been setup (seperated by "," commas) #EXTRA_PACKAGES="emacs20,lynx-ssl" EXTRA_PACKAGES="" # Packages to remove from the base defaults (seperated by "," commas) #REMOVE_PACKAGES="dhcp-client,lilo,makedev,pcmcia-cs,ppp,pppconfig,pppoe,pppoeconf,setserial,syslinux,nano,fdutils,iptables,libpcap0,pciutils" REMOVE_PACKAGES="dhcp-client,lilo,makedev,pcmcia-cs,ppp,pppconfig,pppoe,pppoeconf,setserial,syslinux,fdutils,iptables,libpcap0,pciutils,ntpd,ntpdate,ntp-simple,initrd-tools,isapnptools,modutils,modconf" #REMOVE_PACKAGES="dhcp-client,lilo,makedev,pcmcia-cs,ppp,pppconfig,pppoe,pppoeconf,setserial,syslinux,fdutils,iptables,libpcap0,pciutils" # sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot" # Default network interface for vservers: INTERFACE="eth0" # Copy vreboot/vhalt/vshutdown utility into /usr/local/sbin/ COPY_VREBOOT="true" if [ -r /etc/vservers/util-vserver-vars ] ; then . /etc/vservers/util-vserver-vars fi if [ -r /etc/vservers/newvserver-vars ] ; then . /etc/vservers/newvserver-vars fi # Support for 0.30.203 and above of util-vserver if [ -n "$DEFAULT_VSERVERDIR" ] ; then VROOTDIR = "$DEFAULT_VSERVERDIR" fi # ---------------------------------------------------------------- # Nothing from here on should need changing. # ---------------------------------------------------------------- # NOTE: debootstrap handles multiple MIRRORs, so there is no reason why # we shouldn't too--that way we could just let it build /etc/apt/sources.list usage () { cat << EOF 1>&2 usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 (see --help for more information) EOF } full_usage () { cat << EOF Usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 Creates a new Debian vserver by downloading packages via HTTP/FTP Options: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) --copy-vreboot install "vreboot/vshutdown/vhalt" --no-copy-vreboot don't install "vreboot/vshutdown/vhalt" --dist Deprecated option. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --interface interface for IP addresses (if not "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver EOF } full_version () { cat << EOF ${0##*/} version $VERSION Copyright (C) 2002-2010 Ola Lundqvist Copyright (C) 2006 Miroslav Kure Copyright (C) 2002 Mark Lawrence Copyright (C) 2002 Paul Sladen 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. EOF } parse_args () { while [ $# -gt 0 ] ; do #echo "parse_args() doing :$#: :$1: :$*:" case "$1" in --help|-h) full_usage shift exit 0 ;; --version|-V) full_version shift exit 0 ;; --conffile) if [ -r "$2" ] ; then . "$2" else echo "Error, can not load config file $2." exit 1 fi shift 2 ;; --copy-vreboot) COPY_VREBOOT="true" shift ;; --no-copy-vreboot) COPY_VREBOOT="" shift ;; --dist) echo -- "--dist is a depciated option for stripserver." shift 2 ;; --domain) case "$2" in [a-z]*[a-z]) VDOMAIN="$2" ;; *) echo "${0##*/} error: $1 requires a dns domain-name" 1>&2 echo 'e.g. "example.com"' 1>&2 exit 1 ;; esac shift 2 ;; --fakeinit) # Note space at beginning--this gets tagged straight on FAKEINIT=" fakeinit" shift ;; --hostname) case "$2" in [a-z0-9]?(*([a-z0-9_-])[a-z0-9])) VHOST="$2" ;; *) echo "${0##*/} error: $1 must be a hostname for the vserver" 1>&2 echo 'e.g. "alpha"' 1>&2 exit 1 ;; esac shift 2 ;; --interface) case "$2" in [a-z]*) INTERFACE="$2" ;; *) echo "${0##*/} error: $1 must be followed by a network interface" 1>&2 echo 'e.g. "eth1"' 1>&2 exit 1 ;; esac shift 2 ;; --ip) # This does for an octet: ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;-) case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) IP="$2" ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 exit 1 ;; esac shift 2 ;; --verbose|-v) export verbose="true" shift ;; --sshkeys) if [ -f "$2" ]; then SSH_KEYS="$2" else echo "${0##*/} error: $1 must be followed by a valid public-key-file!" 1>&2 echo 'e.g. "/root/.ssh/id_dsa.pub"' 1>&2 exit 1 fi shift 2 ;; --vsroot) case "$2" in /*) if [ -d "$2" ]; then VROOTDIR="$2" else echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers or /etc/vservers/.defaults/vdirbase"' 1>&2 exit 1 fi ;; *) echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers or /etc/vservers/.defaults/vdirbase"' 1>&2 exit 1 ;; esac shift 2 ;; -*) usage exit 1 ;; ?*) usage exit 1 ;; esac done } parse_args $@ if ! [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$IP" ]; then echo "${0##*/} error: --hostname, --domain and --ip are required" 1>&2 usage exit 1 fi # Strip final slashes off a couple of things VROOTDIR="${VROOTDIR%/}" if ! cat /proc/self/status | grep '^\(VxID:[^0-9]0\|s_context:[^0-9]0\)$'; then echo "${0##*/} error:" echo " Must be run from the host server (security context 0)" 1>&2 echo ' on a "vserver/ctx-patch" enabled kernel' 1>&2 echo ' See: http://www.solucorp.qc.ca/miscprj/s_context.hc' 1>&2 exit 1 fi if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then echo "${0##*/} error: Must be run as root!" 1>&2 exit 1 fi # check for /vserver/$VHOST/etc/ incase we have already stripped once. if [ -f "/etc/vservers/$VHOST.conf" ] ; then cat << EOF 1>&2 ${0##*/} error: Virtual Server "$VHOST" appears to already exist check "/etc/vservers/$VHOST.conf"; EOF exit 1 fi # check for /vserver/$VHOST/etc/ incase we have already stripped once. if [ ! -d "$VROOTDIR/$VHOST/etc" ] ; then cat << EOF 1>&2 ${0##*/} error: Virtual Server "$VHOST" dir do not exist check "$VROOTDIR/$VHOST/etc" EOF exit 1 fi # Fix up the available device nodes, for security if cd "$VROOTDIR/$VHOST/dev"; then tar cfp /var/cache/vserver/dev.tar.$$ full null ptmx random tty urandom zero rm -rf $VROOTDIR/$VHOST/dev/* tar xfp /var/cache/vserver/dev.tar.$$ rm /var/cache/vserver/dev.tar.$$ mkdir pts mkdir shm fi # Create a locale.gen if needed. if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then if [ ! -e "$VROOTDIR/$VHOST/etc/locale.gen" ] ; then echo $LANG $(locale charmap) > "$VROOTDIR/$VHOST/etc/locale.gen" elif ! grep $LANG "$VROOTDIR/$VHOST/etc/locale.gen" > /dev/null ; then echo $LANG $(locale charmap) >> "$VROOTDIR/$VHOST/etc/locale.gen" fi fi # Give the new host a hostname if ! grep $VHOST "$VROOTDIR/$VHOST/etc/hostname" > /dev/null ; then echo "Hostname not found in hostname file, rewriting and creating backup." mv "$VROOTDIR/$VHOST/etc/hostname" "$VROOTDIR/$VHOST/etc/hostname.backup" echo "$VHOST" > "$VROOTDIR/$VHOST/etc/hostname" fi if ! grep $VHOST "$VROOTDIR/$VHOST/etc/hosts" > /dev/null ; then echo "Hostname not found in hosts file, rewriting and creating backup." mv "$VROOTDIR/$VHOST/etc/hosts" "$VROOTDIR/$VHOST/etc/hostname.hosts.backup" # Set up the /etc/hosts file (needed for some parts of the base-config) cat << EOF > "$VROOTDIR/$VHOST/etc/hosts" # /etc/hosts 127.0.0.1 localhost $IP $VHOST.$VDOMAIN $VHOST # The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade) ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts EOF fi # grab DNS servers from the host-server for `resolv.conf' #(echo search $VDOMAIN ; grep '^nameserver' /etc/resolv.conf) \ # > "$VROOTDIR/$VHOST/etc/resolv.conf" # Create a dummy fstab cat << EOF > "$VROOTDIR/$VHOST/etc/fstab" # /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 EOF # The new vserver patch now automatically mounts /proc # Debian needs /dev/pts mounting "gid=5,mode=620" by vserver cat << EOF > "$VROOTDIR/$VHOST/etc/mtab" /dev/hdv1 / vfs none 0 0 proc /proc proc rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 EOF # Create a reduced inittab that doesn't start getty on the consoles cat << EOF > "$VROOTDIR/$VHOST/etc/inittab" # /etc/inittab: init(8) configuration. # The default runlevel. id:2:initdefault: # Boot-time system configuration/initialization script. # This is run first except when booting in emergency (-b) mode. si::sysinit:/etc/init.d/rcS # What to do in single-user mode. ~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change # of runlevel. # # Runlevel 0 is halt. # Runlevel 1 is single-user. # Runlevels 2-5 are multi-user. # Runlevel 6 is reboot. l0:0:wait:/etc/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 EOF # By default the Debian Install script runs zillions of cron jobs at # 0625 every morning. On a system with lots of vservers all trying to # scan the disk at the same time this causes $MAJOR disk-thrash. So # we randomize it a bit so that they run evenly between 1am and 7am, # avoiding the 5minutes either side of the hour when other stuff tends # to be scheduled. (BTW, this solution is Overkill!) # This looks over complicated--and it probably is...: # # a) We want the DAILY jobs to run between :05 and :55 minutes past # b) We want the WEEKLY job 3-5 minutes after the DAILY. # c) And the MONTHLY job 3-5 minutes after that. # d) Make sure all three jobs are started by 55minutes past (five-to) # ...if they were ever to all run on the same day! d1=$(($RANDOM % 3 + 3)); # between 3 and 5 d2=$(($RANDOM % 3 + 3)); # between 3 and 5 dt=$((50 - $d1 - $d2)); # between 0 and 44 DAILY=$(($RANDOM % $dt + 5)) # between 5 and 49 WEEKLY=$(($DAILY + $d1)) # between 8 and 52 MONTHLY=$(($WEEKLY + $d2)) # between 11 and 55 HOUR=$(($RANDOM % 6 + 1)) # between 1 and 7 (AM localtime) # Create replacement /etc/crontab with randomized times above cat << EOF > "$VROOTDIR/$VHOST/etc/crontab" # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the \`crontab\' # command to install the new version when you edit this file. # This file also has a username field, that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command $DAILY $HOUR * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily $WEEKLY $HOUR * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly $MONTHLY $HOUR 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly EOF # Create default /etc/vservers entry cat << EOF > /etc/vservers/$VHOST.conf S_HOSTNAME="$VHOST" IPROOT="$IP" IPROOTDEV="$INTERFACE" ONBOOT="yes" S_NICE="" S_FLAGS="lock nproc$FAKEINIT" ULIMIT="-H -u 256 -n 1024" S_CAPS="CAP_NET_RAW" # *NOT* DNS domain name, for NIS only S_DOMAINNAME="" EOF if [ -n "$EXTRA_PACKAGES" ]; then EXTRA_PACKAGES_INSTALL="apt-get --assume-yes install ${EXTRA_PACKAGES//,/ }" fi # ------------------------------------------------------------ # From here on we do things live in the server # Generate the script that runs the rest of the setup from within the # virtual server. cat << EOF > "$VROOTDIR/$VHOST/vserver-config.sh" #!/bin/sh [ -x /usr/sbin/locale-gen ] && /usr/sbin/locale-gen apt-get update ###tzsetup -y ###dpkg-reconfigure passwd ###tasksel ###rm -f /etc/exim/exim.conf ###eximconfig # because the --exclude flag doesn\'t seem to work on debootstrap apt-get --assume-yes --purge remove `echo $REMOVE_PACKAGES | sed -e 's/,/ /g'` for link in $REMOVE_LINKS do update-rc.d -f \$link remove done $EXTRA_PACKAGES_INSTALL EOF # Run the above commands from within the server chmod 755 $VROOTDIR/$VHOST/vserver-config.sh vserver $VHOST exec /vserver-config.sh rm -f $VROOTDIR/$VHOST/vserver-config.sh # If you need to install your SSH management keys into the vserver #if [ -f "$SSH_KEYS" ]; then # mkdir -p "$VROOTDIR/$VHOST/root/.ssh" # chmod 700 "$VROOTDIR/$VHOST/root/.ssh/" # cat "$SSH_KEYS" >> "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" # chmod 600 "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" #fi # Install the vreboot/rebootmgr utility--hopefully this will disappear soon VREBOOT_LOCATION="/usr/lib/util-vserver/vreboot" if [ "$COPY_VREBOOT" == "true" -a -x "$VREBOOT_LOCATION" ]; then cp -a "$VREBOOT_LOCATION" "$VROOTDIR/$VHOST/usr/local/sbin/" chmod 750 "$VROOTDIR/$VHOST/usr/local/sbin/vreboot" # ln -s "$VROOTDIR/$VHOST/usr/local/sbin/"{vshutdown,vreboot} # ln -s "$VROOTDIR/$VHOST/usr/local/sbin/"{vhalt,vreboot} fi # Stop all the processes that were started inside the server export PREVLEVEL=2 vserver $VHOST exec /etc/init.d/rc 0 vserver $VHOST stop # Populate the archive for future virtual servers #if [ ! -d $VROOTDIR/ARCHIVES ]; then # mkdir $VROOTDIR/ARCHIVES #fi #cp $VROOTDIR/$VHOST/var/cache/apt/archives/*.deb $VROOTDIR/ARCHIVES echo echo "You should now adjust /etc/vservers/$VHOST.conf to suit your needs," echo "or else just go ahead and type \`vserver $VHOST start' to start" echo "your new virtual server. debian/rules!" echo vserver-debiantools-0.8.1/stripserver.pod0000664000000000000000000000414111440474511015502 0ustar =head1 NAME stripserver - Strip a server from hardware related packages and files =head1 SYNOPSIS stripserver [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 =head1 DESCRIPTION This program strips a server directory from packages and files that is hardware related. This means that you can copy a complete filesystem to a vserver directory and then use this tool to strip the hardware related things from it. It only works with Debian servers though. =head1 OPTIONS Optional: -h, --help this help -V, --version copyright and version information --copy-vreboot install "vreboot/vshutdown/vhalt" --no-copy-vreboot don't install "vreboot/vshutdown/vhalt" --dist Deprecated option. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --interface interface for IP addresses (if not "eth0") --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver =head1 CONFIG FILE The following variables can be set in a configuration file. The configuration file is a normal shell file and is sourced to get the configuration variables. Packages to install in addition to the base defaults MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) INSTALL_PACKAGES="package1,package2" Packages installed from within the vserver after it has been setup (seperated by "," commas) EXTRA_PACKAGES="package1,package2" Packages to remove from the base defaults (seperated by "," commas) REMOVE_PACKAGES="package1,package2" Sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot" Default network interface for vservers: INTERFACE="eth0" Copy vreboot/vhalt/vshutdown utility into /usr/local/sbin/ COPY_VREBOOT="true" =head1 AUTHOR Author of the manual page is Ola Lundqvist =head1 SEE ALSO vserver(1), dupvserver(1), newvserver(1) =cut vserver-debiantools-0.8.1/newnfsvserver.sh0000664000000000000000000005035711615710564015676 0ustar #!/bin/bash VERSION='0.8' # # Copyright (C) 2003-2010 Ola Lundqvist # Copyright (C) 2009 Stefan Tomanek # Copyright (C) 2007 Tijs van Dam # Copyright (C) 2007 Jochen Voss # Copyright (C) 2006 Miroslav Kure # Copyright (C) 2002 Mark Lawrence # Copyright (C) 2002 Paul Sladen # # This 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, or (at your option) any later # version. # # This 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 with # the source package as the file COPYING. If not, write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. # # Install a virtual Debian server (vserver) from a Debian HTTP/FTP archive # # ---------------------------------------------------------------- # Configurable items: shopt -s extglob # No context id set by default CONTEXT= # Root directory of your virtual servers (probably shouldn't change this) # Support for 0.30.203 and above of util-vserver VROOTDIR="/etc/vservers/.defaults/vdirbase" # Packages to install in addition to the base defaults # MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) # Devfsd is very important. INSTALL_PACKAGES="nfsbooted" if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then INSTALL_PACKAGES="$INSTALL_PACKAGES locales" fi # Packages installed from within the vserver after it has # been setup (seperated by "," commas) EXTRA_PACKAGES="nfsbooted" # Packages to remove from the base defaults (seperated by "," commas) REMOVE_PACKAGES="lilo,makedev,nfs-kernel-server,lpr" # sysvinit services relating to hardware access to remove #REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot" # Architecture: overide on non-Debian host such as Redhat # otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" # Which Debian distribution # (warning: this has only been tested with # woody, sarge, etch, lenny and squeeze) DIST="squeeze" # Local or nearest location of a Debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" # Debian-non-US mirror (must include the '/debian-non-US', only used for woody) MIRROR_NON_US="http://non-us.debian.org/debian-non-US" # mirror for security updates MIRROR_SECURITY="http://security.debian.org" # Default network interface for vservers: INTERFACE="eth0" if [ -r /etc/vservers/util-vserver-vars ] ; then . /etc/vservers/util-vserver-vars fi # The name of a debconf database to be read by debconf's file driver. # This can be used to store the answers for debconf questions during # install and thus allows for unattended installation. See the # debconf.conf(5) manual page for the file format. DEBCONF_FILE_DB="" if [ -r /etc/vservers/newvserver-vars ] ; then . /etc/vservers/newvserver-vars fi # Support for 0.30.203 and above of util-vserver if [ -n "$DEFAULT_VSERVERDIR" ] ; then VROOTDIR="$DEFAULT_VSERVERDIR" fi # ---------------------------------------------------------------- # Nothing from here on should need changing. # ---------------------------------------------------------------- # NOTE: debootstrap handles multiple MIRRORs, so there is no reason why # we shouldn't too--that way we could just let it build /etc/apt/sources.list usage () { cat << EOF 1>&2 usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 (see --help for more information) EOF } full_usage () { cat << EOF Usage: ${0##*/} [OPTIONS] --hostname x --domain y.z --ip 1.2.3.4 --nfs-server 2.3.4.5 Creates a new Debian vserver by downloading packages via HTTP/FTP Options: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) --dist defaults to "squeeze", passed to debootstrap. --context n Set the context id to be used. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --interface interface for IP addresses (if not "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --nfs-server The ip of the nfs server to use. --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver (syntax: --ip [/]) Either --ip or --domain/--hostname may be omitted if the corresponding information can be found via a name server query. For this to work the dnsutils package must be installed. You can also set variables in /etc/vservers/newvserver-vars. EOF } full_version () { cat << EOF ${0##*/} version $VERSION Copyright (C) 2003-2010 Ola Lundqvist Copyright (C) 2007 Tijs van Dam Copyright (C) 2007 Jochen Voss Copyright (C) 2006 Miroslav Kure Copyright (C) 2002 Mark Lawrence Copyright (C) 2002 Paul Sladen 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. EOF } parse_args () { while [ $# -gt 0 ] ; do #echo "parse_args() doing :$#: :$1: :$*:" case "$1" in --help|-h) full_usage shift exit 0 ;; --version|-V) full_version shift exit 0 ;; --arch) case "$2" in [a-z]*) ARCH="$2" ;; *) echo "${0##*/} error: $1 overrides dpkg autodetect on non-Debian host-servers" 1>&2 echo 'e.g. "i386"' 1>&2 exit 1 ;; esac shift 2 ;; --context) CONTEXT=$2 shift 2 ;; --conffile) if [ -r "$2" ] ; then . "$2" else echo "Error, can not load config file $2." exit 1 fi shift 2 ;; --nfs-server) NFS_SERVER=$2 shift 2 ;; --dist) case "$2" in [a-z]*) DIST="$2" if [ "sarge" != "$2" ] && [ "woody" != "$2" ] && [ "etch" != "$2" ] && [ "lenny" != "$2" ] && [ "squeeze" != "$2" ] ; then echo "${0##*/} warning: I only know how to do \"woody\", \"sarge\", \"etch\", \"lenny\" and \"squeeze\", be careful!" 1>&2 fi ;; *) echo "${0##*/} error: $1 requires a Debian distribution" 1>&2 echo 'e.g. "woody", "sarge", "etch", "lenny" and "squeeze"' 1>&2 exit 1 ;; esac shift 2 ;; --domain) case "$2" in [a-z]*[a-z]) VDOMAIN="$2" ;; *) echo "${0##*/} error: $1 requires a dns domain-name" 1>&2 echo 'e.g. "example.com"' 1>&2 exit 1 ;; esac shift 2 ;; --fakeinit) # Note space at beginning--this gets tagged straight on FAKEINIT=" fakeinit" shift ;; --hostname) case "$2" in [a-z0-9]?(*([a-z0-9_-])[a-z0-9])) VHOST="$2" ;; *) echo "${0##*/} error: $1 must be a hostname for the vserver" 1>&2 echo 'e.g. "alpha"' 1>&2 exit 1 ;; esac shift 2 ;; --interface) case "$2" in [a-z]*) INTERFACE="$2" ;; *) echo "${0##*/} error: $1 must be followed by a network interface" 1>&2 echo 'e.g. "eth1"' 1>&2 exit 1 ;; esac shift 2 ;; --ip) # This does for an octet: ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;-) case "$2" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) IP="$2" ;; *) echo "${0##*/} error: $1 requires a single IPv4 e.g. \"192.168.100.1\"" 1>&2 exit 1 ;; esac shift 2 ;; --mirror) case "$2" in [hf]*:/*) MIRROR="$2" ;; *) echo "${0##*/} error: $1 requires a Debian mirror" 1>&2 echo 'e.g. "http://ftp.uk.debian.org/debian"' 1>&2 exit 1 ;; esac shift 2 ;; --verbose|-v) export verbose="true" shift ;; --sshkeys) if [ -f "$2" ]; then SSH_KEYS="$2" else echo "${0##*/} error: $1 must be followed by a valid public-key-file!" 1>&2 echo 'e.g. "/root/.ssh/id_dsa.pub"' 1>&2 exit 1 fi shift 2 ;; --vsroot) case "$2" in /*) if [ -d "$2" ]; then VROOTDIR="$2" else echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers or /etc/vservers/.defaults/vdirbase"' 1>&2 exit 1 fi ;; *) echo "${0##*/} error: $1 needs a valid absolute directory" 1>&2 echo 'e.g. "/vservers or /etc/vservers/.defaults/vdirbase"' 1>&2 exit 1 ;; esac shift 2 ;; -*) usage exit 1 ;; ?*) usage exit 1 ;; esac done } parse_args $@ if [ -x "$(which dig)" ] ; then if [ -n "$IP" -a \( -z "$VHOST" -o -z "$VDOMAIN" \) ]; then tmp=$(dig +short -x $(echo $IP | sed 's;/[0-9]*$;;')) if [ -n "$tmp" ]; then if [ -z "$VHOST" ]; then VHOST=$(echo $tmp | sed 's/\..*//') fi if [ -z "$VDOMAIN" ]; then VDOMAIN=$(echo $tmp | sed 's/[^.]*\.//') fi fi fi if [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$INTERFACE" -a -z "$IP" ]; then prefix=$(ip -o addr show dev "$INTERFACE" primary scope global | \ sed -n 's;.*inet [0-9.]*/\([0-9]*\).*;\1;p') IP="$(dig +short "$VHOST.$VDOMAIN")/$prefix" fi if ! [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$IP" ]; then echo "${0##*/} error: --hostname, --domain and --ip are required" 1>&2 usage exit 1 fi fi if ! [ -n "$VHOST" -a -n "$VDOMAIN" -a -n "$IP" -a -n "$NFS_SERVER" ]; then echo "${0##*/} error: --hostname, --domain, --ip and --nfs-server are required" 1>&2 usage exit 1 fi IP_ADDR=${IP%%/*} # Strip final slashes off a couple of things MIRROR="${MIRROR%/}" MIRROR_NON_US="${MIRROR_NON_US%/}" MIRROR_SECURITY="${MIRROR_SECURITY%/}" VROOTDIR="${VROOTDIR%/}" # Check we've got debootstrap available if [ ! -x /usr/sbin/debootstrap ]; then cat << EOF 1>&2 ${0##*/}: Requires the debootstrap package to bootstrap Debian Debian Host: apt-get install debootstrap RPM Host: rpm -i http://people.debian.org/~blade/install/debootstrap/debootstrap-0.1.17.3-2.i386.rpm EOF exit 1 fi if ! cat /proc/self/status | grep '^\(VxID:[^0-9]0\|s_context:[^0-9]0\)$'; then echo "${0##*/} error:" echo " Must be run from the host server (security context 0)" 1>&2 echo ' on a "vserver/ctx-patch" enabled kernel' 1>&2 echo ' See: http://www.solucorp.qc.ca/miscprj/s_context.hc' 1>&2 exit 1 fi if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then echo "${0##*/} error: Must be run as root!" 1>&2 exit 1 fi # check for /vserver/$VHOST/etc/ incase we are on pre-mounted LVM partition # (used to just check for "/vserver/$VHOST/" existing if [ -d "$VROOTDIR/$VHOST/etc/" -o -f "/etc/vservers/$VHOST.conf" ] ; then cat << EOF 1>&2 ${0##*/} error: Virtual Server "$VHOST" appears to already exist check "/etc/vservers/$VHOST.conf" or "/vservers/$VHOST/etc/"; EOF exit 1 fi # This is used to keep a cache of the downloaded .deb packges for next install if [ -d "$VROOTDIR/ARCHIVES/$DIST" ]; then mkdir -p "$VROOTDIR/$VHOST/var/cache/apt/archives" cp -a "$VROOTDIR/ARCHIVES/$DIST/"*.deb "$VROOTDIR/$VHOST/var/cache/apt/archives" fi # We only want to pass the Architecture if we need to (autodectected otherwise) if [ -n "$ARCH" ]; then ARCH_ARGUMENT="--arch $ARCH" fi # Function to optionally set a context id. CONTEXT_ARGUMENT= if [ -n "$CONTEXT" ] ; then CONTEXT_ARGUMENT="--context $CONTEXT" fi ## use "vserver ... build" to build the new vserver if [ -n "$INSTALL_PACKAGES" ] && [ -n "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --include="$INSTALL_PACKAGES" --exclude="$REMOVE_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi elif [ -n "$INSTALL_PACKAGES" ] && [ -z "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --include="$INSTALL_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi elif [ -z "$INSTALL_PACKAGES" ] && [ -n "$REMOVE_PACKAGES" ] ; then if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT \ --exclude="$REMOVE_PACKAGES" ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi else if ! /usr/sbin/vserver "$VHOST" build -m debootstrap \ --rootdir "$VROOTDIR" --hostname "$VHOST" \ --interface "$INTERFACE:$IP" \ $CONTEXT_ARGUMENT \ -- -d "$DIST" -m "$MIRROR" \ -- $ARCH_ARGUMENT ; then echo "${0##*/}: error: vserver-build failure. Cannot continue." exit 1 fi fi # Create a locale.gen if needed. if [ -n "$LANG" ] && [ "$LANG" != "C" ] ; then if [ ! -e "$VROOTDIR/$VHOST/etc/locale.gen" ] ; then echo $LANG $(locale charmap) > "$VROOTDIR/$VHOST/etc/locale.gen" elif ! grep $LANG "$VROOTDIR/$VHOST/etc/locale.gen" > /dev/null ; then echo $LANG $(locale charmap) >> "$VROOTDIR/$VHOST/etc/locale.gen" fi fi # Make it so that apt and friends work if [ "woody" == "$DIST" ] ; then cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main deb $MIRROR_NON_US $DIST/non-US main deb-src $MIRROR_NON_US $DIST/non-US main deb $MIRROR_SECURITY $DIST/updates main EOF else cat << EOF > "$VROOTDIR/$VHOST/etc/apt/sources.list" deb $MIRROR/ $DIST main deb-src $MIRROR/ $DIST main deb $MIRROR_SECURITY $DIST/updates main EOF fi # Fix up the available device nodes, for security if cd "$VROOTDIR/$VHOST/dev"; then tar cfp /var/cache/vserver/dev.tar.$$ full null ptmx random tty urandom zero rm -rf "$VROOTDIR/$VHOST/dev/"* tar xfp /var/cache/vserver/dev.tar.$$ rm /var/cache/vserver/dev.tar.$$ mkdir pts mkdir shm fi # Give the new host a hostname echo "$VHOST" > "$VROOTDIR/$VHOST/etc/hostname" # Set up the /etc/hosts file (needed for some parts of the base-config) cat << EOF > "$VROOTDIR/$VHOST/etc/hosts" # /etc/hosts 127.0.0.1 localhost $IP_ADDR $VHOST.$VDOMAIN $VHOST # The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade) ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts EOF # Set up network interface cat < "$VROOTDIR/$VHOST/etc/hosts" # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback # Do NEVER add the interface that you boot from here! EOF # grab DNS servers from the host-server for `resolv.conf' HOST_IP=$(ip -4 -o addr show primary scope global dev "$INTERFACE" | \ awk '$3 == "inet" {split($4,i,"/"); print i[1]; exit}') (echo search $VDOMAIN; grep '^nameserver' /etc/resolv.conf | sed "s/127.0.0.1/$HOST_IP/") \ > "$VROOTDIR/$VHOST/etc/resolv.conf" # If there is a proxy server statement in-use in the Host server, copy it across #if [ -f /etc/apt/apt.conf ]; then # cp /etc/apt/apt.conf $VROOTDIR/$VHOST/etc/apt/apt.conf #fi # support the apt.conf.d directories #if [ -d /etc/apt/apt.conf.d ] ; then # cp -a /etc/apt/apt.conf.d/* $VROOTDIR/$VHOST/etc/apt/apt.conf.d/ > /dev/null 2>&1 #fi mkdir -p $VROOTDIR/$VHOST/nfsroot # Create a dummy fstab cat << EOF > "$VROOTDIR/$VHOST/etc/fstab" # /etc/fstab: static file system information. # # $NFS_SERVER:$VROOTDIR/$VHOST / nfs defaults,rw,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/$VHOST /nfsroot nfs defaults,ro,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/usr /usr nfs defaults,ro,nfsvers=3 0 0 #$NFS_SERVER:$VROOTDIR/etc /etc nfs defaults,rw,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/lib /lib nfs defaults,ro,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/boot /boot nfs defaults,ro,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/bin /bin nfs defaults,ro,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/sbin /sbin nfs defaults,ro,nfsvers=3 0 0 $NFS_SERVER:$VROOTDIR/opt /opt nfs defaults,ro,nfsvers=3 0 0 proc /proc proc defaults 0 0 EOF # The new vserver patch now automatically mounts /proc # Debian needs /dev/pts mounting "gid=5,mode=620" by vserver cat << EOF > "$VROOTDIR/$VHOST/etc/mtab" /dev/hdv1 / vfs none 0 0 proc /proc proc rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 EOF # Create default /etc/vservers entry cat << EOF > /etc/vservers/$VHOST.conf S_HOSTNAME="$VHOST" IPROOT="$IP" IPROOTDEV="$INTERFACE" ONBOOT="yes" S_NICE="" S_FLAGS="lock nproc$FAKEINIT" ULIMIT="-H -u 256 -n 1024" S_CAPS="CAP_NET_RAW" # *NOT* DNS domain name, for NIS only S_DOMAINNAME="" EOF if [ -n "$EXTRA_PACKAGES" ]; then EXTRA_PACKAGES_INSTALL="apt-get --assume-yes install ${EXTRA_PACKAGES//,/ }" fi if [ -f /etc/timezone ]; then tz=$(cat /etc/timezone) zonefile="$VROOTDIR/$VHOST/usr/share/zoneinfo/$tz" if [ -f "$zonefile" ]; then echo "$tz" >$VROOTDIR/$VHOST/etc/timezone cp "$zonefile" "$VROOTDIR/$VHOST/etc/localtime" fi fi if [ -n "$DEBCONF_FILE_DB" ]; then cp "$DEBCONF_FILE_DB" "$VROOTDIR/$VHOST/config.dat" SET_DEBCONF_OVERRIDE='export DEBCONF_DB_OVERRIDE="File{/config.dat}"' fi # ------------------------------------------------------------ # From here on we do things live in the server # Generate the script that runs the rest of the setup from within the # virtual server. cat << EOF > $VROOTDIR/$VHOST/vserver-config.sh #!/bin/sh $SET_DEBCONF_OVERRIDE [ -x /usr/sbin/locale-gen ] && /usr/sbin/locale-gen apt-get update if [ ! -f /etc/timezone ]; then # tzsetup was part of base-config which is gone since etch # tzconfig is part of libc, so it should be ubiquitious if [ -x /usr/sbin/tzsetup ]; then /usr/sbin/tzsetup -y elif [ -x /usr/sbin/tzconfig ]; then /usr/sbin/tzconfig fi fi dpkg-reconfigure -u passwd tasksel rm -f /etc/exim/exim.conf eximconfig # because the --exclude flag doesn\'t seem to work on debootstrap apt-get --assume-yes --purge remove `echo $REMOVE_PACKAGES | sed -e 's/,/ /g'` for link in $REMOVE_LINKS do update-rc.d -f \$link remove done $EXTRA_PACKAGES_INSTALL EOF # Run the above commands from within the server chmod 755 $VROOTDIR/$VHOST/vserver-config.sh vserver $VHOST exec /vserver-config.sh rm -f $VROOTDIR/$VHOST/vserver-config.sh rm -f "$VROOTDIR/$VHOST/config.dat" rm -f "$VROOTDIR/$VHOST/config.dat-old" # If you need to install your SSH management keys into the vserver if [ -f "$SSH_KEYS" ]; then mkdir -p "$VROOTDIR/$VHOST/root/.ssh" chmod 700 "$VROOTDIR/$VHOST/root/.ssh/" cat "$SSH_KEYS" >> "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" chmod 600 "$VROOTDIR/$VHOST/root/.ssh/authorized_keys" fi # Stop all the processes that were started inside the server export PREVLEVEL=2 vserver $VHOST exec /etc/init.d/rc 0 vserver $VHOST stop cat $VROOTDIR/$VHOST/etc/nfsbooted/fstab >> $VROOTDIR/$VHOST/etc/fstab # Populate the archive for future virtual servers if [ ! -d $VROOTDIR/ARCHIVES/$DIST ]; then mkdir -p $VROOTDIR/ARCHIVES/$DIST fi cp $VROOTDIR/$VHOST/var/cache/apt/archives/*.deb $VROOTDIR/ARCHIVES/$DIST echo "Restarting rebootmgr." invoke-rc.d rebootmgr restart echo echo "You should now adjust /etc/vservers/$VHOST.conf to suit your needs," echo "or else just go ahead and type \`vserver $VHOST start' to start" echo "your new virtual server. debian/rules!" echo echo "Also make sure that /var/lib/vservers/ is exported from /etc/exports." echo vserver-debiantools-0.8.1/newvserver.pod0000664000000000000000000000755111615710700015325 0ustar =head1 NAME newvserver - Creates a new Debian vserver by calling vserver ... build =head1 SYNOPSIS newvserver --hostname x --domain y.z --ip 1.2.3.4/24 [OPTIONS] =head1 DESCRIPTION =head1 OPTIONS Optional: -h, --help this help -V, --version copyright and version information --arch set target architecture (eg. --arch "i386") (autodetected on Debian host if dpkg available) --dist defaults to "squeeze", passed to debootstrap. --context n Set the context id to be used. --fakeinit use "/sbin/init" to boot vserver --conffile extra configuration file to load. --post-install-script script to run after the installation finishes inside vserver. --post-install-host-script script to run after the installation finishes outside vserver and before post-install script. --interface interface for IP addresses (default "eth0") --mirror Debian HTTP/FTP mirror (including the /debian) Default: http://ftp.uk.debian.org/debian --sshkeys copy pub-keys to "/root/.ssh/authorized_keys" --pkgcache Package caching. -v, --verbose show extra output during setup --vsroot location of "/vserver/" directory Required: --hostname hostname for new vserver (eg. "alpha") --domain dns domain for new vserver (eg. "example.com") --ip IPv4 address for new vserver (syntax: --ip [/]) =head1 CONFIG FILE The following variables can be set in a configuration file. The configuration file is a normal shell file and is sourced to get the configuration variables. The file /etc/vservers/newvserver-vars is always sourced so this configuration file only override that file. # Default VROOTDIR VROOTDIR="/etc/vservers/.defaults/vdirbase" Packages to install in addition to the base defaults MUST INCLUDE ALL DEPENDENCIES (seperated by "," commas) INSTALL_PACKAGES="package1,package2" Packages installed from within the vserver after it has been setup (seperated by "," commas) EXTRA_PACKAGES="package1,package2" Packages to remove from the base defaults (seperated by "," commas) REMOVE_PACKAGES="package1,package2" Sysvinit services relating to hardware access to remove REMOVE_LINKS="klogd hwclock.sh setserial urandom networking umountfs halt reboot" Absolute path location of a script that you want to run after the vserver installation. POST_INSTALL_SCRIPT="" Absolute path location of a script that you want to run after the vserver installation but before the previous script and outside vserver context. This can be used for example to copy /etc/apt/sources.list from host. POST_INSTALL_HOST_SCRIPT="" Architecture: overide on non-Debian host such as Redhat otherwise dpkg will detect whether we are i386/powerpc/sparc/etc ARCH="" Which Debian distribution (Warning. unstable and testing distributions change frequently so you can not expect it to work out of the box). DIST="squeeze" Local or nearest location of a Debian mirror (must include the `/debian') MIRROR="http://ftp.uk.debian.org/debian" Debian-non-US mirror (must include the '/debian-non-US', only used for woody) MIRROR_NON_US="http://non-us.debian.org/debian-non-US" mirror for security updates MIRROR_SECURITY="http://security.debian.org" Default network interface for vservers: INTERFACE="eth0" Package caching: PKGCACHE=1 The name of a debconf database to be read by debconf's file driver. This can be used to store the answers for debconf questions during install and thus allows for unattended installation. See the debconf.conf(5) manual page for the file format. DEBCONF_FILE_DB="" =head1 AUTHOR Author of the manual page is Ola Lundqvist =head1 SEE ALSO util-vserver(1), dupvserver(1), stripserver(1) =cut vserver-debiantools-0.8.1/README0000664000000000000000000000642611615710426013300 0ustar History: ======== 0.8: ---- Removed the support for apt.conf copy from host as this cause failures in certain cases. 0.7: ---- Support for squeeze. 0.6: ---- Support for lenny and post install host script. 0.5: ---- Possible to do unattended installs. 0.4: ---- Make --hostname --ip and --domain options optional if a nameserver is available so they can be determined. One of --hostname or --ip still have to be used to query the database. Allow to use configurable mirrors for non-US and security updates. 0.3: ---- In 2006 etch is the default distribution for installations. 0.2: ---- In 2005 it has been modified a lot to use vserver ... build infrastructure available in latest version of util-vserver. This allow for the latest configuration structure and less code in newvserver program. 0.1: ---- In 2004 it was split out as a separate piece of software so it can evolve on its own. 0.0: ---- This software package was originally just a simple script to create virtual servers (vserver project) on Debian machines using debootstrap. It was first written by Mark Lawrence and then improved by Paul Sladen . Ola Lundqvist modified it further and included it (in 2002) the vserver package in the Debian GNU/Linux Distribution. Ola also added a couple of other scripts to make other tasks like stripping virtual servers and such. Package cache notice: ===================== Previous versions of newvserver saved archives in $VROOT/ARCHIVES. Due to problems with having the same dir for saved archives for multiple distributions this directory has been changed to $VROOT/ARCHIVES/$DIST. You can clean this directory. If you are creating virtual servers from a distribution that change over time (like testing and unstable) you may find similar errors. The solution is to clean the $VROOT/ARCHIVES/$DIST directory if it complains on unpacking a debfile that do not exist. Package caching can be disabled with the option --nopkgcache. Copyright: ========== Copyright (C) 2002-2010 Ola Lundqvist Copyright (C) 2009 Stefan Tomanek Copyright (C) 2007 Jochen Voss Copyright (C) 2006 Miroslav Kure Copyright (C) 2005 Thomas Gelf Copyright (C) 2005 Daniel Hermann Copyright (C) 2002 Paul Sladen Copyright (C) 2002 Mark Lawrence License: ======== 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.