OoO En  ce doux début de matinée  du lundi 25 février  2008, vers 08:06,
Ola Lundqvist <[EMAIL PROTECTED]> disait:

> Hi
> Yes that could be something. Patches are welcome! :)

Here is one.  I don't know if the  name of the new option  is obvious or
just dump. Feel free to adapt.

diff -Naur vserver-debiantools-0.5.0.ori/newvserver.pod vserver-debiantools-0.5.0/newvserver.pod
--- vserver-debiantools-0.5.0.ori/newvserver.pod	2007-10-07 12:32:10.000000000 +0200
+++ vserver-debiantools-0.5.0/newvserver.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/newvserver.sh	2007-10-07 12:32:10.000000000 +0200
+++ vserver-debiantools-0.5.0/newvserver.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
 
-- 
Follow each decision as closely as possible with its associated action.
            - The Elements of Programming Style (Kernighan & Plauger)

Reply via email to