DOCKER-01 unattended upgrade of the CentOS 6.x system core to 3.10.101

Source: Internet
Author: User

1#!/bin/Bash2 3 #4# Unattended Upgrade CentOS6. x System Kernel to3.10.1015 #6# Full Reference https://segmentfault.com/a/11900000007336287 #8 9 Ten # One#1, check if the operating system is CentOS6. x A # -  - Cat/etc/centos-release |grep-I CentOS |Egrep '6.[[:d igit:]]+'&>/dev.NULL the if[[ $? !=0 ]] -  Then -     Echo-E"Unsupported operating system, this script is only available for CentOS 6.x operating system" -Exit1 + fi -  + # A#2, check that the current kernel version meets the requirements for installing Docker: at # If the direct exit script is satisfied, the system kernel will be upgraded automatically if not met - # -  - if[[ $(uname-r |awk-F'.' '{print $}')-ge3 ]] -  Then -     if[[ $(uname-r |awk-F'.' '{print $}')-geTen ]] in      Then -         Echo "the operating system kernel version has met the requirements of installing Docker without upgrading" toExit1 +     fi - fi the  * # $#3, check if the YUM source is availablePanax Notoginseng # -          the YumList &>/dev/NULL +  A if[[ $? !=0 ]] the  Then +     Echo "YUM Source Configuration error" -Exit1 $ fi $  - # -#4, install package groups"Development Tools" the # - Wuyi YumGroupinstall-y"Development Tools"  the  - if[[ $? !=0 ]] Wu  Then -     Echo "YUM failed to install development tools" AboutExit1 $ fi -  - # -#5, install and compile the Linux kernel in addition to"Development Tools"other packages other than the A # +  the Yum Install-YwgetNcurses-devel Hmaccalc zlib-devel binutils-devel elfutils-libelf-devel -  $ if[[ $? !=0 ]] the  Then the     Echo "YUM failed to install development tools" theExit1 the fi -  in # the#6, download the Linux kernel file3.10.101, and unzip to/usr/src/directory under the # About  the#wgetHttps//Cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.10.101.tar.xz the wgethttp//Mirrors.aliyun.com/linux-kernel/v3.x/linux-3.10.101.tar.xz the Tar-XF linux-3.10.101.Tar. xz-c/usr/src + if[[!-d/usr/src/linux-3.10.101/ ]] -  Then the     Echo "Linux kernel file 3.10.101 download failed"BayiExit1 the fi the  - # -#7To build a new compilation option based on the original kernel configuration file the # the  thecd/usr/src/linux-3.10.101/ the CP/boot/config-$ (uname-r). config - SH-C'Yes "" | Make Oldconfig' the  the # the#8, start compiling the Linux kernel3.10.10194 # Generate kernel files the # Compile the module the # Compile the installation module the #98  Aboutcd/usr/src/linux-3.10.101/ - 101  Make-j$ (Cat/proc/cpuinfo |grepProcessor |WC-l) Bzimage102 103 if[[ $? !=0 ]]104  Then the     Echo "failed to generate kernel file"106Exit1107 fi108 109  Make-j$ (Cat/proc/cpuinfo |grepProcessor |WC-l) Modules the 111 if[[ $? !=0 ]] the  Then113     Echo "failed to compile module" theExit1 the fi the 117  Make-j$ (Cat/proc/cpuinfo |grepProcessor |WC-l) Modules_install118 119 if[[ $? !=0 ]] -  Then121     Echo "failed to compile the installation module"122Exit1123 fi124  the #126#9, install the Linux kernel3.10.101127 # - 129cd/usr/src/linux-3.10.101/ the  Make Install131  the #133#Ten, configure GRUB, load the new kernel the next time you start134 #135 136 sed-I.'s/default=1/default=0/'/etc/grub.conf137 sed-I.'s/default=1/default=0/'/boot/grub/grub.conf138 Echo-en"\n\t"139Read-p"Restart the operating system now, load the kernel 3.10.101 [y/n]"Rebootnow $ if[[$rebootnow = =y]]141  Then142 reboot143 Else144     Echo-E"\n\t Manually reboot the operating system later to load the kernel 3.10.101\n"145 fi

DOCKER-01 unattended upgrade of the CentOS 6.x system core to 3.10.101

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.