本文对OpenSolaris Text Installer CD做了一些小的修改,修改的过程其实就是定制的过程。
function clear-lofi
{
typeset lofi lofis
lofis=$(lofiadm | awk '/\/dev\/lofi/{print $1}')
for lofi in $lofis; do
lofiadm -d $lofi
done
}
function set-kbd-lang
{
gsed -i -e 's/kbd -s/& US-English/' \
-e 's/set_lang/& default/' \
$1/lib/svc/method/media-fs-root
}
function create-x86-iso
{
set -x
typeset iso_file=/export/home/mishuang/software/iso/text-install-2010-02-15-02:43:11.iso
typeset iso_new_file=$(dirname $iso_file)/new-$(basename $iso_file)
typeset iso_mnt_dir=/mnt/osol
typeset iso_tmp_dir=/var/tmp/osol
typeset ba_mnt_dir=/mnt/boot_archive
typeset ba_file=/var/tmp/boot_archive
typeset CP='/usr/bin/cp -f'
typeset RM='/usr/bin/rm -rf'
typeset iso_lofi ba_lofi dir
umount $iso_mnt_dir
umount $ba_mnt_dir
clear-lofi
$RM $iso_tmp_dir $ba_file
mkdir -p $iso_mnt_dir $iso_tmp_dir $ba_mnt_dir
iso_lofi=$(lofiadm -a $iso_file)
mount -F hsfs $iso_lofi $iso_mnt_dir
cd $iso_mnt_dir
find . -depth -print | cpio -pdum $iso_tmp_dir
cd -
for dir in "" "amd64"; do
gzip -cd $iso_tmp_dir/platform/i86pc/$dir/boot_archive > $ba_file
ba_lofi=$(lofiadm -a $ba_file)
sleep 5
mount $ba_lofi $ba_mnt_dir
$CP /export/home/mishuang/bin/osol.sh $ba_mnt_dir/root
set-kbd-lang $ba_mnt_dir
sleep 5
umount $ba_mnt_dir
gzip -c $ba_file > $iso_tmp_dir/platform/i86pc/$dir/boot_archive
sleep 5
lofiadm -d $ba_lofi
done
mkisofs -o $iso_new_file \
-b boot/grub/stage2_eltorito \
-c .catalog \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-N -l -R -U -allow-multidot \
-no-iso-translate \
-cache-inodes -d -D \
-V "OpenSolaris" \
$iso_tmp_dir
umount $iso_mnt_dir
lofiadm -d $iso_lofi
$RM $iso_tmp_dir $ba_file
set +x
}
function create-sparc-iso
{
set -x
typeset iso_file=/ldom/iso/text-install-2010-02-07-22:29:13.iso
typeset iso_new_file=$(dirname $iso_file)/new-$(basename $iso_file)
typeset iso_mnt_dir=/mnt/osol
typeset iso_tmp_dir=/var/tmp/osol
typeset ba_mnt_dir=/mnt/boot_archive
typeset ba_file=/var/tmp/boot_archive
typeset CP='/usr/bin/cp -f'
typeset RM='/usr/bin/rm -rf'
typeset iso_lofi ba_lofi
umount $iso_mnt_dir
umount $ba_mnt_dir
clear-lofi
$RM $iso_tmp_dir $ba_file
mkdir -p $iso_mnt_dir $iso_tmp_dir $ba_mnt_dir
iso_lofi=$(lofiadm -a $iso_file)
mount -F hsfs $iso_lofi $iso_mnt_dir
cd $iso_mnt_dir
find . -depth -print | cpio -pdum $iso_tmp_dir
cd -
$CP $iso_tmp_dir/platform/sun4u/$dir/boot_archive $ba_file
ba_lofi=$(lofiadm -a $ba_file)
sleep 5
mount $ba_lofi $ba_mnt_dir
$CP /export/home/mishuang/bin/osol.sh $ba_mnt_dir/root
set-kbd-lang $ba_mnt_dir
sleep 5
umount -f $ba_mnt_dir
sleep 5
lofiadm -d $ba_lofi
$CP $ba_file $iso_tmp_dir/platform/sun4u/boot_archive
/usr/bin/mkisofs -N -D -R -d -l -J \
-G $iso_tmp_dir/boot/hsfs.bootblock \
-B ... \
-graft-points \
-relaxed-filenames \
-V "OpenSolaris" \
-o $iso_new_file \
$iso_tmp_dir
umount $iso_mnt_dir
lofiadm -d $iso_lofi
set +x
}
/export/home/mishuang/bin/osol.sh文件内容如下:
#!/bin/bash
NIC=${1:-e1000g0}
IP=${2:-10.13.26.129}
ROUTER=$(echo $IP | awk -F. '{printf "%d.%d.%d.%d", $1, $2, $3, 254}')
function enable-rsh
{
echo "+ +" > /root/.rhosts
svcadm enable rlogin
gsed -i '/CONSOLE/d' /etc/default/login
}
function enable-nic
{
svcadm disable nwam
sleep 5
svcadm enable physical:default
sleep 5
ifconfig $NIC $IP/24 up
route add default $ROUTER
sleep 5
}
function enable-nis
{
echo "10.13.32.48 bounty" >> /etc/hosts
domainname opg.PRC.Sun.COM
/bin/cp -f /etc/nsswitch.nis /etc/nsswitch.conf
ypinit -c << EOF
bounty
y
EOF
/usr/lib/netsvc/yp/ypstart
svcadm enable nis/client
svcadm enable autofs
}
function enable-swap
{
typeset disk=$(format < /dev/null | awk '/0\./{print $2}')
# fdisk -B /dev/rdsk/$disk
zpool create -f textui $disk
zfs create -V 4G textui/swap
swap -a /dev/zvol/dsk/textui/swap
disk=$(format < /dev/null | awk '/1\./{print $2}')
echo "Use $disk for test."
}
enable-rsh
enable-nic
enable-nis
enable-swap
server=springboat
[ "$(uname -p)" == "sparc" ] && server=springtrain
export TET_ROOT=/net/$server/opt/SUNWstc-tetlite
export CTI_ROOT=$TET_ROOT/contrib/ctitools
export PATH=$PATH:$CTI_ROOT/bin
export TET_SUITE_ROOT=/net/$server/export/home/sm207740/textui-ws/usr/closed/suites/install
阅读(1193) | 评论(0) | 转发(0) |