Add pre-install scripts
These scripts transform vanilla Ubuntu 12.04 to deploy-ready snapshot Change-Id: I8deb909682ced7505687313b7665467d1c8f7c51
This commit is contained in:
parent
daaa33c275
commit
eefd613e66
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Install Open vSwitch. This file is translated from
|
||||||
|
## cookbook/openvswitch/recipes/default.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
sudo apt-get -y install build-essential \
|
||||||
|
git \
|
||||||
|
autoconf \
|
||||||
|
python-simplejson \
|
||||||
|
python-qt4 \
|
||||||
|
python-twisted-conch \
|
||||||
|
uml-utilities \
|
||||||
|
libtool \
|
||||||
|
pkg-config
|
||||||
|
|
||||||
|
sudo mkdir -p /opt/openvswitch
|
||||||
|
sudo chmod 00755 /opt/openvswitch
|
||||||
|
sudo chown root:root /opt/openvswitch
|
||||||
|
|
||||||
|
sudo mkdir -p /etc/openvswitch
|
||||||
|
sudo chmod 00755 /etc/openvswitch
|
||||||
|
sudo chown root:root /opt/openvswitch
|
||||||
|
|
||||||
|
sudo chmod a+w /opt/openvswitch
|
||||||
|
cd /opt/openvswitch
|
||||||
|
git clone git://openvswitch.org/openvswitch
|
||||||
|
cd openvswitch
|
||||||
|
git checkout 3b6f2889400fd340b851c2d36356457559ae6e81
|
||||||
|
./boot.sh
|
||||||
|
./configure --with-linux=/lib/modules/`uname -r`/build \
|
||||||
|
--prefix=/usr --localstatedir=/var # default to these libraries
|
||||||
|
make -j
|
||||||
|
sudo make install
|
||||||
|
sudo ovsdb-tool create /etc/openvswitch/conf.db \
|
||||||
|
vswitchd/vswitch.ovsschema
|
||||||
|
|
||||||
|
echo "start on (filesystem and net-device-up)
|
||||||
|
stop on runlevel [016]
|
||||||
|
|
||||||
|
# Automatically restart process if crashed
|
||||||
|
respawn
|
||||||
|
|
||||||
|
# Essentially lets upstart know the process will detach itself to the background
|
||||||
|
expect fork
|
||||||
|
|
||||||
|
pre-start script
|
||||||
|
/sbin/insmod /opt/openvswitch/openvswitch/datapath/linux/openvswitch.ko
|
||||||
|
mkdir -p /var/run/openvswitch/
|
||||||
|
end script
|
||||||
|
|
||||||
|
script
|
||||||
|
exec /usr/sbin/ovsdb-server /etc/openvswitch/conf.db \\
|
||||||
|
--remote=punix:/var/run/openvswitch/db.sock \\
|
||||||
|
--remote=db:Open_vSwitch,manager_options \\
|
||||||
|
--private-key=db:SSL,private_key \\
|
||||||
|
--certificate=db:SSL,certificate \\
|
||||||
|
--bootstrap-ca-cert=db:SSL,ca_cert --pidfile --detach --log-file
|
||||||
|
end script
|
||||||
|
|
||||||
|
# seems main script only allows one daemon, so we move another
|
||||||
|
# daemon(s) to post-start and pre-stop
|
||||||
|
post-start script
|
||||||
|
exec /usr/sbin/ovs-vswitchd --pidfile --detach
|
||||||
|
end script
|
||||||
|
|
||||||
|
pre-stop script
|
||||||
|
exec killall -9 ovs-vswitchd
|
||||||
|
end script
|
||||||
|
|
||||||
|
post-stop script
|
||||||
|
/sbin/rmmod openvswitch
|
||||||
|
end script
|
||||||
|
" | sudo tee /etc/init/openvswitch.conf
|
||||||
|
sudo chmod 00755 /etc/init/openvswitch.conf
|
||||||
|
sudo chown root:root /opt/openvswitch
|
||||||
|
sudo service openvswitch start
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Switch kernel from virtual to generic, for vanilla Ubuntu 12.04
|
||||||
|
## image launched instance.
|
||||||
|
|
||||||
|
# routine
|
||||||
|
sudo apt-get -y update
|
||||||
|
sudo apt-get -y upgrade
|
||||||
|
|
||||||
|
# install generic and reomve virtual kernel
|
||||||
|
sudo apt-get -y install linux-generic
|
||||||
|
sudo apt-get -y purge linux-virtual
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
sudo apt-get -y autoremove
|
||||||
|
sudo apt-get -y autoclean
|
||||||
|
|
||||||
|
# reboot
|
||||||
|
sudo reboot
|
Loading…
Reference in New Issue