From 4e341cf48acb2666d5eda7f11e09882892d5c352 Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Thu, 2 Feb 2017 14:33:28 -0600 Subject: [PATCH] Add downgrade kernel script The ubuntu release always comes with the lastest kernel, this script will save sometime to do the downgrade kernel for you, actually it not only downgrade kernel, you can specify any kernel you want to put on the image. Change-Id: I8639ca4a8c0cfa28db8a7faa6587510f44e27303 --- multi-node-aio/tools/downgrade-all-VMs.sh | 15 +++++++++++++++ multi-node-aio/tools/ubuntu-kernel-downgrade.sh | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 multi-node-aio/tools/downgrade-all-VMs.sh create mode 100755 multi-node-aio/tools/ubuntu-kernel-downgrade.sh diff --git a/multi-node-aio/tools/downgrade-all-VMs.sh b/multi-node-aio/tools/downgrade-all-VMs.sh new file mode 100644 index 00000000..07920a71 --- /dev/null +++ b/multi-node-aio/tools/downgrade-all-VMs.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +#eg. KERNEL_VERSION="3.13.0-98" +KERNEL_VERSION=${KERNEL_VERSION:-false} + +if [[ "${KERNEL_VERSION}" = false ]]; then + echo "Please setup the KERNEL_VERSION before running this script" + exit 1 +fi + +pushd .. +source functions.rc +for node in $(get_all_hosts); do + ssh -q -t -o StrictHostKeyChecking=no 10.0.0.${node#*":"} KERNEL_VERSION="${KERNEL_VERSION}" 'bash -s' < tools/ubuntu-downgrade.sh +done diff --git a/multi-node-aio/tools/ubuntu-kernel-downgrade.sh b/multi-node-aio/tools/ubuntu-kernel-downgrade.sh new file mode 100755 index 00000000..95f12875 --- /dev/null +++ b/multi-node-aio/tools/ubuntu-kernel-downgrade.sh @@ -0,0 +1,16 @@ +#!/bin/sh +#eg. KERNEL_VERSION="3.13.0-98" +KERNEL_VERSION=${KERNEL_VERSION:-false} + +if [[ "${KERNEL_VERSION}" = false ]]; then + echo "Please setup the KERNEL_VERSION before running this script" + exit 1 +fi + +sudo apt-get update +sudo aptitude install -y linux-image-${KERNEL_VERSION}-generic \ + linux-headers-${KERNEL_VERSION} linux-image-extra-${KERNEL_VERSION}-generic + +sudo sed -i "s/GRUB_DEFAULT=.*/GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${KERNEL_VERSION}-generic\"/" /etc/default/grub +sudo update-grub +sudo reboot