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 | dev=no |
---|
57 | echo |
---|
58 | ask "Will this machine be used to build Debathena packages [y/N]? " n |
---|
59 | if [ y = "$answer" ]; then |
---|
60 | dev=yes |
---|
61 | fi |
---|
62 | |
---|
63 | csoft=no |
---|
64 | echo "The extra-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)." |
---|
67 | echo "" |
---|
68 | ask "Do you want the extra-software package [y/N]? " n |
---|
69 | if [ y = "$answer" ]; then |
---|
70 | csoft=yes |
---|
71 | fi |
---|
72 | |
---|
73 | echo "A summary of your choices:" |
---|
74 | echo " Category: $category" |
---|
75 | echo " Debian development package: $dev" |
---|
76 | echo " Extra-software package: $csoft" |
---|
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 | echo "(This may cause the update manager to claim new upgrades are available." |
---|
97 | echo "Ignore them until this script is complete.)" |
---|
98 | if [ -d /etc/apt/sources.list.d ]; then |
---|
99 | sourceslist=/etc/apt/sources.list.d/debathena.list |
---|
100 | else |
---|
101 | sourceslist=/etc/apt/sources.list |
---|
102 | fi |
---|
103 | |
---|
104 | if [ ! -e "$sourceslist" ] || ! grep -q debathena "$sourceslist"; then |
---|
105 | if [ -e "$sourceslist" ]; then |
---|
106 | echo "" >> $sourceslist |
---|
107 | fi |
---|
108 | echo "deb http://athena10.mit.edu/apt $distro debathena debathena-config debathena-system openafs" >> $sourceslist |
---|
109 | echo "deb-src http://athena10.mit.edu/apt $distro debathena debathena-config debathena-system openafs" >> $sourceslist |
---|
110 | fi |
---|
111 | |
---|
112 | if [ "$ubuntu" = "yes" ]; then |
---|
113 | output "Making sure the universe repository is enabled" |
---|
114 | sed -i 's,^# \(deb\(\-src\)* http://archive.ubuntu.com/ubuntu [[:alnum:]]* universe\)$,\1,' /etc/apt/sources.list |
---|
115 | fi |
---|
116 | |
---|
117 | output "Downloading the Debathena archive key" |
---|
118 | if ! wget http://athena10.mit.edu/apt/athena10-archive.asc ; then |
---|
119 | echo "Download failed; terminating." |
---|
120 | exit 1 |
---|
121 | fi |
---|
122 | echo "36e6d6a2c13443ec0e7361b742c7fa7843a56a0b ./athena10-archive.asc" | \ |
---|
123 | sha1sum -c |
---|
124 | apt-key add athena10-archive.asc |
---|
125 | rm ./athena10-archive.asc |
---|
126 | |
---|
127 | apt-get update |
---|
128 | |
---|
129 | modules_want=$(dpkg-query -W -f '${Source}\t${Package}\n' 'linux-image-*' | \ |
---|
130 | sed -nre 's/^linux-(meta|latest[^\t]*)\tlinux-image-(.*)$/openafs-modules-\2/p') |
---|
131 | modules= |
---|
132 | for m in $modules_want; do |
---|
133 | aptitude show $m > /dev/null && modules="$modules $m" |
---|
134 | done |
---|
135 | |
---|
136 | if [ -z "$modules" ]; then |
---|
137 | error "An OpenAFS modules metapackage for your kernel is not available." |
---|
138 | fi |
---|
139 | |
---|
140 | output "Installing OpenAFS kernel metapackage" |
---|
141 | apt-get -y install $modules |
---|
142 | |
---|
143 | # Use the noninteractive frontend to install the main package. This |
---|
144 | # is so that AFS and Zephyr don't ask questions of the user which |
---|
145 | # debathena packages will later stomp on anyway. |
---|
146 | output "Installing main Athena 10 metapackage $mainpackage" |
---|
147 | DEBIAN_FRONTEND=noninteractive aptitude -y install "$mainpackage" |
---|
148 | |
---|
149 | # This package is relatively small so it's not as important, but allow |
---|
150 | # critical questions to be asked. |
---|
151 | if [ yes = "$dev" ]; then |
---|
152 | output "Installing debathena-build-depends" |
---|
153 | DEBIAN_PRIORITY=critical aptitude -y install debathena-build-depends |
---|
154 | fi |
---|
155 | |
---|
156 | # Use the default front end and allow questions to be asked; otherwise |
---|
157 | # Java will fail to install since it has to present its license. |
---|
158 | if [ yes = "$csoft" ]; then |
---|
159 | output "Installing debathena-extra-software" |
---|
160 | DEBIAN_PRIORITY=critical aptitude -y install debathena-extra-software |
---|
161 | fi |
---|