Kickstart的高级应用
来源:互联网 发布:上海贝格数据怎么样 编辑:程序博客网 时间:2024/05/22 10:43
这是我读文档随手写下的,基本是翻译了Oreilly文档的一部分。
原文:http://www.linuxdevcenter.com/pub/a/linux/2004/11/04/advanced_kickstart.html
Pre- 和Postinstall脚本
kickstart本身提供了一些对系统的基本调整和设置,例如设置root密码,设置时区等等。但是它不能做某些更细致的调整,比如通过chkconfig禁止某些服务,建立特定的目录等等。因此,我们需要使用pre-和postinstall脚本来完成这些任务。很明显的,从名字就可以看出这两种脚本执行的时机,pre-在安装进行之前执行,而post脚本则在整个安装过程完成以后执行。preinstall和postinstall脚本都在ks文件的末尾定义。
preinstall脚本用 %pre指示开头,脚本使用的语法和RPMspec文件中的类似。在安装之前这个阶段,preinstall脚本只能做一些基本的操作,比如查找一些文件或者挂载NFS共享等等。
postintall脚本则更有潜力,postinstall脚本用 %post指示开头。当OS安装已经完成以后,postinstall脚本默认是在新安装好的系统上执行,新安装好的系统这个时候处于chroot环境,根目录其实是在/mnt/sysimage下。
可以使用%post –nochroot 来执行一些非chroot环境下的命令。比如在chroot环境下,你是无法访问光驱中的安装光盘的,因为光盘挂载在/tmp/cdrom,它是处于non-chroot环境下的。
一般来说postinstall脚本以#!/bin/sh这样的自定义shell作为第一行,然后下边就是普通的shell脚本了。这样基本上你想做什么都可以了。
--------------------------------------------------
(complex) partitioning inkickstart
http://www.dark.ca/2009/08/03/complex-partitioning-in-kickstart/
Bonjour my geeky friends !:) As you are likely aware, it is now summer-timehere in the northern hemisphere, and thus, i’ve been spending asmuch time away from the computer as possible. That said, it’s been a long time, i shouldn’t have left you,without a strong beat to step to.
Now, if you’re not familiar with kickstarting, it’s basically justa way to automate the installation of an operating environment on amachine – think hands-free installation. Anacondais the OS installation tool used in Fedora, RedHat, and some otherLinux OS’s, and it can be used in a kickstartcapacity. For those of you looking for an intro,i heavily suggest reading over the excellent documentation at theFedora project website. The kickstartconfiguration process could very easily be a couple of blog entrieson its own (which i’ll no doubt get around to in the future), butfor now i want to touch on one particular aspect of it : complexpartition schemes.
how it is
The current method for declaring partitions is relatively powerful,in that all manner of basic partitions, LVM components, and evenRAID devices can be specified – but where it fails is in thecreating of the actual partitions on the diskitself. The options that can be supplied to thepartition keywords can make this clunky at best (and impossible atworst).
A basic example of a partitioning scheme that requires nothingoutside of the available functions :
DEVICE MOUNTPOINT SIZE
/dev/sda (total) 500,000 MB
/dev/sda1 /boot/ 128 MB
/dev/sda2 / 20,000 MB
/dev/sda3 /var/log/ 20,000 MB
/dev/sda5 /home/ 400,000 MB
/dev/sda6 /opt/ 51,680 MB
/dev/sda7 swap