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