• centos自动安装镜像脚本


    #!/bin/bash
    ###########################################################################################################################author:wen.lu
    #email:
    ##########################################################################################################################
    ####parameters: Cdrom_name_dir   Ks_name_dir  Tmp_dir Mount_dir
    
    auto_cd()
    {
           Cdrom_name_dir=/home/remotecard/RHEL6.4_X86_64_AutoInstall_DVD_`date +'%Y%m%d'`.iso
           Source_file=/home/remotecard/rhel-server-6.4-x86_64-dvd.iso
           Ks_name_dir=ks.cfg
           Tmp_dir=/tmp/rhel6.4
           Label=RHEL6.4_X86_64_AutoInstall_DVD
           Mount_dir=/mnt
           if [ -d ${Tmp_dir} ]
           then
                   echo " Tmp_dir is exits"
           else
                   mkdir ${Tmp_dir} &> /dev/null
           fi
           mount ${Source_file} -o loop ${Mount_dir} &> /dev/null
           cp -a ${Mount_dir}/. ${Tmp_dir}
    ###create file isolinux.cfg
           mv ${Tmp_dir}/isolinux/isolinux.cfg /isolinux.cfg.bak &> /dev/null
    cat << EOF >> ${Tmp_dir}/isolinux/isolinux.cfg
    default install
    prompt 1
    #timeout 600
    timeout 30
    
    display boot.msg
    F1 boot.msg
    F2 options.msg
    F3 general.msg
    F4 param.msg
    F5 rescue.msg
    label install                                
     kernel vmlinuz
     append ks=cdrom:/ks.cfg initrd=initrd.img
    label linux
     menu label ^Install or upgrade an existing system
     menu default
     kernel vmlinuz
     append initrd=initrd.img
    label vesa
     menu label Install system with ^basic video driver
     kernel vmlinuz
     append initrd=initrd.img xdriver=vesa nomodeset
    label rescue
     menu label ^Rescue installed system
     kernel vmlinuz
     append initrd=initrd.img rescue
    label local
     menu label Boot from ^local drive
     localboot 0xffff
    label memtest86
     menu label ^Memory test
     kernel memtest
     append -
    EOF
           umount ${Mount_dir}
           cp ${Ks_name_dir} ${Tmp_dir}
           cd ${Tmp_dir}
           find -type f -name "TRANS.TBL" |xargs rm -f
           rm -rf isolinux/boot.cat
           chmod +w isolinux/* &> /dev/null
    ###create iso file
           mkisofs -o ${Cdrom_name_dir} -J -r -v
           -b isolinux/isolinux.bin
           -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table
           -V "$Label" .
           implantisomd5 --force ${Cdrom_name_dir} &>/dev/null
           if (( $? == 0 ))
           then
                   rm -rf ${Tmp_dir}
                   echo "cdrom is ok"
           else
                   rm -rf ${Tmp_dir}
                   echo "cdrom is wrong"
           fi
    }
    auto_cd
  • 相关阅读:
    cf605 div3
    how to find Longest Increasing Subsequence Size
    luogu1641 [SDOI2010]生成字符串
    luogu1441 砝码称重
    luogu4218 [JSOI2008] 最小生成树计数
    luogu1514 引水入城
    luogu1312 Mayan游戏 剪枝
    luogu1081 开车旅行 树上倍增
    luogu1052 过河
    luogu1026 统计单词个数
  • 原文地址:https://www.cnblogs.com/mikeluwen/p/7068370.html
Copyright © 2020-2023  润新知