Revision 85b69adb util/install.sh

View differences:

util/install.sh
17 17
#KERNEL_NAME=`uname -r`
18 18
KERNEL_HEADERS=linux-headers-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
19 19
KERNEL_IMAGE=linux-image-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
20
DIST=UBUNTU  # Assume Ubuntu, not debian Lenny
20
DIST=`lsb_release -is`
21 21

  
22 22
# Kernel Deb pkg to be removed:
23 23
KERNEL_IMAGE_OLD=linux-image-2.6.26-2-686
24 24

  
25
DRIVERS_DIR=/lib/modules/${KERNEL_NAME}/kernel/drivers
25
DRIVERS_DIR=/lib/modules/${KERNEL_NAME}/kernel/drivers/net
26 26

  
27 27
#OVS_RELEASE=openvswitch-1.0.1
28 28
OVS_RELEASE=openvswitch # release 1.0.1 doesn't work with veth pairs.
......
33 33
	echo "Install new kernel..."
34 34
	sudo apt-get update
35 35

  
36
    # Until we build ext4 into our kernel image
37
    ext2=`mount | head -1 | egrep 'ext2|ext3'`
38
    if [ "$ext2" == "" ]; then
39
        echo "Kernel package requires ext2 or ext3 root filesystem"
40
        exit 1
41
    fi
42
    
36 43
	# The easy approach: download pre-built linux-image and linux-headers packages:
37 44
	wget -c $KERNEL_LOC/$KERNEL_HEADERS
38 45
	wget -c $KERNEL_LOC/$KERNEL_IMAGE
......
118 125
function ovs {
119 126
	echo "Installing OpenVSwitch..."
120 127

  
121
    if [ "$DIST" = "LENNY" ]; then
122
	#Install Autoconf 2.63+ backport from Debian Backports repo:
123
	#Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
124
	sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
125
	sudo apt-get update
126
	sudo apt-get -y --force-yes install debian-backports-keyring
127
	sudo apt-get -y --force-yes -t lenny-backports install autoconf
128
    if [ "$DIST" = "Debian" ]; then
129
        #Install Autoconf 2.63+ backport from Debian Backports repo:
130
        #Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
131
        sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
132
        sudo apt-get update
133
        sudo apt-get -y --force-yes install debian-backports-keyring
134
        sudo apt-get -y --force-yes -t lenny-backports install autoconf
128 135
    fi
129 136

  
130 137
	#Install OVS from release
......
149 156

  
150 157
	#Install NOX deps:
151 158
	sudo apt-get -y install autoconf automake g++ libtool python python-twisted swig  libxerces-c2-dev libssl-dev make
152
    if [ "$DIST" == "LENNY" ]; then
159
    if [ "$DIST" == "Debian" ]; then
153 160
        sudo apt-get -y install libboost1.35-dev
154
    else
155
        sudo apt-get -y install libboost1.40-dev
161
    elif [ "$DIST" == "Ubuntu" ]; then
162
        sudo apt-get -y install python-dev libboost-dev 
163
        sudo apt-get -y install libboost-filesystem-dev
164
        sudo apt-get -y install libboost-test-dev
156 165
    fi
157 166
	#Install NOX optional deps:
158 167
	sudo apt-get install -y libsqlite3-dev python-simplejson
......
164 173

  
165 174
	# With later autoconf versions this doesn't quite work:
166 175
	./boot.sh --apps-core || true
167
	# So use this instead:
168
	autoreconf --install --force
176
    if [ "$DIST" == "Debian" ]; then
177
        # So use this instead:
178
        autoreconf --install --force
179
    fi
169 180
	mkdir build
170 181
	cd build
171 182
	../configure --with-python=yes
172
	make
183
    make
173 184
	#make check
174 185

  
175 186
	# Add NOX_CORE_DIR env var:
......
275 286

  
276 287
	# Remove sensistive files
277 288
	history -c
278
	rm ~/.bash_history # history -c doesn't seem to work for some reason
289
	rm ~/.bash_history # need to clear in memory and remove on disk
279 290
	rm -f ~/.ssh/id_rsa* ~/.ssh/known_hosts
280 291
	sudo rm ~/.ssh/authorized_keys2
281 292

  
......
295 306

  
296 307
function usage {
297 308
    printf "Usage: %s: [-acdfhkmntvxy] args\n" $(basename $0) >&2
309
    
310
    printf "This install script attempts to install useful packages\n" >&2
311
    printf "for Mininet. It should (hopefully) work on Ubuntu 10.04 and\n" >&2
312
    printf "Debian 5.0 (Lenny). If you run into trouble, try\n" >&2
313
    printf "installing one thing at a time, and looking at the \n" >&2
314
    printf "specific installation function in this script.\n" >&2
315
        
316
    printf "\noptions:\n" >&2
317
    printf "-a: install (A)ll packages - good luck!\n" >&2
318
    printf "-c: (C)lean up after kernel install\n" >&2
319
    printf "-d: (D)elete some sensitive files from a VM image\n" >&2    
320
    printf "-f: install open(F)low\n" >&2
321
    printf "-h: print this (H)elp message\n" >&2
322
    printf "-k: install new (K)ernel\n" >&2
323
    printf "-m: install Open vSwitch kernel (M)odule\n" >&2
324
    printf "-n: install mini(N)et dependencies\nn" >&2
325
    printf "-t: install o(T)her stuff\n" >&2
326
    printf "-v: install open (V)switch\n" >&2
327
    printf "-x: install NOX(X) OpenFlow contoller\n" >&2
328
    printf "-y: install (A)ll packages\n" >&2    
329
    
298 330
    exit 2
299 331
}
300 332

  
......
307 339
then
308 340
	all
309 341
else
310
	while getopts 'lacdfhkmntvx' OPTION
342
	while getopts 'acdfhkmntvx' OPTION
311 343
	do
312 344
	  case $OPTION in
313
      l)    lenny;;
314 345
      a)    all;;
315 346
	  c)    kernel_clean;;
316 347
	  d)    vm_clean;;

Also available in: Unified diff