| 1 | #!/bin/sh | 
|---|
| 2 | # Invirt install script. | 
|---|
| 3 | # Cribbed from install-debathena.sh. | 
|---|
| 4 | set -e | 
|---|
| 5 |  | 
|---|
| 6 | output() { | 
|---|
| 7 | printf '\033[38m'; echo "$@"; printf '\033[0m' | 
|---|
| 8 | } | 
|---|
| 9 |  | 
|---|
| 10 | error() { | 
|---|
| 11 | ret=`shift` | 
|---|
| 12 | printf '\033[31m'; echo "$@"; printf '\033[0m' | 
|---|
| 13 | exit $ret | 
|---|
| 14 | } | 
|---|
| 15 |  | 
|---|
| 16 | if [ `id -u` != "0" ]; then | 
|---|
| 17 | error 1 "You must run the Invirt installer as root." | 
|---|
| 18 | fi | 
|---|
| 19 |  | 
|---|
| 20 | output "Installing the dependencies for the Invirt installer..." | 
|---|
| 21 | aptitude install lsb-release wget | 
|---|
| 22 | DISTRO=`lsb_release -cs` | 
|---|
| 23 | case $DISTRO in | 
|---|
| 24 | hardy) | 
|---|
| 25 | ;; | 
|---|
| 26 | *) | 
|---|
| 27 | error 1 'Invirt only supports Ubuntu hardy right now, sorry.' | 
|---|
| 28 | ;; | 
|---|
| 29 | esac | 
|---|
| 30 |  | 
|---|
| 31 | output "Adding repositories to the apt sources..." | 
|---|
| 32 | ( | 
|---|
| 33 | echo debathena http://debathena.mit.edu/apt $DISTRO debathena debathena-config openafs | 
|---|
| 34 | echo invirt http://xvm.mit.edu/invirt stable main | 
|---|
| 35 | ) | while read name line; do | 
|---|
| 36 | sourceslist="/etc/apt/sources.list.d/$name.list" | 
|---|
| 37 | if [ -e $sourceslist ]; then | 
|---|
| 38 | continue | 
|---|
| 39 | fi | 
|---|
| 40 | echo "deb     $line" >> "$sourceslist" | 
|---|
| 41 | echo "deb-src $line" >> "$sourceslist" | 
|---|
| 42 | done | 
|---|
| 43 |  | 
|---|
| 44 | # if [ "$UBUNTU" = "yes" ]; then | 
|---|
| 45 | #     output "Making sure the universe repository is enabled" | 
|---|
| 46 | #     sed -i 's,^# \(deb\(\-src\)* http://archive.ubuntu.com/ubuntu [[:alnum:]]* universe\)$,\1,' /etc/apt/sources.list | 
|---|
| 47 | # fi | 
|---|
| 48 |  | 
|---|
| 49 | output "Downloading archive keys..." | 
|---|
| 50 | ( | 
|---|
| 51 | echo http://debathena.mit.edu/apt/debathena-archive.asc a96663dcee0f303afcadca3105eae6bf7c7e698a | 
|---|
| 52 | echo http://xvm.mit.edu/invirt/invirt-archive.asc fc5d50e7507a871b45dde55a77448edb0e22c184 | 
|---|
| 53 | ) | while read uri sha1; do | 
|---|
| 54 | f=$(mktemp archive.asc.XXXX) | 
|---|
| 55 | wget -O $f $uri | 
|---|
| 56 | echo "$sha1  $f" | sha1sum -c | 
|---|
| 57 | apt-key add $f | 
|---|
| 58 | rm $f | 
|---|
| 59 | done | 
|---|
| 60 |  | 
|---|
| 61 | aptitude update | 
|---|
| 62 |  | 
|---|
| 63 | #output "Installing Invirt..." | 
|---|
| 64 | #DEBIAN_FRONTEND=noninteractive aptitude install invirt-host-master | 
|---|
| 65 |  | 
|---|
| 66 | output "Invirt installation done!" | 
|---|
| 67 | output "" | 
|---|
| 68 | output "You probably want to ask invirt@mit.edu what to do next, if you're" | 
|---|
| 69 | output "not yourself one of the people who would answer that question." | 
|---|
| 70 | output "We're still working on documentation." | 
|---|