1 | #!/bin/sh |
---|
2 | # Athena 10 placeholder install script. |
---|
3 | # Maintainer: Greg Hudson <ghudson@mit.edu> |
---|
4 | # Based on Debathena installer script by: Tim Abbott <tabbott@mit.edu> |
---|
5 | |
---|
6 | # Download this to an Ubuntu machine and run it as root. It can |
---|
7 | # be downloaded with: |
---|
8 | # wget http://athena10.mit.edu/install-athena10.sh |
---|
9 | |
---|
10 | set -e |
---|
11 | |
---|
12 | output() { |
---|
13 | printf '\033[38m'; echo "$@"; printf '\033[0m' |
---|
14 | } |
---|
15 | |
---|
16 | error() { |
---|
17 | printf '\033[31m'; echo "$@"; printf '\033[0m' |
---|
18 | exit 1 |
---|
19 | } |
---|
20 | |
---|
21 | ask() { |
---|
22 | answer='' |
---|
23 | while [ y != "$answer" -a n != "$answer" ]; do |
---|
24 | printf '\033[38m'; echo -n "$1"; printf '\033[0m' |
---|
25 | read answer |
---|
26 | [ Y = answer ] && answer=y |
---|
27 | [ N = answer ] && answer=n |
---|
28 | [ -z "$answer" ] && answer=$2 |
---|
29 | done |
---|
30 | output "" |
---|
31 | } |
---|
32 | |
---|
33 | if [ `id -u` != "0" ]; then |
---|
34 | error "You must run the Athena 10 installer as root." |
---|
35 | fi |
---|
36 | |
---|
37 | echo "Welcome to the Athena 10 install script." |
---|
38 | echo "" |
---|
39 | echo "Please choose the category which bets suits your needs. Each category" |
---|
40 | echo "in this list includes the functionality of the previous ones. See the" |
---|
41 | echo "documentation at http://athena10.mit.edu for more information." |
---|
42 | echo "" |
---|
43 | echo " standard: Athena client software (e.g. discuss) and customizations" |
---|
44 | echo " login: Allow Athena users to log into your machine" |
---|
45 | echo " workstation: Athena graphical login customizations" |
---|
46 | echo "" |
---|
47 | |
---|
48 | category="" |
---|
49 | while [ standard != "$category" -a login != "$category" -a \ |
---|
50 | workstation != "$category" ]; do |
---|
51 | output -n "Please choose a category or press control-C to abort: " |
---|
52 | read category |
---|
53 | done |
---|
54 | mainpackage=debathena-$category |
---|
55 | |
---|
56 | additional= |
---|
57 | |
---|
58 | echo |
---|
59 | ask "Will this machine be used for Athena 10 development [y/N]? " n |
---|
60 | if [ y = "$answer" ]; then |
---|
61 | additional="$additional debathena-debian-dev" |
---|
62 | fi |
---|
63 | |
---|
64 | echo "The cluster-software package installs a standard set of software" |
---|
65 | echo "determined to be of interest to MIT users, such as LaTeX. It is pretty" |
---|
66 | echo "big (several gigabytes, possibly more). It does not turn your machine" |
---|
67 | echo "into a cluster machine; it is only a standard software set." |
---|
68 | echo "" |
---|
69 | ask "Do you want the cluster-software package [y/N]? " n |
---|
70 | if [ y = "$answer" ]; then |
---|
71 | additional="$additional debathena-cluster-software" |
---|
72 | fi |
---|
73 | |
---|
74 | echo "A summary of your choices:" |
---|
75 | echo " Main package: $mainpackage" |
---|
76 | echo " Additional packages:$additional" |
---|
77 | echo "" |
---|
78 | output "Press return to begin or control-C to abort" |
---|
79 | read dummy |
---|
80 | |
---|
81 | output "Installing lsb-release to determine system type" |
---|
82 | aptitude -y install lsb-release |
---|
83 | distro=`lsb_release -cs` |
---|
84 | case $distro in |
---|
85 | etch|lenny) |
---|
86 | ;; |
---|
87 | dapper|edgy|feisty|gutsy|hardy) |
---|
88 | ubuntu=yes |
---|
89 | ;; |
---|
90 | *) |
---|
91 | error "Your machine seems to not be running a current Debian/Ubuntu release." |
---|
92 | ;; |
---|
93 | esac |
---|
94 | |
---|
95 | output "Adding the Athena 10 repository to the apt sources" |
---|
96 | if [ -d /etc/apt/sources.list.d ]; then |
---|
97 | sourceslist=/etc/apt/sources.list.d/debathena.list |
---|
98 | else |
---|
99 | sourceslist=/etc/apt/sources.list |
---|
100 | fi |
---|
101 | |
---|
102 | if [ ! -e "$sourceslist" ] || ! grep -q debathena "$sourceslist"; then |
---|
103 | if [ -e "$sourceslist" ]; then |
---|
104 | echo "" >> $sourceslist |
---|
105 | fi |
---|
106 | echo "deb http://athena10.mit.edu/apt $distro debathena debathena-config debathena-system openafs" >> $sourceslist |
---|
107 | echo "deb-src http://athena10.mit.edu/apt $distro debathena debathena-config debathena-system openafs" >> $sourceslist |
---|
108 | fi |
---|
109 | |
---|
110 | if [ "$ubuntu" = "yes" ]; then |
---|
111 | output "Making sure the universe repository is enabled" |
---|
112 | sed -i 's,^# \(deb\(\-src\)* http://archive.ubuntu.com/ubuntu [[:alnum:]]* universe\)$,\1,' /etc/apt/sources.list |
---|
113 | fi |
---|
114 | |
---|
115 | output "Downloading the Debathena archive key" |
---|
116 | if ! wget http://athena10.mit.edu/apt/athena10-archive.asc ; then |
---|
117 | echo "Download failed; terminating." |
---|
118 | exit 1 |
---|
119 | fi |
---|
120 | echo "36e6d6a2c13443ec0e7361b742c7fa7843a56a0b ./athena10-archive.asc" | \ |
---|
121 | sha1sum -c |
---|
122 | apt-key add athena10-archive.asc |
---|
123 | rm ./athena10-archive.asc |
---|
124 | |
---|
125 | apt-get update |
---|
126 | |
---|
127 | modules_want=$(dpkg-query -W -f '${Source}\t${Package}\n' 'linux-image-*' | \ |
---|
128 | sed -nre 's/^linux-(meta|latest[^\t]*)\tlinux-image-(.*)$/openafs-modules-\2/p') |
---|
129 | modules= |
---|
130 | for m in $modules_want; do |
---|
131 | aptitude show $m > /dev/null && modules="$modules $m" |
---|
132 | done |
---|
133 | |
---|
134 | if [ -z "$modules" ]; then |
---|
135 | error "An OpenAFS modules metapackage for your kernel is not available." |
---|
136 | fi |
---|
137 | |
---|
138 | output "Installing OpenAFS kernel metapackage" |
---|
139 | apt-get -y install $modules |
---|
140 | |
---|
141 | output "Installing Athena 10 packages" |
---|
142 | DEBIAN_FRONTEND=noninteractive aptitude -y install "$mainpackage" $additional |
---|