visfleet-deprec 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +398 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +154 -0
- data/THANKS +17 -0
- data/bin/depify +139 -0
- data/docs/EXAMPLE-installing_tracks.txt +41 -0
- data/docs/README.nagios +22 -0
- data/docs/README.rails +17 -0
- data/docs/config_gen_explained.txt +39 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/old/deprec_banner.gif +0 -0
- data/docs/windows_linux.txt +350 -0
- data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
- data/docs/xen/xen-tools-notes.txt +31 -0
- data/docs/xen/xen_on_hardy.txt +39 -0
- data/lib/deprec.rb +8 -0
- data/lib/deprec/capistrano_extensions.rb +438 -0
- data/lib/deprec/recipes.rb +7 -0
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +270 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/chef.rb +68 -0
- data/lib/deprec/recipes/collectd.rb +112 -0
- data/lib/deprec/recipes/db/couchdb.rb +107 -0
- data/lib/deprec/recipes/db/mysql.rb +139 -0
- data/lib/deprec/recipes/db/postgresql.rb +104 -0
- data/lib/deprec/recipes/db/sqlite.rb +37 -0
- data/lib/deprec/recipes/ddclient.rb +51 -0
- data/lib/deprec/recipes/deprec.rb +199 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb +55 -0
- data/lib/deprec/recipes/haproxy.rb +106 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/integrity.rb +108 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +49 -0
- data/lib/deprec/recipes/monit.rb +143 -0
- data/lib/deprec/recipes/nagios.rb +330 -0
- data/lib/deprec/recipes/network.rb +93 -0
- data/lib/deprec/recipes/ntp.rb +103 -0
- data/lib/deprec/recipes/php.rb +58 -0
- data/lib/deprec/recipes/postfix.rb +115 -0
- data/lib/deprec/recipes/rails.rb +337 -0
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +40 -0
- data/lib/deprec/recipes/sphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +111 -0
- data/lib/deprec/recipes/ssl.rb +56 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +171 -0
- data/lib/deprec/recipes/syslog.rb +63 -0
- data/lib/deprec/recipes/trac.rb +277 -0
- data/lib/deprec/recipes/ubuntu.rb +35 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes/utils.rb +58 -0
- data/lib/deprec/recipes/vnstat.rb +85 -0
- data/lib/deprec/recipes/web/apache.rb +143 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +278 -0
- data/lib/deprec/recipes/xentools.rb +75 -0
- data/lib/deprec/recipes_minus_rails.rb +61 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
- data/lib/deprec/templates/apache/ports.conf.erb +5 -0
- data/lib/deprec/templates/apache/status.conf.erb +17 -0
- data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
- data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
- data/lib/deprec/templates/chef/chef.json.erb +1 -0
- data/lib/deprec/templates/chef/solo.rb +2 -0
- data/lib/deprec/templates/collectd/collectd-init.d +153 -0
- data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
- data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
- data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
- data/lib/deprec/templates/haproxy/haproxy.cfg.erb +42 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/integrity/apache_vhost.erb +4 -0
- data/lib/deprec/templates/integrity/config.ru.erb +21 -0
- data/lib/deprec/templates/integrity/config.yml.erb +43 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/mongrel/nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/README +32 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -0
- data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
- data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
- data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
- data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
- data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
- data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
- data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +18 -0
- data/lib/deprec/templates/network/resolv.conf.erb +6 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +62 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/passenger/apache_vhost.erb +29 -0
- data/lib/deprec/templates/passenger/apache_vhost_disabled.erb +18 -0
- data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -0
- data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/postfix/main.cf.erb +36 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/postgresql/pg_hba.conf.erb +3 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
- data/lib/deprec/templates/starling/monit.conf.erb +14 -0
- data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
- data/lib/deprec/templates/syslog/syslogd.erb +13 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
- data/lib/deprec/templates/trac/trac.ini.erb +169 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
- data/lib/deprec/templates/vnstat/config.php +57 -0
- data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
- data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
- data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +57 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/deprec_minus_rails.rb +12 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/vmbuilder_plugins/gem.rb +97 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +245 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
### BEGIN INIT INFO
|
3
|
+
# Provides: xend
|
4
|
+
# Required-Start: $local_fs
|
5
|
+
# Required-Stop: $local_fs
|
6
|
+
# Default-Start: 2 3 4 5
|
7
|
+
# Default-Stop: S 0 1 6
|
8
|
+
# Short-Description: XEN control daemon
|
9
|
+
# Description: XEN control daemon
|
10
|
+
### END INIT INFO
|
11
|
+
|
12
|
+
if ! grep -q "control_d" /proc/xen/capabilities ; then
|
13
|
+
exit 0
|
14
|
+
fi
|
15
|
+
|
16
|
+
# Wait for Xend to be up
|
17
|
+
function await_daemons_up
|
18
|
+
{
|
19
|
+
i=1
|
20
|
+
rets=10
|
21
|
+
xend status
|
22
|
+
while [ $? -ne 0 -a $i -lt $rets ]; do
|
23
|
+
sleep 1
|
24
|
+
echo -n .
|
25
|
+
i=$(($i + 1))
|
26
|
+
xend status
|
27
|
+
done
|
28
|
+
}
|
29
|
+
|
30
|
+
case "$1" in
|
31
|
+
start)
|
32
|
+
xend start
|
33
|
+
await_daemons_up
|
34
|
+
;;
|
35
|
+
stop)
|
36
|
+
/etc/init.d/xendomains stop # make sure domains are shut down
|
37
|
+
xend stop
|
38
|
+
;;
|
39
|
+
status)
|
40
|
+
xend status
|
41
|
+
;;
|
42
|
+
reload)
|
43
|
+
xend reload
|
44
|
+
;;
|
45
|
+
restart|force-reload)
|
46
|
+
xend restart
|
47
|
+
await_daemons_up
|
48
|
+
;;
|
49
|
+
*)
|
50
|
+
# do not advertise unreasonable commands that there is no reason
|
51
|
+
# to use with this device
|
52
|
+
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
|
53
|
+
exit 1
|
54
|
+
esac
|
55
|
+
|
56
|
+
exit $?
|
57
|
+
|
@@ -0,0 +1,137 @@
|
|
1
|
+
## Path: System/xen
|
2
|
+
## Description: xen domain start/stop on boot
|
3
|
+
## Type: string
|
4
|
+
## Default:
|
5
|
+
#
|
6
|
+
# The xendomains script can send SysRq requests to domains on shutdown.
|
7
|
+
# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility
|
8
|
+
# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks
|
9
|
+
# of the domains ("s").
|
10
|
+
#
|
11
|
+
XENDOMAINS_SYSRQ=""
|
12
|
+
|
13
|
+
## Type: integer
|
14
|
+
## Default: 100000
|
15
|
+
#
|
16
|
+
# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait
|
17
|
+
# (in microseconds) after each SysRq, so the domain has a chance to react.
|
18
|
+
# If you want to a quick'n'dirty shutdown via SysRq, you may want to set
|
19
|
+
# it to a relatively high value (1200000).
|
20
|
+
#
|
21
|
+
XENDOMAINS_USLEEP=100000
|
22
|
+
|
23
|
+
## Type: integer
|
24
|
+
## Default: 5000000
|
25
|
+
#
|
26
|
+
# When creating a guest domain, it is sensible to allow a little time for it
|
27
|
+
# to get started before creating another domain or proceeding through the
|
28
|
+
# boot process. Without this, the booting guests will thrash the disk as they
|
29
|
+
# start up. This timeout (in microseconds) specifies the delay after guest
|
30
|
+
# domain creation.
|
31
|
+
#
|
32
|
+
XENDOMAINS_CREATE_USLEEP=5000000
|
33
|
+
|
34
|
+
## Type: string
|
35
|
+
## Default: ""
|
36
|
+
#
|
37
|
+
# Set this to a non-empty string if you want to migrate virtual machines
|
38
|
+
# on shutdown. The string will be passed to the xm migrate DOMID command
|
39
|
+
# as is: It should contain the target IP address of the physical machine
|
40
|
+
# to migrate to and optionally parameters like --live. Leave empty if
|
41
|
+
# you don't want to try virtual machine relocation on shutdown.
|
42
|
+
# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for
|
43
|
+
# that domain.
|
44
|
+
#
|
45
|
+
XENDOMAINS_MIGRATE=""
|
46
|
+
|
47
|
+
## Type: string
|
48
|
+
## Default: /var/lib/xen/save
|
49
|
+
#
|
50
|
+
# Directory to save running domains to when the system (dom0) is
|
51
|
+
# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
|
52
|
+
# is set (see below). Leave empty to disable domain saving on shutdown
|
53
|
+
# (e.g. because you rather shut domains down).
|
54
|
+
# If domain saving does succeed, SHUTDOWN will not be executed.
|
55
|
+
#
|
56
|
+
# XENDOMAINS_SAVE=/var/lib/xen/save
|
57
|
+
|
58
|
+
## Type: string
|
59
|
+
## Default: "--halt --wait"
|
60
|
+
#
|
61
|
+
# If neither MIGRATE nor SAVE were enabled or if they failed, you can
|
62
|
+
# try to shut down a domain by sending it a shutdown request. To do this,
|
63
|
+
# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting
|
64
|
+
# for the domain to be really down. Leave empty to skip domain shutdown.
|
65
|
+
#
|
66
|
+
XENDOMAINS_SHUTDOWN="--halt --wait"
|
67
|
+
|
68
|
+
## Type: string
|
69
|
+
## Default: "--all --halt --wait"
|
70
|
+
#
|
71
|
+
# After we have gone over all virtual machines (resp. all automatically
|
72
|
+
# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq,
|
73
|
+
# migrated, saved and/or shutdown according to the settings above, we
|
74
|
+
# might want to shutdown the virtual machines that are still running
|
75
|
+
# for some reason or another. To do this, set this variable to
|
76
|
+
# "--all --halt --wait", it will be passed to xm shutdown.
|
77
|
+
# Leave it empty not to do anything special here.
|
78
|
+
# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY
|
79
|
+
# is set.)
|
80
|
+
#
|
81
|
+
XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait"
|
82
|
+
|
83
|
+
## Type: boolean
|
84
|
+
## Default: true
|
85
|
+
#
|
86
|
+
# This variable determines whether saved domains from XENDOMAINS_SAVE
|
87
|
+
# will be restored on system startup.
|
88
|
+
#
|
89
|
+
XENDOMAINS_RESTORE=true
|
90
|
+
|
91
|
+
## Type: string
|
92
|
+
## Default: /etc/xen/auto
|
93
|
+
#
|
94
|
+
# This variable sets the directory where domains configurations
|
95
|
+
# are stored that should be started on system startup automatically.
|
96
|
+
# Leave empty if you don't want to start domains automatically
|
97
|
+
# (or just don't place any xen domain config files in that dir).
|
98
|
+
# Note that the script tries to be clever if both RESTORE and AUTO are
|
99
|
+
# set: It will first restore saved domains and then only start domains
|
100
|
+
# in AUTO which are not running yet.
|
101
|
+
# Note that the name matching is somewhat fuzzy.
|
102
|
+
#
|
103
|
+
XENDOMAINS_AUTO=/etc/xen/auto
|
104
|
+
|
105
|
+
## Type: boolean
|
106
|
+
## Default: false
|
107
|
+
#
|
108
|
+
# If this variable is set to "true", only the domains started via config
|
109
|
+
# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ,
|
110
|
+
# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise
|
111
|
+
# all running domains will be.
|
112
|
+
# Note that the name matching is somewhat fuzzy.
|
113
|
+
#
|
114
|
+
XENDOMAINS_AUTO_ONLY=false
|
115
|
+
|
116
|
+
## Type: integer
|
117
|
+
## Default: 300
|
118
|
+
#
|
119
|
+
# On xendomains stop, a number of xm commands (xm migrate, save, shutdown,
|
120
|
+
# shutdown --all) may be executed. In the worst case, these commands may
|
121
|
+
# stall forever, which will prevent a successful shutdown of the machine.
|
122
|
+
# If this variable is non-zero, the script will set up a watchdog timer
|
123
|
+
# for every of these xm commands and time it out after the number of seconds
|
124
|
+
# specified by this variable.
|
125
|
+
# Note that SHUTDOWN_ALL will not be called if no virtual machines or only
|
126
|
+
# zombies are still running, so you don't need to enable this timeout just
|
127
|
+
# for the zombie case.
|
128
|
+
# The setting should be large enough to make sure that migrate/save/shutdown
|
129
|
+
# can succeed. If you do live migrations, keep in mind that live migration
|
130
|
+
# of a 1GB machine over Gigabit ethernet may actually take something like
|
131
|
+
# 100s (assuming that live migration uses 10% of the network # bandwidth).
|
132
|
+
# Depending on the virtual machine, a shutdown may also require a significant
|
133
|
+
# amount of time. So better setup this variable to a huge number and hope the
|
134
|
+
# watchdog never fires.
|
135
|
+
#
|
136
|
+
XENDOMAINS_STOP_MAXWAIT=300
|
137
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# This script disables the hardware clock.
|
4
|
+
#
|
5
|
+
# Steve
|
6
|
+
# --
|
7
|
+
# http://www.steve.org.uk/
|
8
|
+
|
9
|
+
|
10
|
+
prefix=$1
|
11
|
+
|
12
|
+
|
13
|
+
#
|
14
|
+
# Source our common functions
|
15
|
+
#
|
16
|
+
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
17
|
+
. /usr/lib/xen-tools/common.sh
|
18
|
+
else
|
19
|
+
. ./hooks/common.sh
|
20
|
+
fi
|
21
|
+
|
22
|
+
|
23
|
+
#
|
24
|
+
# Log our start
|
25
|
+
#
|
26
|
+
logMessage Script $0 starting
|
27
|
+
|
28
|
+
|
29
|
+
#
|
30
|
+
# Disable the startup scripts from all runlevels.
|
31
|
+
#
|
32
|
+
chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove
|
33
|
+
chroot ${prefix} /usr/sbin/update-rc.d -f hwclockfirst.sh remove
|
34
|
+
rm -f ${prefix}/etc/init.d/hwclock.sh ${prefix}/etc/init.d/hwclockfirst.sh ${prefix}/etc/udev/rules.d/85-hwclock.rules
|
35
|
+
|
36
|
+
#
|
37
|
+
# Log our finish
|
38
|
+
#
|
39
|
+
logMessage Script $0 finished.
|
40
|
+
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# This script sets up the /etc/network/interface file for the new
|
4
|
+
# image.
|
5
|
+
#
|
6
|
+
# Steve
|
7
|
+
# --
|
8
|
+
# http://www.steve.org.uk/
|
9
|
+
|
10
|
+
|
11
|
+
prefix=$1
|
12
|
+
|
13
|
+
#
|
14
|
+
# Source our common functions
|
15
|
+
#
|
16
|
+
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
17
|
+
. /usr/lib/xen-tools/common.sh
|
18
|
+
else
|
19
|
+
. ./hooks/common.sh
|
20
|
+
fi
|
21
|
+
|
22
|
+
|
23
|
+
#
|
24
|
+
# Log our start
|
25
|
+
#
|
26
|
+
logMessage Script $0 starting
|
27
|
+
|
28
|
+
|
29
|
+
#
|
30
|
+
# Make sure we have an /etc/network directory.
|
31
|
+
#
|
32
|
+
mkdir -p ${prefix}/etc/network
|
33
|
+
|
34
|
+
|
35
|
+
#
|
36
|
+
# A function to setup DHCP for our new image.
|
37
|
+
#
|
38
|
+
setupDynamicNetworking ()
|
39
|
+
{
|
40
|
+
#
|
41
|
+
# The host is using DHCP.
|
42
|
+
#
|
43
|
+
cat <<E_O_DHCP > ${prefix}/etc/network/interfaces
|
44
|
+
# This file describes the network interfaces available on your system
|
45
|
+
# and how to activate them. For more information, see interfaces(5).
|
46
|
+
|
47
|
+
# The loopback network interface
|
48
|
+
auto lo
|
49
|
+
iface lo inet loopback
|
50
|
+
|
51
|
+
# The primary network interface
|
52
|
+
auto eth0
|
53
|
+
iface eth0 inet dhcp
|
54
|
+
post-up ethtool -K eth0 tx off
|
55
|
+
|
56
|
+
#
|
57
|
+
# The commented out line above will disable TCP checksumming which
|
58
|
+
# might resolve problems for some users. It is disabled by default
|
59
|
+
#
|
60
|
+
E_O_DHCP
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
#
|
66
|
+
# A function to setup static IP addresses for our new image.
|
67
|
+
#
|
68
|
+
setupStaticNetworking ()
|
69
|
+
{
|
70
|
+
#
|
71
|
+
# broadcast address?
|
72
|
+
#
|
73
|
+
bcast='';
|
74
|
+
if [ ! -z "${broadcast}" ]; then
|
75
|
+
bcast=" broadcast ${broadcast}"
|
76
|
+
fi
|
77
|
+
|
78
|
+
#
|
79
|
+
# We have a static IP address
|
80
|
+
#
|
81
|
+
cat <<E_O_STATIC >${prefix}/etc/network/interfaces
|
82
|
+
# This file describes the network interfaces available on your system
|
83
|
+
# and how to activate them. For more information, see interfaces(5).
|
84
|
+
|
85
|
+
# The loopback network interface
|
86
|
+
auto lo
|
87
|
+
iface lo inet loopback
|
88
|
+
|
89
|
+
# The primary network interface
|
90
|
+
auto eth0
|
91
|
+
iface eth0 inet static
|
92
|
+
address ${ip1}
|
93
|
+
gateway ${gateway}
|
94
|
+
netmask ${netmask}
|
95
|
+
${bcast}
|
96
|
+
post-up ethtool -K eth0 tx off
|
97
|
+
|
98
|
+
#
|
99
|
+
# The commented out line above will disable TCP checksumming which
|
100
|
+
# might resolve problems for some users. It is disabled by default
|
101
|
+
#
|
102
|
+
E_O_STATIC
|
103
|
+
|
104
|
+
interface=1
|
105
|
+
count=2
|
106
|
+
|
107
|
+
while [ "${count}" -le "${ip_count}" ]; do
|
108
|
+
|
109
|
+
value=\$ip${count}
|
110
|
+
value=`eval echo $value`
|
111
|
+
|
112
|
+
logMessage Adding etho:${interface}
|
113
|
+
|
114
|
+
cat <<E_O_STATIC >>${prefix}/etc/network/interfaces
|
115
|
+
auto eth0:${interface}
|
116
|
+
iface eth0:${interface} inet static
|
117
|
+
address ${value}
|
118
|
+
netmask ${netmask}
|
119
|
+
post-up ethtool -K eth0 tx off
|
120
|
+
E_O_STATIC
|
121
|
+
count=`expr $count + 1`
|
122
|
+
interface=`expr $interface + 1`
|
123
|
+
done
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
#
|
130
|
+
# Call the relevant function
|
131
|
+
#
|
132
|
+
if [ -z "${dhcp}" ]; then
|
133
|
+
logMessage "Setting up static networking"
|
134
|
+
setupStaticNetworking
|
135
|
+
|
136
|
+
else
|
137
|
+
logMessage "Setting up DHCP networking"
|
138
|
+
setupDynamicNetworking
|
139
|
+
fi
|
140
|
+
|
141
|
+
|
142
|
+
#
|
143
|
+
# Log our finish
|
144
|
+
#
|
145
|
+
logMessage Script $0 finished
|
@@ -0,0 +1,276 @@
|
|
1
|
+
##
|
2
|
+
# /etc/xen-tools/xen-tools.conf
|
3
|
+
##
|
4
|
+
#
|
5
|
+
# This is the global configuration file for the scripts included
|
6
|
+
# within the xen-tools package.
|
7
|
+
#
|
8
|
+
# For more details please see:
|
9
|
+
#
|
10
|
+
# http://xen-tools.org/
|
11
|
+
#
|
12
|
+
##
|
13
|
+
|
14
|
+
|
15
|
+
##
|
16
|
+
#
|
17
|
+
# File Format
|
18
|
+
# -----------
|
19
|
+
#
|
20
|
+
# Anything following a '#' character is ignored as a comment.
|
21
|
+
#
|
22
|
+
# Otherwise the format of this file "key = value". The value of
|
23
|
+
# any keys in this file may be constructed via the output of a command.
|
24
|
+
#
|
25
|
+
# For example:
|
26
|
+
#
|
27
|
+
# kernel = /boot/vmlinuz-`uname -r`
|
28
|
+
#
|
29
|
+
##
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
##
|
35
|
+
# Output directory for storing loopback images.
|
36
|
+
#
|
37
|
+
# If you choose to use loopback images, which are simple to manage but
|
38
|
+
# slower than LVM partitions, then specify a directory here and uncomment
|
39
|
+
# the line.
|
40
|
+
#
|
41
|
+
# New instances will be stored in subdirectories named after their
|
42
|
+
# hostnames.
|
43
|
+
#
|
44
|
+
##
|
45
|
+
# dir = /home/xen
|
46
|
+
#
|
47
|
+
|
48
|
+
#
|
49
|
+
##
|
50
|
+
#
|
51
|
+
# If you don't wish to use loopback images then you may specify an
|
52
|
+
# LVM volume group here instead
|
53
|
+
#
|
54
|
+
##
|
55
|
+
lvm = xendisks
|
56
|
+
|
57
|
+
|
58
|
+
#
|
59
|
+
##
|
60
|
+
#
|
61
|
+
# Installation method.
|
62
|
+
#
|
63
|
+
# There are four distinct methods which you may to install a new copy
|
64
|
+
# of Linux to use in your Xen guest domain:
|
65
|
+
#
|
66
|
+
# - Installation via the debootstrap command.
|
67
|
+
# - Installation via the rpmstrap command.
|
68
|
+
# - Installation via the rinse command.
|
69
|
+
# - Installation by copying a directory containing a previous installation.
|
70
|
+
# - Installation by untarring a previously archived image.
|
71
|
+
#
|
72
|
+
# NOTE That if you use the "untar", or "copy" options you should ensure
|
73
|
+
# that the image you're left with matches the 'dist' setting later in
|
74
|
+
# this file.
|
75
|
+
#
|
76
|
+
#
|
77
|
+
##
|
78
|
+
#
|
79
|
+
#
|
80
|
+
# install-method = [ debootstrap | rinse | rpmstrap | copy | tar ]
|
81
|
+
#
|
82
|
+
#
|
83
|
+
install-method = debootstrap
|
84
|
+
|
85
|
+
#
|
86
|
+
# If you're using the "copy", or "tar" installation methods you must
|
87
|
+
# need to specify the source location to copy from, or the source
|
88
|
+
# .tar file to unpack.
|
89
|
+
#
|
90
|
+
# You may specify that with a line such as:
|
91
|
+
#
|
92
|
+
# install-source = /path/to/copy
|
93
|
+
# install-source = /some/path/img.tar
|
94
|
+
#
|
95
|
+
#
|
96
|
+
|
97
|
+
#
|
98
|
+
##
|
99
|
+
# Command definitions.
|
100
|
+
##
|
101
|
+
#
|
102
|
+
# The "rinse", and "rpmstrap" commands are hardwired into
|
103
|
+
# the script, but if you wish to modify the commands which are executed
|
104
|
+
# when installing new systems by a "copy", "debootstrap", or "tar" method
|
105
|
+
# you can do so here:
|
106
|
+
#
|
107
|
+
# (This allows you to install from a .tar.bz file, rather than a plain
|
108
|
+
# tar file, use cdebootstrap, etc.)
|
109
|
+
#
|
110
|
+
# install-method=copy:
|
111
|
+
# copy-cmd = /bin/cp -a $src/* $dest
|
112
|
+
#
|
113
|
+
# install-method=debootstrap:
|
114
|
+
# debootstrap-cmd=/usr/sbin/debootstrap
|
115
|
+
#
|
116
|
+
# install-method=tar:
|
117
|
+
# tar-cmd = /bin/tar --numeric-owner -xvf $src
|
118
|
+
#
|
119
|
+
#
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
#
|
124
|
+
##
|
125
|
+
# Disk and Sizing options.
|
126
|
+
##
|
127
|
+
#
|
128
|
+
size = 4Gb # Disk image size.
|
129
|
+
memory = 256Mb # Memory size
|
130
|
+
swap = 512Mb # Swap size
|
131
|
+
# noswap = 1 # Don't use swap at all for the new system.
|
132
|
+
fs = ext3 # use the EXT3 filesystem for the disk image.
|
133
|
+
dist = hardy # Default distribution to install.
|
134
|
+
image = sparse # Specify sparse vs. full disk images.
|
135
|
+
|
136
|
+
#
|
137
|
+
# Currently supported and tested distributions include:
|
138
|
+
#
|
139
|
+
# via Debootstrap:
|
140
|
+
#
|
141
|
+
# Debian:
|
142
|
+
# sid, sarge, etch, lenny.
|
143
|
+
#
|
144
|
+
# Ubuntu:
|
145
|
+
# edgy, feisty, dapper, gutsy, hardy.
|
146
|
+
#
|
147
|
+
# via Rinse:
|
148
|
+
# centos-4, centos-5.
|
149
|
+
# fedora-core-4, fedora-core-5, fedora-core-6, fedora-core-7
|
150
|
+
#
|
151
|
+
#
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
##
|
156
|
+
# Networking setup values.
|
157
|
+
##
|
158
|
+
|
159
|
+
#
|
160
|
+
# Uncomment and adjust these network settings if you wish to give your
|
161
|
+
# new instances static IP addresses.
|
162
|
+
#
|
163
|
+
gateway = 192.168.1.1
|
164
|
+
netmask = 255.255.255.0
|
165
|
+
broadcast = 192.168.1.255
|
166
|
+
#
|
167
|
+
# Uncomment this if you wish the images to use DHCP
|
168
|
+
#
|
169
|
+
# dhcp = 1
|
170
|
+
|
171
|
+
|
172
|
+
##
|
173
|
+
# Misc options
|
174
|
+
##
|
175
|
+
|
176
|
+
#
|
177
|
+
# Uncomment the following line if you wish to disable the caching
|
178
|
+
# of downloaded .deb files when using debootstrap to install images.
|
179
|
+
#
|
180
|
+
# cache = no
|
181
|
+
#
|
182
|
+
|
183
|
+
#
|
184
|
+
# Uncomment the following line if you wish to interactively setup
|
185
|
+
# a new root password for images.
|
186
|
+
#
|
187
|
+
# passwd = 1
|
188
|
+
|
189
|
+
#
|
190
|
+
# If you'd like all accounts on your host system which are not present
|
191
|
+
# on the guest system to be copied over then uncomment the following line.
|
192
|
+
#
|
193
|
+
# accounts = 1
|
194
|
+
#
|
195
|
+
|
196
|
+
#
|
197
|
+
# Default kernel and ramdisk to use for the virtual servers
|
198
|
+
#
|
199
|
+
kernel = /boot/vmlinuz-`uname -r`
|
200
|
+
initrd = /boot/initrd.img-`uname -r`
|
201
|
+
|
202
|
+
#
|
203
|
+
# The architecture to use when using debootstrap, rinse, or rpmstrap.
|
204
|
+
#
|
205
|
+
# This is most useful on 64 bit host machines, for other systems it
|
206
|
+
# doesn't need to be used.
|
207
|
+
#
|
208
|
+
# arch=[i386|amd64]
|
209
|
+
#
|
210
|
+
|
211
|
+
#
|
212
|
+
# The default mirror for debootstrap to install Debian-derived distributions
|
213
|
+
#
|
214
|
+
mirror = http://ftp.us.debian.org/debian/
|
215
|
+
|
216
|
+
#
|
217
|
+
# A mirror suitable for use when installing the Dapper release of Ubuntu.
|
218
|
+
#
|
219
|
+
mirror = http://archive.ubuntu.com/ubuntu/
|
220
|
+
|
221
|
+
#
|
222
|
+
# If you like you could use per-distribution mirrors, which will
|
223
|
+
# be more useful if you're working in an environment where you want
|
224
|
+
# to regularly use multiple distributions:
|
225
|
+
#
|
226
|
+
# mirror_sid=http://ftp.us.debian.org/debian
|
227
|
+
# mirror_sarge=http://ftp.us.debian.org/debian
|
228
|
+
# mirror_etch=http://ftp.us.debian.org/debian
|
229
|
+
# mirror_dapper=http://archive.ubuntu.com/ubuntu
|
230
|
+
# mirror_edgy=http://archive.ubuntu.com/ubuntu
|
231
|
+
# mirror_feisty=http://archive.ubuntu.com/ubuntu
|
232
|
+
# mirror_gutsy=http://archive.ubuntu.com/ubuntu
|
233
|
+
|
234
|
+
|
235
|
+
#
|
236
|
+
# Filesystem options for the different filesystems we support.
|
237
|
+
#
|
238
|
+
ext3_options = noatime,nodiratime,errors=remount-ro
|
239
|
+
ext2_options = noatime,nodiratime,errors=remount-ro
|
240
|
+
xfs_options = defaults
|
241
|
+
reiser_options = defaults
|
242
|
+
|
243
|
+
#
|
244
|
+
# Uncomment if you wish newly created images to boot once they've been
|
245
|
+
# created.
|
246
|
+
#
|
247
|
+
# boot = 1
|
248
|
+
|
249
|
+
|
250
|
+
#
|
251
|
+
# If you're using the lenny or later version of the Xen guest kernel you will
|
252
|
+
# need to make sure that you use 'hvc0' for the guest serial device,
|
253
|
+
# and 'xvdX' instead of 'sdX' for serial devices.
|
254
|
+
#
|
255
|
+
# You may specify the things to use here:
|
256
|
+
#
|
257
|
+
# serial_device = hvc0 #default
|
258
|
+
# serial_device = tty1
|
259
|
+
#
|
260
|
+
disk_device = xvda #default
|
261
|
+
# disk_device = sda
|
262
|
+
#
|
263
|
+
|
264
|
+
|
265
|
+
#
|
266
|
+
# Here we specify the output directory which the Xen configuration
|
267
|
+
# files will be written to, and the suffix to give them.
|
268
|
+
#
|
269
|
+
# Historically xen-tools have created configuration files in /etc/xen,
|
270
|
+
# and given each file the name $hostname.cfg. If you want to change
|
271
|
+
# that behaviour you may do so here.
|
272
|
+
#
|
273
|
+
#
|
274
|
+
# output = /etc/xen
|
275
|
+
# extension = .cfg
|
276
|
+
#
|