File: preposthook.patch

package info (click to toggle)
vserver-debiantools 0.7.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 212 kB
  • ctags: 24
  • sloc: sh: 1,609; makefile: 90
file content (75 lines) | stat: -rw-r--r-- 3,080 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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