1.格式化分区: swap,linux(ext3、ext2、jfs、xfs、reiserfs),fat format_partition.sh 输入: stdin 1)partition:分区 2)filesystem:文件系统类型 输出: success: @ format $devname success 返回值: 1 argument error 2 deivce node doesn't exist 3 filesystem no implement 127 format partition utils not found Usage: 单个处理: echo "/dev/sda1 ext2" | ./format_partition.sh 批量处理:文件格式和单个处理一致 说明:需要处理swap分区。 2.挂载分区 mount_partition.sh 输入: stdin 1)partition:块设备 2)mountpoint:挂载点 3)filesystem:文件系统类型 4)filsystem options:文件系统选项 (这个为可选参数,不传这个参数会有默认的选项:文件系统是ext2|ext3|reiserfs,会以acl的选项挂载,其他则为defaults) 输出: success: @ mount $devname success 返回值: 1 argument error 2 device node doesn't exist 32 mount failure Usage: 单个处理:echo "/dev/sda1 / ext3" |./mount_partition.sh 批量处理:文件格式和单个处理一致 说明:不处理swap分区。 3.安装软件包:install_pkg.sh 输入: stdin 1. pkgname argument: [--help] show usage [-s|--source] package source directory, if not specify, default is /Rocky/packages. 输出: sucess: @ install $pkgname success. 返回值: 1 argument error 2 source directory $PKG_SOURCE_DIR doesn't exist 3 pkgname doesn't exist in source directory Usage: 单个处理:echo "acl" |./install_pkg.sh -s /Rocky/packages 批量处理:文件格式和单个处理一致 说明: 1.由安装程序生成/var/lib/pkg/db的空文件; 2.默认用/Rocky/packages下面的软件包,如果不指定-s参数。 4.配置、生成系统文件: 配置fstab,configure_fstab.sh 输入: stdin 1)block devices:块设备 2)mount point:挂载点 3)filesystem type:文件系统类型 以下参数为可选参数,如果不指定,会有默认的配置,如果指定5)那么4)也需要指定,依次类推 4)fs_mntops: ext2|ext3|reiserfs的默认配置是acl,其他都是defaults。 5)fs_freq:默认配置:swap是0,其他都是1 6)fs_passno:默认配置:swap是0,其他都是1 输出: 无 返回值: 1 argument error 2 fstab doesn't exist Usage: 单个处理:echo "/dev/hda2 /home ext3"|./configure_fstab.sh 批量处理:文件格式和单个处理一致 说明: 1.从2012年10月12日开始swap也使用UUID,因为修复bug# 822已经可以把swap的UUID生成出来, 而不能识别UUID的设备文件,还是用原来的设备文件名。 生成issue文件 generate_issue.sh 输入: argument: [--help] show usage [-v|--version] version of OS [-a|--arch] architecture of OS [-r|--release] release of OS(base or security) [-d|--date] date of generate OS 输出: 无 返回值: 1 argument error 说明: 1.生成$TARGET/etc/issue文件,一般TARGET=/mnt; 2.可以只给一个参数,但是这样其他参数则为空值。 配置网络: configure_network.sh 输入: argument: <-t|--type> "static" or "dynamic" static argument: <-h|--hostname> hostname <-i|--ip> ip address <-n|--netmask> netmask <-g|--gateway> gateway <-d|--domainname> domainname [-p|--pdns] priamaryDNS [-s|--sdns] secondaryDNS [-e|--device] network device. if no configure, default is eth0. dynamic argument: <-h|--hostname> hostname [-e|--device] network device. if no configure, default is eth0. 输出: 无 返回值: 1 argument error 2 ip/netmask/gateway address incorrect 3 hosts/resolv.conf/ifcfg-eth0/network doesn't exist Usage: ./configure_network.sh -t static -h QinBo -d in.linx -i 192.168.1.110 -n 255.255.255.0 -g 192.168.1.254 -p 172.16.0.254 说明: 1.type必须为static或者dynamic; 2.不管哪种type,hostname是必须的; 3.type=static的时候IP、域名、子网掩码、网关是必须的; 4.device:多网卡的时候,可以指定用哪个网卡,默认用的是eth0。 做自启服务: mk_serv_autoboot.sh 输入: stdin 1)package name:软件包名字(自启动服务所在软件包) 2)boot script:启动脚本 3)boot service:需要启动的服务 4)boot number:启动号 输出: 无 返回值: 1:argument error 2:boot script doesn't exist Usage: 单个处理:echo "netkit-base inetd rsh S310"|./mk_serv_autoboot.sh 批量处理:文件格式和单个处理一致 说明: 默认在/etc/rc.d/{rc3.d,rc5.d}建立链接。 5.拷贝kernel、modules和生成initrd copy_kernels.sh 输入: 无 输出: 无 返回值: 1 kernel directory/modules directory/initrd.gz/makeinitrd doesn't exist 说明: 1.此脚本从 /Rocky/kernels和/Rocky/modules目录下拷贝kernel和modules, 2.把/Rocky/initrd/initrd.gz,拷贝到硬盘上的/boot/initrd.gz.old, 3.生成initrd调用原来的makeinitrd脚本生成。 6.生成bootloader对应的配置文件,安装bootloader configure_bootloader_cnf.sh 配置bootloader配置文件 输入: arguments: [--help] show this message <-t|--type> boot loader type:grub,etc. <-r|--root> partition mount by root [-b|--boot] partition mount by boot (optional,if the boot is not mount by stand alone) [-k|--kparameter] kernel parameter [-o|--osversion] OS version 输出: 无 返回值: 1 argument error 2 bootloader type doesn't specify 3 bootloader no implement 4 bootloader configuration file doesn't exist 说明: grub:对grub软件包里面的grub.conf.sample($TARGET/boot/grub/)进行相应的修改, 产生新的文件:$TARGET/boot/grub/menu.lst install_bootloader.sh 安装bootloader 输入: arguments: [--help] show this message <-t|--type> boot loader type:grub,etc. 输出: 无 返回值: 1 argument error 2 bootloader type doesn't specify 3 bootloader no implement 127 bootloader utils not found 说明: 此脚本把grub装在第一块硬盘上面,因为bios默认会从第一块硬盘启动, 这样bios就能找到我们的装上去的gurb,从而正确引导系统。 7.安装完成执行的脚本 exec_finish_install.sh 输入:无 输出:无 返回值: 根据具体执行脚本的返回值来确定,0是成功 Usage: exec_finish_install.sh按照次序依次执行/usr/lib/new_install/operation/finish_install目录下的可执行脚本 99finish_install.sh 原来的firstboot.sh