Commit 4cb9c27fc7a11e9b70814e15181b58ea10741244

Authored by Peter Hubberstey
0 parents

Added files from xenserver 7 install 2016-07-25

Showing 14 changed files with 992 additions and 0 deletions

... ... @@ -0,0 +1,669 @@
  1 +#! /bin/bash
  2 +
  3 +# Copyright (c) 2007 XenSource, Inc.
  4 +#
  5 +# This script installs or updates the XE support packages installed in a guest.
  6 +
  7 +os_distro=""
  8 +os_majorver=""
  9 +install_kernel=1
  10 +interactive=1
  11 +
  12 +if [ -z "${DATADIR}" ] ; then
  13 + DATADIR=$(dirname $0)
  14 +fi
  15 +
  16 +usage()
  17 +{
  18 + echo "usage: install.sh [-d <DISTRO> -m <MAJOR>] [-k]"
  19 + echo ""
  20 + echo " -d <DISTRO> Specifies the distro name."
  21 + echo " -m <MAJOR> Specifies the major version of the distro release."
  22 + echo " -k Do not update the kernel."
  23 + echo " -n Non interactive mode."
  24 + echo ""
  25 + echo "The -d and -m options must be used together. If neither is given then"
  26 + echo "auto-detection will be attempted."
  27 + exit 1
  28 +}
  29 +while getopts d:hkm:n OPT ; do
  30 + case $OPT in
  31 + d) os_distro="$OPTARG" ;;
  32 + k) install_kernel=0 ;;
  33 + m) os_majorver="$OPTARG" ;;
  34 + n) interactive=0 ;;
  35 +
  36 + h|\?) usage ;;
  37 + esac
  38 +done
  39 +
  40 +if [ -z "${os_distro}" -a -n "${os_majorver}" ] || \
  41 + [ -n "${os_distro}" -a -z "${os_majorver}" ] ; then
  42 + echo "Distribution name (-d) and major version (-m) must be specified"
  43 + echo "together on the command line."
  44 + exit 1
  45 +fi
  46 +
  47 +if [ -z "${os_distro}" ] ; then
  48 + if [ -z "${XE_LINUX_DISTRIBUTION}" ] ; then
  49 + XE_LINUX_DISTRIBUTION=${DATADIR}/xe-linux-distribution
  50 + fi
  51 +
  52 + if [ ! -f "${XE_LINUX_DISTRIBUTION}" ] ; then
  53 + echo "Fatal Error: xe-linux-distribution script not found in ${DATADIR}."
  54 + exit 1
  55 + fi
  56 +
  57 + if [ ! -f "${DATADIR}/versions.deb" -o ! -f "${DATADIR}/versions.rpm" ] ; then
  58 + echo "Fatal Error: versions.deb or versions.rpm not found in ${DATADIR}."
  59 + exit 1
  60 + fi
  61 +
  62 + eval $(${XE_LINUX_DISTRIBUTION})
  63 + if [ $? -ne 0 -o -z "${os_distro}" -o -z "${os_majorver}" ] ; then
  64 + echo "Fatal Error: Failed to determine Linux distribution and version."
  65 + exit 1
  66 + fi
  67 +
  68 + echo "Detected \`${os_name}' (${os_distro} version ${os_majorver})."
  69 + echo
  70 +else
  71 + echo "Distribution \`${os_distro}' version \`${os_majorver}' given on command line."
  72 + echo
  73 +fi
  74 +
  75 +ARCH=$(uname -m | sed -e 's/i.86/i386/g')
  76 +case "${ARCH}" in
  77 + i386|x86_64) ;;
  78 + *)
  79 + echo "Architecture ${ARCH} is not supported"
  80 + exit 1
  81 + ;;
  82 +esac
  83 +
  84 +failure()
  85 +{
  86 + echo "Unable to install guest packages for distribution"
  87 + if [ -n "${os_name}" ] ; then
  88 + echo "${os_name} (${os_distro})."
  89 + else
  90 + echo "${os_distro}."
  91 + fi
  92 + echo
  93 + if [ $# -gt 0 ] ; then
  94 + echo $@
  95 + echo
  96 + fi
  97 + echo "You should manually install a version of"
  98 + echo "xe-guest-utilities which is suitable for your"
  99 + echo "distribution."
  100 + exit 1
  101 +}
  102 +
  103 +select_rpm_utilities()
  104 +{
  105 + if [ -f "${DATADIR}/versions.rpm" ] ; then
  106 + source ${DATADIR}/versions.rpm
  107 + XGU=
  108 + for p in $(eval echo \${XE_GUEST_UTILITIES_PKG_FILE_${ARCH}}) ; do
  109 + XGU="$XGU ${DATADIR}/${p}"
  110 + done
  111 + else
  112 + echo "Warning: Guest utilities not found in ${DATADIR}."
  113 + fi
  114 +}
  115 +
  116 +select_pkgs_rhel()
  117 +{
  118 + GUEST_PKG_TYPE=rpm
  119 +
  120 + case "${os_distro}${os_majorver}" in
  121 + rhel4|centos4)
  122 + # RHEL 4.9 already contains a Xen aware kernel
  123 + if [ "${ARCH}" == "i386" -a "${install_kernel}" -gt 0 ] ; then
  124 + REQUIRE_XENBLK_KO=yes
  125 + REQUIRE_XENNET_KO=yes
  126 + fi
  127 + ;;
  128 + rhel5|centos5|oracle5|scientific5)
  129 + # No additional kernel package
  130 + ;;
  131 + rhel6|centos6|oracle6|scientific6)
  132 + # No additional kernel package
  133 + ;;
  134 + rhel7|centos7|oracle7|scientific7)
  135 + # No additional kernel package
  136 + ;;
  137 + rhel3|fedora*)
  138 + # Not officially supported therefore no additional packages required.
  139 + ;;
  140 + *)
  141 + failure "Unknown RedHat Linux variant \`${os_distro} ${os_majorver}'."
  142 + ;;
  143 + esac
  144 +
  145 + select_rpm_utilities
  146 +}
  147 +
  148 +select_pkgs_sles()
  149 +{
  150 + GUEST_PKG_TYPE=rpm
  151 +
  152 + case "${os_distro}${os_majorver}" in
  153 + sles9|"suse linux9")
  154 + # SLES9.4+ already contains a Xen aware kernel
  155 + ;;
  156 + sles10|"suse linux10")
  157 + # SLES10 already contains a Xen aware kernel
  158 + ;;
  159 + sles11|"suse linux11")
  160 + # SLES11 already contains a Xen aware kernel
  161 + ;;
  162 + sles12|"suse linux12")
  163 + # SLES12 already contains a Xen aware kernel
  164 + ;;
  165 + *)
  166 + failure "Unknown SuSE Linux variant \`${os_distro} ${os_majorver}'."
  167 + ;;
  168 + esac
  169 +
  170 + select_rpm_utilities
  171 +}
  172 +
  173 +select_pkgs_coreos()
  174 +{
  175 + GUEST_PKG_TYPE=coreos
  176 + XGU="xe-linux-distribution"
  177 +}
  178 +
  179 +select_pkgs_debian()
  180 +{
  181 + GUEST_PKG_TYPE=deb
  182 +
  183 + case ${os_distro}:${os_majorver}:${os_minorver} in
  184 + debian:[0-5]:*)
  185 + failure "This version of Debian is no longer supported by these utilities."
  186 + ;;
  187 + debian:[6-9]:*) ;;
  188 + debian:[1-9][0-9]:*) ;;
  189 + debian:testing:*|debian:unstable:*) ;;
  190 +
  191 + ubuntu:[1-9]:*)
  192 + failure "This version of Ubuntu is no longer supported by these utilities."
  193 + ;;
  194 + ubuntu:[1-9][0-9]:*) ;;
  195 + *)
  196 + failure "Unknown Debian variant ${os_distro}:${os_majorver}:${os_minorver}"
  197 + ;;
  198 + esac
  199 +
  200 + case ${ARCH} in
  201 + i386) DARCH=i386 ;;
  202 + x86_64) DARCH=amd64 ;;
  203 + esac
  204 +
  205 + if [ -f "${DATADIR}/versions.deb" ] ; then
  206 + source ${DATADIR}/versions.deb
  207 + XGU=${DATADIR}/$(eval echo \${XE_GUEST_UTILITIES_PKG_FILE_${DARCH}})
  208 + else
  209 + echo "Warning: Guest utilities not found in ${DATADIR}."
  210 + fi
  211 +}
  212 +
  213 +select_pkgs_xe()
  214 +{
  215 + GUEST_PKG_TYPE=rpm
  216 +
  217 + select_rpm_utilities
  218 +}
  219 +
  220 +update_lvm_configuration_required()
  221 +{
  222 + if test "${os_distro}" != rhel
  223 + then
  224 + return 1
  225 + fi
  226 + if test ${os_majorver} != 4
  227 + then
  228 + return 1
  229 + fi
  230 + if test \! -f /etc/lvm/lvm.conf
  231 + then
  232 + return 1
  233 + fi
  234 + lvm_types="`grep -e '^[ \t]*types' /etc/lvm/lvm.conf`"
  235 + if [[ -z "$lvm_types" || "$lvm_types" != *\"xvd\"* ]]
  236 + then
  237 + return 0
  238 + fi
  239 + return 1
  240 +}
  241 +
  242 +update_lvm_configuration()
  243 +{
  244 + if test -z "`grep -e '^[ \t]*types' /etc/lvm/lvm.conf`"
  245 + then
  246 + sed -i '/^[ \t]*devices[ \t]*{[ \t]*/a \ types = ["xvd", 16]' /etc/lvm/lvm.conf
  247 + else
  248 + sed -i 's/^[ \t]*types.*/ types = ["xvd", 16]/g' /etc/lvm/lvm.conf
  249 + fi
  250 +}
  251 +
  252 +update_inittab_configuration_required()
  253 +{
  254 + case "${os_distro}${os_majorver}" in
  255 + sles10|"suse linux10"|sles11|"suse linux11")
  256 + # SLES10 starts up two gettys, and we want to disable one of them
  257 + if grep -Eq '^cons:12345:respawn:/sbin/smart_agetty -L 42 console' /etc/inittab; then
  258 + if grep -Eq '^x0:12345:respawn:/sbin/agetty -L 9600 xvc0 xterm' /etc/inittab; then
  259 + return 0
  260 + fi
  261 + fi
  262 + ;;
  263 + *)
  264 + ;;
  265 + esac
  266 + return 1
  267 +}
  268 +
  269 +update_inittab_configuration()
  270 +{
  271 + case "${os_distro}${os_majorver}" in
  272 + sles10|"suse linux10"|sles11|"suse linux11")
  273 + # Disable duplicate getty
  274 + sed -i 's/^x0:12345:respawn:/# x0:12345:respawn:/g' /etc/inittab
  275 + ;;
  276 + *)
  277 + ;;
  278 + esac
  279 + /sbin/telinit q
  280 +}
  281 +
  282 +update_arp_notify_required()
  283 +{
  284 + # PV ops kernels do not emit gratuitous ARPs on migrate unless this is set
  285 + file=/proc/sys/net/ipv4/conf/all/arp_notify
  286 + if [ -f ${file} ] ; then
  287 + val=$(cat ${file})
  288 + if [ "${val}" = 0 ] ; then
  289 + return 0;
  290 + fi
  291 + fi
  292 + return 1
  293 +}
  294 +
  295 +update_arp_notify_configuration()
  296 +{
  297 + file=/etc/sysctl.conf
  298 + if [ -e "${file}" ] ; then
  299 + sed -i -e 's/\(^\s*net\.ipv4\.conf\.[^.]\+\.arp_notify\s*=\s*0\)/#Auto-disabled by xs-tools:install.sh\n#\1/' ${file}
  300 + else
  301 + folder=/etc/sysctl.d/
  302 + if [ ! -d "${folder}" ] ; then
  303 + echo "Cannot update arp_notify configuration as neither ${file} nor ${folder} present" >&2
  304 + return 1
  305 + fi
  306 + file=${folder}/10-enable-arp-notify.conf
  307 + fi
  308 + echo -e "# Auto-enabled by xs-tools:install.sh\nnet.ipv4.conf.all.arp_notify = 1" >> ${file}
  309 + return 0
  310 +}
  311 +
  312 +update_modules_configuration_required()
  313 +{
  314 + if [ -f "/etc/modprobe.conf" ] ; then
  315 + conf="/etc/modprobe.conf"
  316 + elif [ -f "/etc/modules.conf" ] ; then
  317 + conf="/etc/modules.conf"
  318 + else
  319 + return 1
  320 + fi
  321 +
  322 + if [ -z "${KERNEL}" ] ; then
  323 + return 1
  324 + fi
  325 +
  326 + if [ X"${REQUIRE_XENNET_KO}" = "Xyes" ] ; then
  327 + if ! grep -Eq '^alias eth0 xennet$' "${conf}" ; then
  328 + # Required module alias not present!
  329 + return 0
  330 + fi
  331 + else
  332 + if grep -Eq '^[^#]*eth0' "${conf}" ; then
  333 + # Module alias shouldn't be present as driver is kernel resident!
  334 + return 0
  335 + fi
  336 + fi
  337 + if [ X"${REQUIRE_XENBLK_KO}" = "Xyes" ] ; then
  338 + if ! grep -Eq '^alias scsi_hostadapter xenblk$' "${conf}" ; then
  339 + # Required module alias not present!
  340 + return 0
  341 + fi
  342 + else
  343 + if grep -Eq '^[^#]*scsi_hostadapter' "${conf}" ; then
  344 + # Module alias shouldn't be present as driver is kernel resident!
  345 + return 0
  346 + fi
  347 + fi
  348 +
  349 + # no need to update modules configuration
  350 + return 1
  351 +}
  352 +
  353 +update_modules_configuration()
  354 +{
  355 + if [ -f "/etc/modprobe.conf" ] ; then
  356 + conf="/etc/modprobe.conf"
  357 + elif [ -f "/etc/modules.conf" ] ; then
  358 + conf="/etc/modules.conf"
  359 + else
  360 + return 1
  361 + fi
  362 +
  363 + echo "Updating ${conf}, original saved in ${conf}.bak"
  364 + cp "${conf}" "${conf}.bak"
  365 +
  366 + # Flush lines concerning PV modules
  367 + grep -Ev '\beth0\b|\bscsi_hostadapter\b' "${conf}.bak" >"${conf}" || true
  368 +
  369 + # Add lines to alias any PV modules needed
  370 + if [ X"${REQUIRE_XENNET_KO}" = "Xyes" ] ; then
  371 + echo 'alias eth0 xennet' >>"${conf}"
  372 + fi
  373 + if [ X"${REQUIRE_XENBLK_KO}" = "Xyes" ] ; then
  374 + echo 'alias scsi_hostadapter xenblk' >>"${conf}"
  375 + fi
  376 +
  377 + return 0
  378 +}
  379 +
  380 +update_grub_configuration()
  381 +{
  382 + if [ -f "/boot/grub/menu.lst" ] ; then
  383 + conf=$(readlink -f "/boot/grub/menu.lst")
  384 + elif [ -f "/boot/grub/grub.conf" ] && [ ! -L "/boot/grub/grub.conf" ] ; then
  385 + conf=$(readlink -f "/boot/grub/grub.conf")
  386 + else
  387 + echo "No grub configuration found. Not updating"
  388 + return 1
  389 + fi
  390 +
  391 + cmdline=$(cat /proc/cmdline)
  392 + if [ -z "${cmdline}" ] ; then
  393 + echo "No kernel command line found. Not updating grub configuration."
  394 + return 1
  395 + fi
  396 +
  397 + echo "Updating ${conf}, original saved in ${conf}.bak"
  398 + cp "${conf}" "${conf}.bak"
  399 +
  400 + # Correct kernel command line.
  401 + echo " * set kernel command line to \`${cmdline}'."
  402 +
  403 +
  404 + # Ensure kernel initrd and module lines include /boot/ if it is
  405 + # not a separate filesystem.
  406 + root_stat=$(stat --format='%d' --terse "/")
  407 + boot_stat=$(stat --format='%d' --terse "/boot")
  408 + if [ "${root_stat}" == "${boot_stat}" ] ; then
  409 + echo " * prepend /boot/ to kernel path."
  410 + rewrite_path="s;^\(\([^\#]*\|\)\(kernel\|initrd\|module\)\) \(/boot\)\?/\?;\1 /boot/;g"
  411 + fi
  412 +
  413 + sed -e "s;^\(\([^\#]*\|\)kernel [^ ]*\) .*;\1 ${cmdline};g ; ${rewrite_path}" \
  414 + <"${conf}.bak" >"${conf}"
  415 +
  416 + # Make sure there is an entry for the kernel pointed to by /boot/xenkernel
  417 + if [ -L "/boot/xenkernel" ] && [ -x "/sbin/grubby" ] ; then
  418 + kernel=$(readlink -f "/boot/xenkernel")
  419 + initrd=$(readlink -f "/boot/xeninitrd")
  420 + k="$(basename ${kernel} | sed -e 's/vmlinu.-//g')"
  421 + echo " * add entry for ${k} (/boot/xenkernel)."
  422 + [ -n "${initrd}" ] && INITRD="--initrd ${initrd}"
  423 + /sbin/grubby --add-kernel=${kernel} $INITRD \
  424 + --copy-default --make-default --title="${k}"
  425 + fi
  426 +
  427 + echo
  428 +
  429 + return 0
  430 +}
  431 +
  432 +update_vmlinuz_symlink()
  433 +{
  434 + local symlink=$(readlink -f "/boot/vmlinuz")
  435 +
  436 + case ${symlink} in
  437 + /boot/xenu-linux-*)
  438 + ;;
  439 + *)
  440 + echo "\`/boot/vmlinuz' does not point to a Xen kernel. Leaving."
  441 + return 1
  442 + ;;
  443 + esac
  444 +
  445 + local version=${symlink/\/boot\/xenu-linux-}
  446 +
  447 + mv -v "/boot/vmlinuz" "/boot/vmlinuz-xenu-${version}"
  448 +
  449 + if [ -L "/boot/initrd.img" ] && \
  450 + [ "$(readlink -f /boot/initrd.img)" = "/boot/initrd.img-${version}" ] ; then
  451 + mv -v "/boot/initrd.img" "/boot/initrd.img-xenu-${version}"
  452 + fi
  453 +}
  454 +
  455 +install_rpms()
  456 +{
  457 + if [ -n "${XGU}" ] ; then
  458 + rpm -Uvh ${XGU}
  459 + fi
  460 +
  461 + if [ -n "${MKINITRD}" ] ; then
  462 + rpm -Fvh --replacefiles --replacepkgs "${MKINITRD}"
  463 + fi
  464 +
  465 + if [ -n "${ECRYPTFS_UTILS}" ] ; then
  466 + rpm -Fvh --replacefiles --replacepkgs "${ECRYPTFS_UTILS}"
  467 + fi
  468 +
  469 + # Install not upgrade so that old kernel is retained.
  470 + if [ -n "${KERNEL}" ] ; then
  471 + rpm -ivh "${KERNEL}"
  472 + version=$(rpm -qp --qf "%{V}-%{R}\n" "${KERNEL}")
  473 + if [ -f "/boot/vmlinuz-${version}xenU" ] && [ -x "/sbin/grubby" ] ; then
  474 + echo "Making kernel ${version}xenU"
  475 + echo "the default in grub configuration."
  476 + /sbin/grubby --set-default="/boot/vmlinuz-${version}xenU"
  477 + echo ""
  478 + fi
  479 + fi
  480 + echo ""
  481 +}
  482 +
  483 +install_debs()
  484 +{
  485 + dpkg -i ${KERNEL} ${MKINITRD} ${XGU}
  486 +
  487 + echo ""
  488 +}
  489 +
  490 +install_coreos()
  491 +{
  492 + echo "Installing the agent..."
  493 + mkdir -p /usr/share/oem/xs/
  494 + cp -f ${DATADIR}/xe-daemon \
  495 + ${DATADIR}/xe-linux-distribution \
  496 + ${DATADIR}/xe-update-guest-attrs /usr/share/oem/xs/
  497 + cp -f ${DATADIR}/xen-vcpu-hotplug.rules /etc/udev/rules.d/
  498 + cp -f ${DATADIR}/xe-linux-distribution.service /etc/systemd/system/
  499 + systemctl enable /etc/systemd/system/xe-linux-distribution.service
  500 + echo "Installation complete."
  501 + systemctl start xe-linux-distribution.service
  502 +}
  503 +
  504 +case "${os_distro}" in
  505 + rhel|centos|oracle|fedora) select_pkgs_rhel ;;
  506 + scientific) select_pkgs_rhel ;;
  507 + sles|"suse linux") select_pkgs_sles ;;
  508 + debian|ubuntu) select_pkgs_debian ;;
  509 + xe-ddk|xe-sdk) select_pkgs_xe ;;
  510 + CoreOS) select_pkgs_coreos ;;
  511 + *) failure "Unknown Linux distribution \`${os_distro}'." ;;
  512 +esac
  513 +
  514 +if [ -n "${KERNEL}" ] ; then
  515 + for K in ${KERNEL} ; do
  516 + if [ ! -f "${K}" ] ; then
  517 + echo "Warning: kernel ${K} not found."
  518 + echo ""
  519 + KERNEL=""
  520 + fi
  521 + done
  522 +fi
  523 +if [ -n "${MKINITRD}" -a ! -f "${MKINITRD}" ] ; then
  524 + echo "Warning: mkinitrd ${MKINITRD} not found."
  525 + echo ""
  526 + MKINITRD=""
  527 +fi
  528 +if [ -n "${ECRYPTFS_UTILS}" ] ; then
  529 + for E in ${ECRYPTFS_UTILS} ; do
  530 + if [ ! -f "${E}" ] ; then
  531 + echo "Warning: ecryptfs-utils ${E} not found."
  532 + echo ""
  533 + ECRYPTFS_UTILS=""
  534 + fi
  535 + done
  536 +fi
  537 +if [ -n "${XGU}" ] ; then
  538 + for P in ${XGU} ; do
  539 + if [ ! -f "${P}" ] ; then
  540 + echo "Warning: xe-guest-utilities ${P} not found."
  541 + XGU=""
  542 + fi
  543 + done
  544 +fi
  545 +if [ -z "${XGU}" ] ; then
  546 + echo ""
  547 + echo "Certain guest features will not be active until a version of "
  548 + echo "xe-guest-utilities is installed."
  549 + echo ""
  550 +fi
  551 +
  552 +if [ -z "${KERNEL}" -a -z "${MKINITRD}" -a -z "${XGU}" -a -z "${ECRYPTFS_UTILS}" ] ; then
  553 + echo "No updates required to this Virtual Machine."
  554 + exit 0
  555 +fi
  556 +
  557 +echo "The following changes will be made to this Virtual Machine:"
  558 +
  559 +if [ -n "${KERNEL}" -a -L "/boot/xenkernel" ] ||
  560 + [ -n "${KERNEL}" -a -L "/boot/vmlinuz" ] ; then
  561 + echo " * grub configuration update."
  562 + echo " * remove legacy kernel and initrd symbolic links."
  563 + update_grub=1
  564 +else
  565 + update_grub=0
  566 +fi
  567 +
  568 +if update_modules_configuration_required ; then
  569 + echo " * modules configuration update."
  570 + update_modules=1
  571 +else
  572 + update_modules=0
  573 +fi
  574 +
  575 +if update_lvm_configuration_required ; then
  576 + echo " * lvm configuration update."
  577 + update_lvm=1
  578 +else
  579 + update_lvm=0
  580 +fi
  581 +
  582 +if update_inittab_configuration_required ; then
  583 + echo " * update gettys in inittab."
  584 + update_inittab=1
  585 +else
  586 + update_inittab=0
  587 +fi
  588 +
  589 +if update_arp_notify_required ; then
  590 + echo " * update arp_notify sysctl."
  591 + update_arp_notify=1
  592 +else
  593 + update_arp_notify=0
  594 +fi
  595 +
  596 +echo " * packages to be installed/upgraded:"
  597 +for K in ${KERNEL}; do
  598 + echo -e " - $(basename ${K})"
  599 +done
  600 +[ -n "${MKINITRD}" ] && echo -e " - $(basename ${MKINITRD})"
  601 +for E in ${ECRYPTFS_UTILS}; do
  602 + echo -e " - $(basename ${E})"
  603 +done
  604 +for P in ${XGU}; do
  605 + echo -e " - $(basename ${P})"
  606 +done
  607 +echo ""
  608 +
  609 +if [ ${interactive} -gt 0 ] ; then
  610 + while read -p "Continue? [y/n] " -n 1 ans ; do
  611 + echo
  612 + case "$ans" in
  613 + Y|y)
  614 + break
  615 + ;;
  616 + N|n)
  617 + echo "Aborting."
  618 + exit 0
  619 + ;;
  620 + *)
  621 + echo "Invalid response \`$ans'"
  622 + ;;
  623 + esac
  624 + done
  625 + echo
  626 +fi
  627 +
  628 +set -e # Any failures from here onwards should be fatal
  629 +
  630 +if [ "${update_grub}" -gt 0 ] ; then
  631 + update_grub_configuration
  632 +
  633 + # Remove /boot/xenkernel
  634 + if [ -L "/boot/xenkernel" ] || [ -L "/boot/xeninitrd" ] || [ -L "/boot/vmlinuz" ] ; then
  635 + echo "Removing legacy boot kernel and initrd symbolic links."
  636 + [ -L "/boot/xenkernel" ] && mv -v "/boot/xenkernel" "/boot/xenkernel.bak"
  637 + [ -L "/boot/xeninitrd" ] && mv -v "/boot/xeninitrd" "/boot/xeninitrd.bak"
  638 + [ -L "/boot/vmlinuz" ] && update_vmlinuz_symlink
  639 + echo
  640 + fi
  641 +fi
  642 +
  643 +if [ "${update_modules}" -gt 0 ] ; then
  644 + update_modules_configuration
  645 +fi
  646 +
  647 +if [ "${update_lvm}" -gt 0 ] ; then
  648 + update_lvm_configuration
  649 +fi
  650 +
  651 +if [ "${update_inittab}" -gt 0 ] ; then
  652 + update_inittab_configuration
  653 +fi
  654 +
  655 +if [ "${update_arp_notify}" -gt 0 ] ; then
  656 + update_arp_notify_configuration
  657 +fi
  658 +
  659 +case ${GUEST_PKG_TYPE} in
  660 + rpm) install_rpms ;;
  661 + deb) install_debs ;;
  662 + coreos) install_coreos ;;
  663 +esac
  664 +
  665 +if [ -n "${KERNEL}" -o -n "${XGU}" ] ; then
  666 + echo "You should now reboot this Virtual Machine."
  667 +fi
  668 +
  669 +exit 0
versions.deb View file @ 4cb9c27
... ... @@ -0,0 +1,2 @@
  1 +XE_GUEST_UTILITIES_PKG_FILE_i386='xe-guest-utilities_7.0.0-24_all.deb'
  2 +XE_GUEST_UTILITIES_PKG_FILE_amd64='xe-guest-utilities_7.0.0-24_all.deb'
versions.rpm View file @ 4cb9c27
... ... @@ -0,0 +1,2 @@
  1 +XE_GUEST_UTILITIES_PKG_FILE_i386='xe-guest-utilities-7.0.0-24.i386.rpm xe-guest-utilities-xenstore-7.0.0-24.i386.rpm'
  2 +XE_GUEST_UTILITIES_PKG_FILE_x86_64='xe-guest-utilities-7.0.0-24.x86_64.rpm xe-guest-utilities-xenstore-7.0.0-24.x86_64.rpm'
versions.tgz View file @ 4cb9c27
... ... @@ -0,0 +1,2 @@
  1 +XE_GUEST_UTILITIES_PKG_FILE_i386='xe-guest-utilities_7.0.0-24_all.tgz'
  2 +XE_GUEST_UTILITIES_PKG_FILE_amd64='xe-guest-utilities_7.0.0-24_all.tgz'

No preview for this file type

xe-guest-utilities-7.0.0-24.i386.rpm View file @ 4cb9c27

No preview for this file type

xe-guest-utilities-7.0.0-24.x86_64.rpm View file @ 4cb9c27

No preview for this file type

xe-guest-utilities-xenstore-7.0.0-24.i386.rpm View file @ 4cb9c27

No preview for this file type

xe-guest-utilities-xenstore-7.0.0-24.x86_64.rpm View file @ 4cb9c27

No preview for this file type

xe-guest-utilities_7.0.0-24_all.deb View file @ 4cb9c27

No preview for this file type

xe-guest-utilities_7.0.0-24_all.tgz View file @ 4cb9c27

No preview for this file type

xe-linux-distribution View file @ 4cb9c27
... ... @@ -0,0 +1,307 @@
  1 +#! /bin/sh
  2 +
  3 +# Copyright (C) 2009 Citrix Systems Inc.
  4 +#
  5 +# This program is free software; you can redistribute it and/or
  6 +# modify it under the terms of the GNU General Public License
  7 +# as published by the Free Software Foundation; either version 2
  8 +# of the License, or (at your option) any later version.
  9 +#
  10 +# This program is distributed in the hope that it will be useful,
  11 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13 +# GNU General Public License for more details.
  14 +#
  15 +# You should have received a copy of the GNU General Public License
  16 +# along with this program; if not, write to the Free Software
  17 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18 +
  19 +# Script to write information about the current distribution to stdout or a file.
  20 +# Information collected:
  21 +# - Distribution name
  22 +# - Distribution version (major and minor)
  23 +# - Kernel version (uname)
  24 +
  25 +LANG="C"
  26 +export LANG
  27 +
  28 +
  29 +write_to_output()
  30 +{
  31 + local distro="$1"
  32 + local major="$2"
  33 + local minor="$3"
  34 + local name="$4"
  35 + local uname=$(uname -r)
  36 +
  37 + if [ -n "${TEST_RESULT}" ] ; then
  38 + MAJOR=$major
  39 + MINOR=$minor
  40 + DISTRO=$distro
  41 + UNAME=$uname
  42 + return 0
  43 + fi
  44 +
  45 + echo "os_distro=\"${distro}\""
  46 + echo "os_majorver=\"${major}\""
  47 + echo "os_minorver=\"${minor}\""
  48 + echo "os_uname=\"${uname}\""
  49 + echo "os_name=\"${name}\""
  50 +
  51 + return 0
  52 +}
  53 +
  54 +identify_debian()
  55 +{
  56 + local debian_version="$1"
  57 + local major
  58 + local minor
  59 +
  60 + # 3.1
  61 + # 4.0
  62 + # Ignores testing and unstable which contain ".*/sid".
  63 +
  64 + if [ ! -f "${debian_version}" ] ; then
  65 + return 1
  66 + fi
  67 +
  68 + eval $(awk -F. '/^[0-9]*\.[0-9]*/ \
  69 + { print "major="$1 ; print "minor="$2 ; exit 0 }' \
  70 + "${debian_version}")
  71 +
  72 + if [ -z "${major}" ] && [ -z "${minor}" ] && ! grep -q /sid "${debian_version}" ; then
  73 + return 1
  74 + fi
  75 +
  76 + write_to_output "debian" "${major}" "${minor}" "Debian $(head -n 1 $debian_version)"
  77 +
  78 + return 0
  79 +}
  80 +
  81 +identify_redhat()
  82 +{
  83 + redhat_release="$1"
  84 + local distro
  85 + local major
  86 + local minor
  87 + local beta
  88 +
  89 + # distro=rhel
  90 + # Red Hat Enterprise Linux AS release 3 (Taroon Update 6)
  91 + # Red Hat Enterprise Linux AS release 3 (Taroon Update 8)
  92 + # Red Hat Enterprise Linux AS release 4 (Nahant)
  93 + # Red Hat Enterprise Linux AS release 4 (Nahant Update 1)
  94 + # Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
  95 + # Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
  96 + # Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
  97 + # Red Hat Enterprise Linux Server release 4.92 (Tikanga)
  98 + # Red Hat Enterprise Linux Server release 5 (Tikanga)
  99 + # Red Hat Enterprise Linux Server release 5.1 Beta (Tikanga)
  100 + # Red Hat Enterprise Linux release 6.0 Beta (Santiago)
  101 +
  102 + # distro=xe-ddk
  103 + # \@PRODUCT_BRAND\@ DDK release \@PRODUCT_VERSION\@-\@BUILD_NUMBER\@ (\@PRODUCT_NAME\@)
  104 + # Rio DDK release 0.5.6-2991c (xenenterprise)
  105 +
  106 + # distro=xe-sdk
  107 + # \@PRODUCT_BRAND\@ SDK release \@PRODUCT_VERSION\@-\@BUILD_NUMBER\@ (\@PRODUCT_NAME\@)
  108 + # Rio SDK release 0.5.6-2991c (xenenterprise)
  109 +
  110 + # distro=fedora
  111 + # Fedora Core release 3 (Heidelberg)
  112 +
  113 + # distro=centos
  114 + # CentOS release 4.0 (Final)
  115 + # CentOS release 5 (Final)
  116 + # CentOS Linux release 7.0.1406 (Core)
  117 +
  118 + # distro=scientific
  119 + # Scientific Linux release 6.5 (Carbon)
  120 +
  121 + # distro=oracle
  122 + # Enterprise Linux Enterprise Linux Server release 5 (Carthage)
  123 + # Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
  124 + # Oracle Linux Server release 5.6
  125 +
  126 + if [ ! -f "${redhat_release}" ] ; then
  127 + return 1
  128 + fi
  129 +
  130 + eval $(sed -n \
  131 + -e 's/^\(.*\) DDK release \(.*\)-\(.*\) (.*)$/distro=xe-ddk;major=\2;minor=\3/gp;' \
  132 + -e 's/^\(.*\) SDK release \(.*\)-\(.*\) (.*)$/distro=xe-sdk;major=\2;minor=\3/gp;' \
  133 + -e 's/^Red Hat Enterprise Linux.* release \([0-9]*\) (.* Update \(.*\))$/distro=rhel;major=\1;minor=\2/gp;'\
  134 + -e 's/^Red Hat Enterprise Linux.* release \([0-9]*\) (.*)$/distro=rhel;major=\1/gp;' \
  135 + -e 's/^Red Hat Enterprise Linux.* release \([0-9]*\)\.\([0-9]*\) \([Bb]eta \)\?(.*)$/distro=rhel;major=\1;minor=\2;beta=\3;/gp;' \
  136 + -e 's/^Fedora.*release \([0-9]*\) (.*)$/distro=fedora;major=\1/gp;' \
  137 + -e 's/^CentOS release \([0-9]*\)\.\([0-9]*\) (.*)/distro=centos;major=\1;minor=\2/gp;' \
  138 + -e 's/^CentOS release \([0-9]*\) (.*)/distro=centos;major=\1/gp;' \
  139 + -e 's/^CentOS Linux release \([0-9]*\)\.\([0-9]*\)\(\.[0-9]*\)\? (.*)/distro=centos;major=\1;minor=\2/gp;' \
  140 + -e 's/^Enterprise Linux Enterprise Linux .* release \([0-9]*\)\.\([0-9]*\) (.*)$/distro=oracle;major=\1;minor=\2;/gp;' \
  141 + -e 's/^Enterprise Linux Enterprise Linux .* release \([0-9]*\) (.*)$/distro=oracle;major=\1/gp;' \
  142 + -e 's/^Oracle Linux Server release \([0-9]*\)\.\([0-9]*\)$/distro=oracle;major=\1;minor=\2/gp;' \
  143 + -e 's/^Scientific Linux SL release \([0-9]*\)\.\([0-9]*\) (.*)$/distro=scientific;major=\1;minor=\2;/gp;' \
  144 + -e 's/^Scientific Linux release \([0-9]*\)\.\([0-9]*\) (.*)$/distro=scientific;major=\1;minor=\2;/gp;' \
  145 + "${redhat_release}")
  146 +
  147 + if [ -z "${major}" -o -z "${distro}" ] ; then
  148 + return 1
  149 + fi
  150 +
  151 + if [ -z "${minor}" ] ; then
  152 + minor=0
  153 + fi
  154 +
  155 + # HACK to handle RHEL betas
  156 + if [ "${distro}" == "rhel" ] && [ ${minor} -gt 90 ] ; then
  157 + major=$(expr ${major} + 1 )
  158 + minor=0
  159 + beta=Beta
  160 + fi
  161 +
  162 + if [ -n "${beta}" ] ; then
  163 + minor="${minor}beta"
  164 + fi
  165 +
  166 + write_to_output "${distro}" "${major}" "${minor}" "$(head -n 1 ${redhat_release})"
  167 +
  168 +}
  169 +
  170 +identify_sles()
  171 +{
  172 + suse_release="$1"
  173 + local major
  174 + local minor
  175 + local _major
  176 +
  177 + # SUSE LINUX Enterprise Server 9 (i586)
  178 + # VERSION = 9
  179 + #
  180 + # SUSE LINUX Enterprise Server 9 (i586)
  181 + # VERSION = 9
  182 + # PATCHLEVEL = 2
  183 + #
  184 + # SUSE LINUX Enterprise Server 9 (i586)
  185 + # VERSION = 9
  186 + # PATCHLEVEL = 3
  187 + #
  188 + # SUSE Linux Enterprise Server 10 (i586)
  189 + # VERSION = 10
  190 + #
  191 + # SUSE Linux Enterprise Server 10 (i586)
  192 + # VERSION = 10
  193 + # PATCHLEVEL = 1
  194 + #
  195 + # SUSE Linux Enterprise Server 11 (i586)
  196 + # VERSION = 11
  197 + # PATCHLEVEL = 0
  198 +
  199 + if [ ! -f "${suse_release}" ] ; then
  200 + return 1
  201 + fi
  202 +
  203 + eval $(sed -n \
  204 + -e 's/^SUSE L\(inux\|INUX\) Enterprise \([a-zA-Z0-9_]*\) \([0-9]*\) (.*)/_major=\3;/gp;' \
  205 + -e 's/^VERSION = \([0-9]*\)$/major=\1;/gp;' \
  206 + -e 's/^PATCHLEVEL = \([0-9]*\)$/minor=\1;/gp;' \
  207 + "${suse_release}")
  208 +
  209 + if [ -z "${major}" -o -z "${_major}" ] ; then
  210 + return 1
  211 + fi
  212 +
  213 + if [ "${major}" != "${_major}" ] ; then
  214 + return 1
  215 + fi
  216 +
  217 + if [ -z "${minor}" ] ; then
  218 + minor=0
  219 + fi
  220 +
  221 + write_to_output "sles" "${major}" "${minor}" "$(head -n 1 ${suse_release})"
  222 +
  223 +}
  224 +
  225 +identify_lsb()
  226 +{
  227 + lsb_release="$1"
  228 +
  229 + if [ ! -x "${lsb_release}" ] ; then
  230 + saved_IFS=$IFS
  231 + IFS=:
  232 + for i in $PATH ; do
  233 + if [ -x "${i}/${lsb_release}" ] ; then
  234 + lsb_release="${i}/${lsb_release}"
  235 + break
  236 + fi
  237 + done
  238 + IFS=$saved_IFS
  239 + fi
  240 +
  241 + if [ -x "${lsb_release}" ] ; then
  242 + distro=$(${lsb_release} --short --id | tr 'A-Z' 'a-z')
  243 + description=$(${lsb_release} --short --description | sed -e 's/^"\(.*\)"$/\1/g')
  244 + release=$(${lsb_release} --short --release)
  245 + else
  246 + if [ -f /etc/lsb-release ] ; then
  247 + source /etc/lsb-release
  248 + distro="$DISTRIB_ID"
  249 + description="$DISTRIB_DESCRIPTION"
  250 + release="$DISTRIB_RELEASE"
  251 + else
  252 + return 1
  253 + fi
  254 + fi
  255 +
  256 + if [ -z "${distro}" -o -z "${release}" ] ; then
  257 + return 1
  258 + fi
  259 +
  260 + eval $(echo $release | awk -F. -- '{ subindex = index($0,"."); \
  261 + print "major=" $1 ; \
  262 + print "minor=" substr($0,subindex+1) }')
  263 +
  264 + if [ -z "${major}" -o -z "${distro}" ] ; then
  265 + return 1
  266 + fi
  267 +
  268 + write_to_output "${distro}" "${major}" "${minor}" "${description}"
  269 +}
  270 +
  271 +identify_boot2docker()
  272 +{
  273 + boot2docker_release="$1"
  274 + local major
  275 + local minor
  276 +
  277 + if [ ! -f "${boot2docker_release}" ] ; then
  278 + return 1
  279 + fi
  280 +
  281 + major=$(awk -F. '{printf("%s", $1)}' /etc/version)
  282 + minor=$(awk -F. '{printf("%s.%s", $2, $3)}' /etc/version)
  283 +
  284 + write_to_output "boot2docker" "${major}" "${minor}" "boot2docker $(head -n 1 /etc/version)"
  285 +
  286 +}
  287 +
  288 +if [ $# -eq 1 ] ; then
  289 + exec 1>"$1"
  290 +fi
  291 +
  292 +if [ -z "${TEST}" ] ; then
  293 + identify_redhat /etc/oracle-release && exit 0
  294 + identify_redhat /etc/enterprise-release && exit 0
  295 + identify_redhat /etc/centos-release && exit 0
  296 + identify_redhat /etc/redhat-release && exit 0
  297 + identify_sles /etc/SuSE-release && exit 0
  298 + identify_lsb lsb_release && exit 0
  299 + identify_debian /etc/debian_version && exit 0
  300 + identify_boot2docker /etc/boot2docker && exit 0
  301 +
  302 + if [ $# -eq 1 ] ; then
  303 + rm -f "$1"
  304 + fi
  305 +
  306 + exit 1
  307 +fi
xe-linux-distribution.service View file @ 4cb9c27
... ... @@ -0,0 +1,9 @@
  1 +[Unit]
  2 +Description=Linux Guest Agent
  3 +
  4 +[Service]
  5 +ExecStartPre=/usr/share/oem/xs/xe-linux-distribution /var/cache/xe-linux-distribution
  6 +ExecStart=/usr/share/oem/xs/xe-daemon
  7 +
  8 +[Install]
  9 +WantedBy=multi-user.target
0 10 \ No newline at end of file
xen-vcpu-hotplug.rules View file @ 4cb9c27
... ... @@ -0,0 +1 @@
  1 +ACTION=="add", SUBSYSTEM=="cpu", RUN+="/bin/sh -c '[ ! -e /sys$devpath/online ] || echo 1 > /sys$devpath/online'"