[23093] | 1 | #!/bin/sh |
---|
[23946] | 2 | # Athena installer script. |
---|
[23476] | 3 | # Maintainer: debathena@mit.edu |
---|
[23492] | 4 | # Based on original Debathena installer script by: Tim Abbott <tabbott@mit.edu> |
---|
[23093] | 5 | |
---|
[23492] | 6 | # Download this to a Debian or Ubuntu machine and run it as root. It can |
---|
[23093] | 7 | # be downloaded with: |
---|
[23831] | 8 | # wget -N http://debathena.mit.edu/install-debathena.sh |
---|
[23093] | 9 | |
---|
| 10 | set -e |
---|
| 11 | |
---|
[25608] | 12 | # The user's umask will sometimes carry over; don't let that happen. |
---|
| 13 | umask 022 |
---|
| 14 | |
---|
[23093] | 15 | output() { |
---|
| 16 | printf '\033[38m'; echo "$@"; printf '\033[0m' |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | error() { |
---|
| 20 | printf '\033[31m'; echo "$@"; printf '\033[0m' |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | ask() { |
---|
| 24 | answer='' |
---|
| 25 | while [ y != "$answer" -a n != "$answer" ]; do |
---|
| 26 | printf '\033[38m'; echo -n "$1"; printf '\033[0m' |
---|
| 27 | read answer |
---|
[24912] | 28 | [ Y = "$answer" ] && answer=y |
---|
| 29 | [ N = "$answer" ] && answer=n |
---|
[23093] | 30 | [ -z "$answer" ] && answer=$2 |
---|
| 31 | done |
---|
| 32 | output "" |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | if [ `id -u` != "0" ]; then |
---|
[23492] | 36 | error "You must run the Debathena installer as root." |
---|
[24010] | 37 | if [ -x /usr/bin/sudo ]; then |
---|
[24009] | 38 | error "Try running 'sudo $0'." |
---|
| 39 | fi |
---|
[23492] | 40 | exit 1 |
---|
[23093] | 41 | fi |
---|
| 42 | |
---|
[25492] | 43 | pxetype= |
---|
| 44 | if test -f /root/pxe-install-flag ; then |
---|
| 45 | pxetype=`head -1 /root/pxe-install-flag` |
---|
| 46 | fi |
---|
| 47 | |
---|
[25346] | 48 | have_lsbrelease="$(dpkg-query -W -f '${Status}' lsb-release 2>/dev/null)" |
---|
| 49 | if [ "$have_lsbrelease" != "install ok installed" ]; then |
---|
| 50 | echo "The installer requires the 'lsb-release' package to determine" |
---|
| 51 | echo "whether or not installation can proceed." |
---|
| 52 | ask "Is it ok to install this package now? [Y/n] " y |
---|
| 53 | if [ y = "$answer" ]; then |
---|
| 54 | if ! apt-get -qq update && apt-get -qqy install lsb-release; then |
---|
| 55 | error "Could not install lsb-release. Try installing it manually." |
---|
| 56 | exit 1 |
---|
| 57 | fi |
---|
| 58 | else |
---|
| 59 | error "Sorry, lsb-release is required. Cannot continue." |
---|
| 60 | exit 1 |
---|
| 61 | fi |
---|
| 62 | fi |
---|
| 63 | distro=`lsb_release -cs` |
---|
[25722] | 64 | aptitude=aptitude |
---|
[25346] | 65 | case $distro in |
---|
[25464] | 66 | squeeze) |
---|
[25346] | 67 | ;; |
---|
[25958] | 68 | lucid) |
---|
[25346] | 69 | ubuntu=yes |
---|
| 70 | ;; |
---|
[25958] | 71 | precise|quantal|raring) |
---|
[25722] | 72 | ubuntu=yes |
---|
| 73 | aptitude=apt-get |
---|
| 74 | ;; |
---|
[25958] | 75 | saucy) |
---|
[25485] | 76 | ubuntu=yes |
---|
[25722] | 77 | aptitude=apt-get |
---|
[25824] | 78 | output "The release you are running ($distro) is not yet supported" |
---|
| 79 | output "and installing Debathena on it is probably a bad idea," |
---|
| 80 | output "particularly for any purpose other than beta testing." |
---|
| 81 | output "" |
---|
| 82 | output "(New releases are generally supported a couple of weeks" |
---|
| 83 | output "after the official release date. We strongly encourage you" |
---|
| 84 | output "to check http://debathena.mit.edu for support information" |
---|
| 85 | output "and try again later, or install the previous version of" |
---|
| 86 | output "the operating system.)" |
---|
[25492] | 87 | if ! test -f /root/pxe-install-flag; then |
---|
| 88 | ask "Are you sure you want to proceed? [y/N] " n |
---|
| 89 | [ y != "$answer" ] && exit 1 |
---|
[25485] | 90 | fi |
---|
| 91 | ;; |
---|
[25958] | 92 | lenny|hardy|intrepid|jaunty|karmic|maverick|natty|oneiric) |
---|
[25652] | 93 | error "The release you are running ($distro) is no longer supported." |
---|
[25485] | 94 | error "Generally, Debathena de-supports releases when they are no longer" |
---|
| 95 | error "supported by upstream. If you believe you received this message" |
---|
| 96 | error "in error, please contact debathena@mit.edu." |
---|
| 97 | exit 1 |
---|
| 98 | ;; |
---|
[25346] | 99 | *) |
---|
| 100 | error "Unsupported release codename: $distro" |
---|
| 101 | error "Sorry, Debathena does not support installation on this release at this time." |
---|
| 102 | error "(New releases may not be supported immediately after their release)." |
---|
| 103 | error "If you believe you are running a supported release or have questions," |
---|
| 104 | error "please contact debathena@mit.edu" |
---|
| 105 | exit 1 |
---|
| 106 | ;; |
---|
| 107 | esac |
---|
| 108 | |
---|
[25371] | 109 | laptop=no |
---|
| 110 | wifi=no |
---|
| 111 | if [ -x /usr/sbin/laptop-detect ] && /usr/sbin/laptop-detect 2>/dev/null; then |
---|
| 112 | laptop=yes |
---|
| 113 | fi |
---|
| 114 | |
---|
| 115 | if [ -x /usr/bin/nmcli ] && /usr/bin/nmcli dev status 2>/dev/null | awk '{print $2}' | grep -q 802-11-wireless; then |
---|
| 116 | wifi=yes |
---|
| 117 | fi |
---|
| 118 | |
---|
[23492] | 119 | echo "Welcome to the Debathena installer." |
---|
[23093] | 120 | echo "" |
---|
[23604] | 121 | echo "Please choose the category which best suits your needs. Each category" |
---|
[23093] | 122 | echo "in this list includes the functionality of the previous ones. See the" |
---|
[23957] | 123 | echo "documentation at http://debathena.mit.edu for more information." |
---|
[23093] | 124 | echo "" |
---|
[23967] | 125 | echo " standard: Athena client software and customizations" |
---|
| 126 | echo " Recommended for laptops and single-user computers." |
---|
| 127 | echo " login: Allow Athena accounts to log into your machine" |
---|
| 128 | echo " Recommended for private remote-access servers." |
---|
[23678] | 129 | echo " login-graphical: Athena graphical login customizations" |
---|
[23967] | 130 | echo " Recommended for private multi-user desktops." |
---|
| 131 | echo " workstation: Graphical workstation with automatic updates" |
---|
[23969] | 132 | echo " Recommended for auto-managed cluster-like systems." |
---|
[23093] | 133 | echo "" |
---|
| 134 | |
---|
[25371] | 135 | if [ "$laptop" = "yes" ] || [ "$wifi" = "yes" ]; then |
---|
| 136 | cat <<EOF |
---|
| 137 | This machine appears to be a laptop or has at least one wireless |
---|
| 138 | network device. You probably want to choose "standard" unless this |
---|
| 139 | device will have an uninterrupted network connection. |
---|
| 140 | EOF |
---|
| 141 | fi |
---|
| 142 | |
---|
[23476] | 143 | category="" |
---|
[25492] | 144 | if [ cluster = "$pxetype" ] ; then |
---|
| 145 | category=cluster ; |
---|
| 146 | echo "PXE cluster install detected, so installing \"cluster\"." |
---|
[23476] | 147 | fi |
---|
[23135] | 148 | while [ standard != "$category" -a login != "$category" -a \ |
---|
[23797] | 149 | login-graphical != "$category" -a workstation != "$category" -a \ |
---|
| 150 | cluster != "$category" ]; do |
---|
[23093] | 151 | output -n "Please choose a category or press control-C to abort: " |
---|
| 152 | read category |
---|
| 153 | done |
---|
[25831] | 154 | |
---|
[25883] | 155 | # We need noninteractive for PXE installs because you're not supposed |
---|
| 156 | # to be interactive in a late_command, and nothing works (like |
---|
| 157 | # debconf, for example). Until #702 is fixed. |
---|
| 158 | if [ cluster = "$category" ] || test -f /root/pxe-install-flag; then |
---|
[25748] | 159 | # We still want these set for cluster installs, which should be truly |
---|
| 160 | # noninteractive |
---|
| 161 | export DEBCONF_NONINTERACTIVE_SEEN=true |
---|
| 162 | export DEBIAN_FRONTEND=noninteractive |
---|
| 163 | fi |
---|
| 164 | |
---|
[23093] | 165 | mainpackage=debathena-$category |
---|
| 166 | |
---|
[23187] | 167 | csoft=no |
---|
[23460] | 168 | tsoft=no |
---|
[24786] | 169 | resolvconfhack=no |
---|
[23247] | 170 | echo "The extra-software package installs a standard set of software" |
---|
[23093] | 171 | echo "determined to be of interest to MIT users, such as LaTeX. It is pretty" |
---|
[23247] | 172 | echo "big (several gigabytes, possibly more)." |
---|
[23093] | 173 | echo "" |
---|
[24937] | 174 | echo "Note: This package may include software with additional license terms." |
---|
| 175 | echo " By installing it, you are agreeing to the terms of these licenses." |
---|
| 176 | echo " For more information, please see http://debathena.mit.edu/licensing" |
---|
[23872] | 177 | echo "" |
---|
[24358] | 178 | if [ cluster = $category -o workstation = $category ] ; then |
---|
[24786] | 179 | # See Trac #648 and LP:471975 |
---|
| 180 | resolvconfhack=yes |
---|
[24358] | 181 | echo "The extra-software package is required for '$category' and will be installed." |
---|
[23187] | 182 | csoft=yes |
---|
[23469] | 183 | # Not setting tsoft=yes here; -cluster will pull it in anyway. |
---|
[23460] | 184 | else |
---|
| 185 | ask "Do you want the extra-software package [y/N]? " n |
---|
| 186 | if [ y = "$answer" ]; then |
---|
| 187 | csoft=yes |
---|
[23492] | 188 | fi |
---|
[23093] | 189 | fi |
---|
[23876] | 190 | if [ yes = "$csoft" ]; then |
---|
[23872] | 191 | # Preseed an answer to the java license query, which license was already accepted |
---|
| 192 | # at install time: |
---|
| 193 | echo "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true" |debconf-set-selections |
---|
| 194 | fi |
---|
[23093] | 195 | |
---|
[25635] | 196 | if [ "$(cat /sys/class/dmi/id/product_name)" = "OptiPlex 790" ] && \ |
---|
[25656] | 197 | dpkg --compare-versions "$(uname -r)" lt 3.2~; then |
---|
[25333] | 198 | noacpi=y |
---|
| 199 | if [ "$category" != "cluster" ]; then |
---|
[25337] | 200 | echo |
---|
[25333] | 201 | echo "The Dell 790 sometimes has problems rebooting. The best way to" |
---|
[25345] | 202 | echo "work around this is to pass 'reboot=pci' at boot time." |
---|
| 203 | echo "This change will be made in your GRUB (bootloader) configuration." |
---|
[25333] | 204 | ask "Is it ok to do this now? [Y/n] " y |
---|
| 205 | if [ y != "$answer" ]; then |
---|
| 206 | noacpi=n |
---|
| 207 | fi |
---|
| 208 | fi |
---|
[25339] | 209 | if [ "$noacpi" = "y" ] && ! grep -q "Added by install-debathena.sh to address reboot issues on the Dell 790" /etc/default/grub; then |
---|
[25337] | 210 | cat >> /etc/default/grub << 'EOF' |
---|
| 211 | |
---|
| 212 | # Added by install-debathena.sh to address reboot issues on the Dell 790 |
---|
[25340] | 213 | GRUB_CMDLINE_LINUX="reboot=pci $GRUB_CMDLINE_LINUX" |
---|
[25337] | 214 | EOF |
---|
| 215 | update-grub |
---|
[25333] | 216 | fi |
---|
| 217 | fi |
---|
| 218 | |
---|
[23093] | 219 | echo "A summary of your choices:" |
---|
[23187] | 220 | echo " Category: $category" |
---|
[23247] | 221 | echo " Extra-software package: $csoft" |
---|
[23460] | 222 | echo " Third-party software package: $tsoft" |
---|
[23093] | 223 | echo "" |
---|
[25150] | 224 | if [ "$pxetype" = "cluster" ] ; then |
---|
| 225 | if wget -q http://athena10.mit.edu/installer/installing.txt; then |
---|
| 226 | cat installing.txt > /dev/tty6 |
---|
[25245] | 227 | date > /dev/tty6 |
---|
[25150] | 228 | chvt 6 |
---|
[25662] | 229 | rm installing.txt |
---|
[25150] | 230 | fi |
---|
[24903] | 231 | # Divert the default background and install our own so that failed machines |
---|
| 232 | # are more conspicuous |
---|
| 233 | echo "Diverting default background..." |
---|
| 234 | bgimage=/usr/share/backgrounds/warty-final-ubuntu.png |
---|
| 235 | divertedbg=no |
---|
| 236 | if dpkg-divert --divert ${bgimage}.debathena --rename $bgimage; then |
---|
| 237 | divertedbg=yes |
---|
| 238 | if ! wget -N -O $bgimage http://debathena.mit.edu/error-background.png; then |
---|
| 239 | echo "Hrm, that didn't work. Oh well..." |
---|
| 240 | dpkg-divert --rename --remove $bgimage |
---|
| 241 | divertedbg=no |
---|
| 242 | fi |
---|
| 243 | fi |
---|
| 244 | |
---|
[23460] | 245 | # Setup for package installs in a chrooted immediately-postinstall environment. |
---|
| 246 | echo "Setting locale." |
---|
| 247 | export LANG |
---|
| 248 | . /etc/default/locale |
---|
| 249 | echo "LANG set to $LANG." |
---|
| 250 | echo "Mounting /proc." |
---|
| 251 | mount /proc 2> /dev/null || : |
---|
| 252 | # Clear toxic environment settings inherited from the installer. |
---|
| 253 | unset DEBCONF_REDIR |
---|
| 254 | unset DEBIAN_HAS_FRONTEND |
---|
[23476] | 255 | if [ cluster = "$pxetype" ] ; then |
---|
| 256 | # Network, LVM, and display config that's specific to PXE cluster installs. |
---|
| 257 | # If someone is installing -cluster on an already-installed machine, it's |
---|
| 258 | # assumed that this config has already happened and shouldn't be stomped on. |
---|
[23093] | 259 | |
---|
[23479] | 260 | # Configure network based on the preseed file settings, if present. |
---|
[25569] | 261 | if test -f /root/debathena.preseed && ! grep -q netcfg/get_ipaddress /proc/cmdline; then |
---|
[23479] | 262 | # Switch to canonical hostname. |
---|
| 263 | ohostname=`cat /etc/hostname` |
---|
| 264 | # Hack to avoid installing debconf-get for just this. |
---|
[23875] | 265 | ipaddr=`grep netcfg/get_ipaddress /root/debathena.preseed|sed -e 's/.* //'` |
---|
| 266 | netmask=`grep netcfg/get_netmask /root/debathena.preseed|sed -e 's/.* //'` |
---|
| 267 | gateway=`grep netcfg/get_gateway /root/debathena.preseed|sed -e 's/.* //'` |
---|
[23479] | 268 | |
---|
| 269 | hostname=`host $ipaddr | \ |
---|
[23476] | 270 | sed 's#^.*domain name pointer \(.*\)$#\1#' | sed 's;\.*$;;' | \ |
---|
| 271 | tr '[A-Z]' '[a-z]'` |
---|
[23479] | 272 | if echo $hostname|grep -q "not found" ; then |
---|
| 273 | hostname="" |
---|
| 274 | printf "\a"; sleep 1 ; printf "\a"; sleep 1 ;printf "\a" |
---|
| 275 | echo "The IP address you selected, $ipaddr, does not have an associated" |
---|
| 276 | echo "hostname. Please confirm that you're using the correct address." |
---|
| 277 | while [ -z "$hostname" ] ; do |
---|
| 278 | echo -n "Enter fully qualified hostname [no default]: " |
---|
| 279 | read hostname |
---|
| 280 | done |
---|
| 281 | fi |
---|
| 282 | echo ${hostname%%.*} > /etc/hostname |
---|
| 283 | sed -e 's/\(127\.0\.1\.1[ ]*\).*/\1'"$hostname ${hostname%%.*}/" < /etc/hosts > /etc/hosts.new |
---|
| 284 | mv -f /etc/hosts.new /etc/hosts |
---|
| 285 | if grep -q dhcp /etc/network/interfaces ; then |
---|
| 286 | sed -e s/dhcp/static/ < /etc/network/interfaces > /etc/network/interfaces.new |
---|
| 287 | echo " address $ipaddr" >> /etc/network/interfaces.new |
---|
| 288 | echo " netmask $netmask" >> /etc/network/interfaces.new |
---|
| 289 | echo " gateway $gateway" >> /etc/network/interfaces.new |
---|
[23923] | 290 | echo " dns-nameservers 18.72.0.3 18.70.0.160 18.71.0.151" >> /etc/network/interfaces.new |
---|
[23479] | 291 | mv -f /etc/network/interfaces.new /etc/network/interfaces |
---|
| 292 | fi |
---|
| 293 | hostname ${hostname%%.*} |
---|
[23476] | 294 | fi |
---|
[23479] | 295 | |
---|
[23460] | 296 | fi |
---|
| 297 | else |
---|
| 298 | output "Press return to begin or control-C to abort" |
---|
| 299 | read dummy |
---|
| 300 | fi |
---|
| 301 | |
---|
[25831] | 302 | # Set the "seen" flag for all debconf questions that we configure |
---|
| 303 | # cluster is still non-interactive, see above. |
---|
| 304 | # Except you can't set the "seen" flag for something that isn't installed |
---|
| 305 | # so also set some sane defaults |
---|
| 306 | cat <<EOF | debconf-set-selections |
---|
| 307 | # Set sane defaults |
---|
| 308 | openafs-client openafs-client/thiscell string grand.central.org |
---|
| 309 | openafs-client openafs-client/cachesize string 150000 |
---|
[25839] | 310 | cyrus-common cyrus-common/removespools boolean false |
---|
[25831] | 311 | # A null value is fine as of krb5 1.6.dfsg.3-1 |
---|
| 312 | krb5-config krb5-config/default_realm string |
---|
| 313 | # No value means use Hesiod |
---|
| 314 | zephyr-clients zephyr-clients/servers string |
---|
| 315 | # These are also questions asked by default, but |
---|
| 316 | # the user should probably see them anyway. |
---|
| 317 | #gdm shared/default-x-display-manager seen true |
---|
| 318 | #hddtemp hddtemp/daemon seen true |
---|
| 319 | EOF |
---|
| 320 | |
---|
[24925] | 321 | apt-get update |
---|
| 322 | |
---|
| 323 | output "Verifying machine is up to date..." |
---|
| 324 | pattern='^0 upgraded, 0 newly installed, 0 to remove' |
---|
| 325 | if ! apt-get --simulate --assume-yes dist-upgrade | grep -q "$pattern"; then |
---|
[24958] | 326 | if [ -n "$pxetype" ] ; then |
---|
| 327 | output "Forcing an upgrade" |
---|
| 328 | apt-get --assume-yes dist-upgrade |
---|
| 329 | else |
---|
| 330 | error "Your system is not up to date. Proceeding with an install at" |
---|
| 331 | error "this time could render your system unusable." |
---|
| 332 | error "Please run 'apt-get dist-upgrade' as root or use the GUI update" |
---|
| 333 | error "manager to ensure your system is up to date before continuing." |
---|
[25160] | 334 | error "NOTE: You do NOT need to upgrade to a newer release of Ubuntu", |
---|
| 335 | error "you merely need to ensure you have the latest software updates" |
---|
| 336 | error "for the current version." |
---|
[24958] | 337 | exit 1 |
---|
| 338 | fi |
---|
[24925] | 339 | fi |
---|
| 340 | |
---|
[24891] | 341 | if ! hash aptitude >/dev/null 2>&1; then |
---|
| 342 | output "Installing Debathena installer dependency: aptitude" |
---|
| 343 | apt-get -y install aptitude |
---|
| 344 | fi |
---|
| 345 | |
---|
[25346] | 346 | output "Installing Debathena installer dependencies: wget and dnsutils" |
---|
[25720] | 347 | apt-get -y install wget dnsutils |
---|
[24786] | 348 | if [ yes = "$resolvconfhack" ]; then |
---|
| 349 | output "Installing resolvconf ahead of time" |
---|
[25720] | 350 | apt-get -y install resolvconf |
---|
[24786] | 351 | fi |
---|
[23093] | 352 | |
---|
[25510] | 353 | # Only add our openafs component if DKMS isn't available |
---|
| 354 | openafs_component="" |
---|
[25106] | 355 | if aptitude show openafs-modules-dkms > /dev/null; then |
---|
[25510] | 356 | modules="openafs-modules-dkms" |
---|
| 357 | else |
---|
[25106] | 358 | openafs_component=" openafs" |
---|
| 359 | fi |
---|
| 360 | |
---|
[25831] | 361 | # Select the correct headers package |
---|
| 362 | kernel_hdr_meta_pkgs= |
---|
| 363 | if [ "$ubuntu" = "yes" ]; then |
---|
| 364 | # Ubuntu kernel metapackages have a source of 'linux-meta' |
---|
| 365 | # Find all of them and replace "-image-" with "-headers-". |
---|
[25839] | 366 | # Except the source _starts with_ linux-meta because of HWE |
---|
| 367 | # stacks (e.g. linux-meta-lts-quantal. I hate you all. |
---|
| 368 | kernel_hdr_meta_pkgs=$(dpkg-query -W -f '${Source}\t${Package}\n' 'linux-image-*' | awk '$1 ~ /^linux-meta/ { sub(/-image-/, "-headers-", $2); print $2 }') |
---|
[25831] | 369 | else |
---|
| 370 | # Debian. "Yay". Old squeeze has linux-latest-2.6 as the |
---|
| 371 | # metapackage. squeeze-backpors and newer have linux-latest as |
---|
| 372 | # the metpackage. For bonus points, wheezy can have two packages |
---|
| 373 | # installed with linux-latest as the metapackage, because one of |
---|
| 374 | # those is itself a metapckage. |
---|
| 375 | kernel_hdr_meta_pkgs=$(dpkg-query -W -f '${Source}::${Package}\n' 'linux-image-*' | awk -F:: '$1~/^linux-latest/ { sub(/-image-/, "-headers-", $2); print $2 }') |
---|
| 376 | fi |
---|
| 377 | pkgs_to_install= |
---|
| 378 | for p in $kernel_hdr_meta_pkgs; do |
---|
| 379 | # Only install real packages |
---|
| 380 | if apt-cache show $p | grep -q '^Source: '; then |
---|
| 381 | pkgs_to_install=" $p" |
---|
| 382 | fi |
---|
| 383 | done |
---|
| 384 | if [ -z "$pkgs_to_install" ]; then |
---|
| 385 | output "We cannot find a kernel header metapackage for your kernel." |
---|
| 386 | output "You will need one in order for DKMS to build the openafs" |
---|
| 387 | output "kernel module. You should probably stop here and figure out" |
---|
| 388 | output "what kernel metapackage you're running, and install the" |
---|
| 389 | output "corresponding kernel headers package." |
---|
| 390 | ask "Do you want to continue anyway? [y/N] " n |
---|
| 391 | if [ y != "$answer" ]; then |
---|
| 392 | exit 0 |
---|
| 393 | fi |
---|
| 394 | else |
---|
| 395 | output "Installing header packages: $pkgs_to_install" |
---|
| 396 | apt-get -y install $pkgs_to_install |
---|
| 397 | fi |
---|
| 398 | |
---|
[23492] | 399 | output "Adding the Debathena repository to the apt sources" |
---|
| 400 | output "(This may cause the update manager to claim new upgrades are available." |
---|
| 401 | output "Ignore them until this script is complete.)" |
---|
[24472] | 402 | sourceslist=/etc/apt/sources.list.d/debathena.list |
---|
[24791] | 403 | clustersourceslist=/etc/apt/sources.list.d/debathena.clusterinfo.list |
---|
| 404 | if [ -z "$hostname" ] ; then hostname=`hostname` ; fi |
---|
[25222] | 405 | |
---|
[25413] | 406 | if [ ! -e "$sourceslist" ] || ! grep -v ^# "$sourceslist" | grep -q debathena; then |
---|
[23093] | 407 | if [ -e "$sourceslist" ]; then |
---|
| 408 | echo "" >> $sourceslist |
---|
| 409 | fi |
---|
[25106] | 410 | echo "deb http://debathena.mit.edu/apt $distro debathena debathena-config debathena-system$openafs_component" >> $sourceslist |
---|
| 411 | echo "deb-src http://debathena.mit.edu/apt $distro debathena debathena-config debathena-system$openafs_component" >> $sourceslist |
---|
[23093] | 412 | fi |
---|
| 413 | |
---|
[25838] | 414 | # As of 6 March 2013, Hesiod no longer contains multiple unversioned |
---|
| 415 | # apt_release tokens (Trac: #1036). development implies proposed. |
---|
| 416 | # bleeding implies development, and the transitive property applies. |
---|
| 417 | # It's possible we should have this be configurable via a URL |
---|
| 418 | # rather than hardcoded. |
---|
| 419 | apt_release=$(dig +short +bufsize=2048 ${hostname}.cluster.ns.athena.mit.edu TXT | tr -d '"' | awk '$1=="apt_release" { print $2 }') |
---|
[24791] | 420 | |
---|
[25838] | 421 | if [ -n "$apt_release" ]; then |
---|
| 422 | extra_repos= |
---|
| 423 | case "$apt_release" in |
---|
| 424 | development) |
---|
| 425 | extra_repos="development proposed" ;; |
---|
| 426 | proposed) |
---|
| 427 | extra_repos="proposed" ;; |
---|
| 428 | bleeding) |
---|
| 429 | extra_repos="bleeding development proposed" ;; |
---|
| 430 | *) |
---|
| 431 | output "NOTE: Ignoring unknown apt_release value: \"$apt_release\"" ;; |
---|
| 432 | esac |
---|
| 433 | aptexplained=false |
---|
| 434 | for hc in $extra_repos; do |
---|
[25235] | 435 | echo "Adding $distro-$hc apt repository." |
---|
| 436 | if [ "${aptexplained}" = false ] ; then |
---|
| 437 | echo "" >> $clustersourceslist |
---|
| 438 | echo "# This file is automatically updated by debathena-auto-update" >> $clustersourceslist |
---|
| 439 | echo "# based on your Hesiod cluster information. If you want to" >> $clustersourceslist |
---|
| 440 | echo "# make changes, do so in another file." >> $clustersourceslist |
---|
| 441 | aptexplained=true |
---|
| 442 | fi |
---|
| 443 | echo "" >> $clustersourceslist |
---|
| 444 | echo "deb http://debathena.mit.edu/apt $distro-${hc} debathena debathena-config debathena-system$openafs_component" >> $clustersourceslist |
---|
| 445 | echo "deb-src http://debathena.mit.edu/apt $distro-${hc} debathena debathena-config debathena-system$openafs_component" >> $clustersourceslist |
---|
[25838] | 446 | done |
---|
| 447 | fi |
---|
[24765] | 448 | |
---|
[23093] | 449 | if [ "$ubuntu" = "yes" ]; then |
---|
| 450 | output "Making sure the universe repository is enabled" |
---|
| 451 | sed -i 's,^# \(deb\(\-src\)* http://archive.ubuntu.com/ubuntu [[:alnum:]]* universe\)$,\1,' /etc/apt/sources.list |
---|
| 452 | fi |
---|
| 453 | |
---|
[23492] | 454 | output "Downloading the Debathena archive signing key" |
---|
[23831] | 455 | if ! wget -N http://debathena.mit.edu/apt/debathena-archive-keyring.asc ; then |
---|
[23492] | 456 | error "Download failed; terminating." |
---|
[23093] | 457 | exit 1 |
---|
| 458 | fi |
---|
[24334] | 459 | echo "fa787714d1ea439c28458aab64962f755e2bdee7a3520919a72b641458757fa3586fd269cc1dae8d99047e00b3df88db0826f0c99a1f5a8771618b3c0be8e3bd ./debathena-archive-keyring.asc" | \ |
---|
| 460 | sha512sum -c |
---|
[23500] | 461 | apt-key add debathena-archive-keyring.asc |
---|
| 462 | rm ./debathena-archive-keyring.asc |
---|
[23093] | 463 | |
---|
[25722] | 464 | $aptitude update |
---|
[23093] | 465 | |
---|
[25106] | 466 | if [ -z "$modules" ]; then |
---|
| 467 | modules_want=$(dpkg-query -W -f '${Source}\t${Package}\n' 'linux-image-*' | \ |
---|
| 468 | sed -nre 's/^linux-(meta|latest[^\t]*)\tlinux-image-(.*)$/openafs-modules-\2/p') |
---|
| 469 | modules= |
---|
| 470 | for m in $modules_want; do |
---|
| 471 | aptitude show $m > /dev/null && modules="$modules $m" |
---|
| 472 | done |
---|
| 473 | fi |
---|
[23093] | 474 | |
---|
| 475 | if [ -z "$modules" ]; then |
---|
| 476 | error "An OpenAFS modules metapackage for your kernel is not available." |
---|
[23492] | 477 | error "Please use the manual installation instructions at" |
---|
[23957] | 478 | error "http://debathena.mit.edu/install" |
---|
[23492] | 479 | error "You will need to compile your own AFS modules as described at:" |
---|
[23957] | 480 | error "http://debathena.mit.edu/troubleshooting#openafs-custom" |
---|
[23492] | 481 | exit 1 |
---|
[23093] | 482 | fi |
---|
| 483 | |
---|
| 484 | output "Installing OpenAFS kernel metapackage" |
---|
| 485 | apt-get -y install $modules |
---|
| 486 | |
---|
[25336] | 487 | if [ "cluster" = "$category" ] || [ "workstation" = "$category" ] ; then |
---|
| 488 | output "Installing debathena-license-config" |
---|
| 489 | apt-get -y install debathena-license-config |
---|
| 490 | fi |
---|
| 491 | |
---|
[23187] | 492 | # Use the noninteractive frontend to install the main package. This |
---|
| 493 | # is so that AFS and Zephyr don't ask questions of the user which |
---|
| 494 | # debathena packages will later stomp on anyway. |
---|
[23492] | 495 | output "Installing main Debathena metapackage $mainpackage" |
---|
[23460] | 496 | |
---|
[25722] | 497 | $aptitude -y install "$mainpackage" |
---|
[23187] | 498 | |
---|
| 499 | # Use the default front end and allow questions to be asked; otherwise |
---|
| 500 | # Java will fail to install since it has to present its license. |
---|
| 501 | if [ yes = "$csoft" ]; then |
---|
[23247] | 502 | output "Installing debathena-extra-software" |
---|
[25722] | 503 | DEBIAN_PRIORITY=critical $aptitude -y install debathena-extra-software |
---|
[23187] | 504 | fi |
---|
[23460] | 505 | if [ yes = "$tsoft" ]; then |
---|
| 506 | output "Installing debathena-thirdparty" |
---|
[25722] | 507 | DEBIAN_PRIORITY=critical $aptitude -y install debathena-thirdparty |
---|
[23460] | 508 | fi |
---|
[23910] | 509 | |
---|
| 510 | # Post-install cleanup for cluster systems. |
---|
[24903] | 511 | if [ "$divertedbg" = "yes" ]; then |
---|
| 512 | rm -f $bgimage |
---|
| 513 | if ! dpkg-divert --rename --remove $bgimage; then |
---|
| 514 | echo "Failed to remove diversion of background. You probably don't care." |
---|
| 515 | fi |
---|
| 516 | fi |
---|
| 517 | |
---|
[23910] | 518 | if [ cluster = "$category" ] ; then |
---|
| 519 | # Force an /etc/adjtime entry so there's no confusion about whether the |
---|
| 520 | # hardware clock is UTC or local. |
---|
| 521 | echo "Setting hardware clock to UTC." |
---|
| 522 | hwclock --systohc --utc |
---|
| 523 | fi |
---|
[25883] | 524 | |
---|
| 525 | # Remove the pxe install flag |
---|
| 526 | rm -f /root/pxe-install-flag |
---|
| 527 | |
---|