==statelite mode is supported for SLES11==
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5043 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
cf44c5efc5
commit
a8427de69b
@ -46,6 +46,8 @@ my $srcdir_otherpkgs;
|
||||
my $otherpkglist;
|
||||
my $postinstall_filename;
|
||||
my $rootimg_dir;
|
||||
my $rwfiles; #these files are used by statelite for tmpfs rw
|
||||
my $mode;
|
||||
|
||||
sub xdie {
|
||||
system("rm -rf /tmp/xcatinitrd.$$");
|
||||
@ -77,7 +79,8 @@ GetOptions(
|
||||
'r=s' => \$othernics,
|
||||
'l=s' => \$rootlimit,
|
||||
't=s' => \$tmplimit,
|
||||
'k=s' => \$kernelver
|
||||
'k=s' => \$kernelver,
|
||||
'm=s' => \$mode #provide options for the mode of "genimage"
|
||||
);
|
||||
if (@ARGV > 0) {
|
||||
$imagename=$ARGV[0];
|
||||
@ -183,11 +186,12 @@ unless ($kernelver) {
|
||||
}
|
||||
chomp($kernelver);
|
||||
unless ($osver and $profile and $netdriver and $prinic) {
|
||||
print 'Usage: genimage -i <nodebootif> -n <nodenetdrivers> [-r <otherifaces>] -k <KERNELVER> -o <OSVER> -p <PROFILE> -a <ARCH>'."\n";
|
||||
print 'Usage: genimage -i <nodebootif> -n <nodenetdrivers> [-r <otherifaces>] -k <KERNELVER> -o <OSVER> -p <PROFILE> -a <ARCH> -m <mode>'."\n";
|
||||
print ' genimage -i <nodebootif> -n <nodenetdrivers> [-r <otherifaces>] -k <KERNELVER> <imagename>'."\n";
|
||||
print "Examples:\n";
|
||||
print " genimage -i eth0 -n tg3 -o centos5.1 -p compute\n";
|
||||
print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute\n";
|
||||
print " genimage -i eth0 -n tg3,bnx2 -o centos5.1 -p compute -p nfsroot -m statelite\n";
|
||||
print " genimage -i eth0 -ntg3 myimagename\n";
|
||||
exit 1;
|
||||
}
|
||||
@ -205,6 +209,16 @@ unless (grep /af_packet/,@ndrivers) {
|
||||
unshift(@ndrivers,"af_packet.ko");
|
||||
}
|
||||
|
||||
if($mode eq "statelite") {
|
||||
push @ndrivers, "sunrpc.ko";
|
||||
push @ndrivers, "lockd.ko";
|
||||
push @ndrivers, "nfs_acl.ko";
|
||||
push @ndrivers, "auth_rpcgss.ko";
|
||||
push @ndrivers, "exportfs.ko";
|
||||
push @ndrivers, "nfsd.ko";
|
||||
push @ndrivers, "nfs.ko";
|
||||
}
|
||||
|
||||
my $osver_host;
|
||||
if(`grep VERSION /etc/SuSE-release` =~ /VERSION = (\d+)/) {
|
||||
$osver_host=$1;
|
||||
@ -220,8 +234,12 @@ unless ($onlyinitrd) {
|
||||
mkpath "$rootimg_dir/etc";
|
||||
mkpath "$rootimg_dir/dev";
|
||||
#system "mount -o bind /dev $rootimg_dir/dev";
|
||||
system "mknod $rootimg_dir/dev/zero c 1 5";
|
||||
system "mknod $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11
|
||||
if( ! -e "$rootimg_dir/dev/zero") {
|
||||
system "mknod $rootimg_dir/dev/zero c 1 5";
|
||||
}
|
||||
if( ! -e "$rootimg_dir/dev/null") {
|
||||
system "mknod $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11
|
||||
}
|
||||
open($fd,">>","$rootimg_dir/etc/fstab");
|
||||
print $fd "#Dummy fstab for rpm postscripts to see\n";
|
||||
close($fd);
|
||||
@ -384,6 +402,23 @@ if (($postinstall_filename) && (-x $postinstall_filename)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($mode eq "statelite") {
|
||||
mkpath "$rootimg_dir/.statelite"; # create place for NFS mounts;
|
||||
# this script will get the directories;
|
||||
unless( -r "../add-on/statelite/rc.statelite") {
|
||||
print "Can't find ../add-on/statelite/rc.statelite!\n";
|
||||
exit;
|
||||
}
|
||||
system("cp ../add-on/statelite/rc.statelite $rootimg_dir/etc/init.d/statelite");
|
||||
# the dhcp client information stores in the directory "/var/lib/dhcpcd/"
|
||||
unless(-l "$rootimg_dir/var/lib/dhcpcd") {
|
||||
mkpath "$rootimg_dir/var/lib/dhcpcd/";
|
||||
system("touch $rootimg_dir/var/lib/dhcpcd/dhcpcd-$prinic.info");
|
||||
}
|
||||
# which is different from the Redhat family
|
||||
}
|
||||
|
||||
#some rpms mounts the imageroot/proc on the /proc, need to release it,
|
||||
#otherwise got kernal panic when installing
|
||||
#sometimes, the proc fs is not mounted, so one warning/error message will display,
|
||||
@ -468,7 +503,102 @@ sub mkinitrd {
|
||||
mkpath("/tmp/xcatinitrd.$$/var/lib/dhcpcd");
|
||||
my $inifile;
|
||||
open($inifile,">","/tmp/xcatinitrd.$$/init");
|
||||
print $inifile "#!/bin/bash -x\n";
|
||||
print $inifile "#!/bin/bash\n";
|
||||
|
||||
# copied from genimage for rh
|
||||
# add some functions
|
||||
print $inifile <<EOS1;
|
||||
NEWROOT="/sysroot"
|
||||
SHELL="/bin/sh"
|
||||
RWDIR=".statelite"
|
||||
|
||||
# Define some colors
|
||||
RESET="\033[0m"
|
||||
RED="\033[31m"
|
||||
CYAN="\033[36m"
|
||||
YELLOW="\033[33m\033[1m"
|
||||
GREEN="\033[32m"
|
||||
PINK="\033[35m\033[1m"
|
||||
MAGENTA="\033[35m"
|
||||
BROWN="\033[33m"
|
||||
NORMAL=\$RESET
|
||||
|
||||
# This function is used to mount files/directories from the .statelite directory
|
||||
# over the root directory.
|
||||
# This function stolen from redhat
|
||||
shell() {
|
||||
echo ''
|
||||
echo -e "\$YELLOW Entering rescue/debug init shell."
|
||||
echo -e " Exit shell to continue booting.\$RESET"
|
||||
\$SHELL
|
||||
}
|
||||
mountfile () {
|
||||
snapshotfile=\${NEWROOT}/\${RWDIR}/\${2}\${1}
|
||||
dir=`dirname \$snapshotfile`
|
||||
#
|
||||
# Check if file already exists in snapshot directory. If not attempt to copy
|
||||
# from root directory to snapshot directory.
|
||||
#
|
||||
if [ ! -e \$snapshotfile ]; then
|
||||
mkdir -p \$dir || echo -e "\${RED}Can't make \$dir\${NORMAL}"
|
||||
#echo -e "\${YELLOW} \${1} missing from client specific area.\${RESET}"
|
||||
if [ -e \$NEWROOT/\${1} ] ; then
|
||||
#echo "Copying \${1}"
|
||||
rsync -a \$NEWROOT/\${1} \$snapshotfile
|
||||
else
|
||||
#echo "Creating \${1}"
|
||||
touch \$snapshotfile
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# Mount the snapshotfile over the root file so the client will have r/w access
|
||||
#
|
||||
mount -n -o bind \$NEWROOT/\$RWDIR/\${2}\${1} \$NEWROOT/\${1}
|
||||
}
|
||||
fancydisplay () {
|
||||
clear
|
||||
echo -e "\$CYAN"
|
||||
echo '
|
||||
.. :iiii,
|
||||
:tLL; .,:...,.
|
||||
.j;:tLt. :. .;j: ij::::;.
|
||||
:tt;:::,ii:.jEEGi :tDEEG:.ti,::::;t:
|
||||
.,,,,,,,,,,,tLEEEEj: tDEEEEDtj;,,,::::::
|
||||
.:,,::::::,;fDEEEEEL,. .,ijDEDDDEEGt,,,,:,ijj;
|
||||
.... ..:;jDDLGDEEEGGGfjjjjjjfffLGDEEDEEDLjfGDt,:..
|
||||
.iftffGDLLDEEEDDDEEDDDDEDEEGLfLjjtti:
|
||||
,fii;jGDGffLjifLGLjtfffffGDEDGfji
|
||||
;DEEGffDDDjiii;;ii;,tGDEGjfEEEEf.
|
||||
,GEGGftiGEEEDt:,;,;;LEEDGjLEEEEEEG
|
||||
;DEDGjtjfitjGGjfDGj;jLLiitfGDEGjEEDj
|
||||
fGjjtfLfji;itjfGDjLDfjjjji;tGGLDEEDj
|
||||
fEDGffjti;ittjjjjtjjjjt:,,iiGGGGjtf.
|
||||
:fGGLfLLfLGf;i;ijffj,,tjLGDDGLfjtf,
|
||||
:;tLfjiiffLGDDDGLGEEEEjfGDDGGLfjfff:
|
||||
.. ,;tLLLLLL,;tijfLGGGjfDEEEEDLLGGGLLLjtjLLfi,.
|
||||
.jffLLLLGGLfjj;: :,;ijLGLfjGEDDEGtfGGLfjj:.,jjLGGLti;,,;fj,
|
||||
,fGGGGGGLj,. ;jGGGGLLjffftjLj;.. .,tfGGGGGGGGGGi
|
||||
,jGDDDj,. :tLGLGGLGDLjt, :iLGGDDDDGLif
|
||||
,LDDDL, .;LDDDDGfff, ,;iGDDj;,..
|
||||
;fGGGf, ,;;;;,: tf;jL,
|
||||
;.:::, Powered by xCAT ,j.:;
|
||||
'
|
||||
echo -e "\$RESET"
|
||||
echo -e "\$YELLOW"
|
||||
echo '
|
||||
_________ ________________
|
||||
___ __\\_ ___ \\ / _ \\__ ___/
|
||||
\\ \\/ / \\ \\/ / /_\\ \\| |
|
||||
> <\\ \\____/ | \\ |
|
||||
/__/\\_ \\\\______ /\\____|__ /____|
|
||||
\\/ \\/ \\/
|
||||
'
|
||||
echo -e "\$RESET"
|
||||
}
|
||||
|
||||
|
||||
EOS1
|
||||
|
||||
print $inifile "mount -t proc /proc /proc\n";
|
||||
print $inifile "mount -t sysfs /sys /sys\n";
|
||||
print $inifile "mount -o mode=0755 -t tmpfs /dev /dev\n";
|
||||
@ -503,11 +633,22 @@ sub mkinitrd {
|
||||
print $inifile "mknod /dev/ttyS1 c 4 65\n";
|
||||
print $inifile "mknod /dev/ttyS2 c 4 66\n";
|
||||
print $inifile "mknod /dev/ttyS3 c 4 67\n";
|
||||
|
||||
foreach (@ndrivers) {
|
||||
print $inifile "insmod /lib/$_\n";
|
||||
}
|
||||
if($mode eq "statelite") {
|
||||
print $inifile "echo debug: before netstart\n";
|
||||
print $inifile "# check and see if debug is specified on command line\n";
|
||||
print $inifile "grep '\(debug\)' /proc/cmdline > /dev/null && export DEBUG=1\n";
|
||||
}
|
||||
print $inifile <<EOMS;
|
||||
netstart
|
||||
while ! ifconfig | grep inet; do
|
||||
echo -e "\${RED}Failed to acquire address, retrying \${RESET}"
|
||||
sleep 1
|
||||
netstart
|
||||
done
|
||||
ip addr add dev lo 127.0.0.1/8
|
||||
ip link set lo up
|
||||
cd /
|
||||
@ -533,8 +674,141 @@ for i in `cat /proc/cmdline`; do
|
||||
SERVER=`echo \$VALUE|awk -F/ '{print \$3}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=4;i<=NF;i++) printf "/%s",\$i}'`
|
||||
fi
|
||||
elif [[ "\$KEY" == NFSROOT ]]; then # for NFSROOT
|
||||
NFSROOT=1
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
SERVER=`echo \$VALUE|awk -F: '{print \$1}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
|
||||
fi
|
||||
done
|
||||
|
||||
# show xCAT logo
|
||||
fancydisplay
|
||||
|
||||
# begin NFSROOT/Statelite code
|
||||
if [ "\$NFSROOT" = "1" ]; then
|
||||
echo Setting up Statelite
|
||||
# for loop back mounting capability!
|
||||
mknod /dev/loop0 b 7 0
|
||||
mkdir -p \$NEWROOT
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
ME=`hostname`
|
||||
while ! mount.nfs \${SERVER}:\${ROOTDIR}/rootimg \$NEWROOT -r -n -o nolock,rsize=32768,udp,nfsvers=3,timeo=14
|
||||
do
|
||||
ITER=\$(expr \$ITER + 1)
|
||||
if [ "\$ITER" == "\$MAXTRIES" ]
|
||||
then
|
||||
echo "You're dead. rpower \$ME boot to play again."
|
||||
echo "Possible problems:
|
||||
1. This initrd wasn't created for statelite node? rerun genimage with the -m statelite flag, then rerun 'nodeset \$ME statelite'
|
||||
2. Is DNS set up? Maybe that's why I can't mount \${SERVER}.
|
||||
3. The nfs modules aren't set right in this initfs?"
|
||||
|
||||
shell
|
||||
exit
|
||||
fi
|
||||
echo -e "\${RED}Could not mount \$SERVER:\$ROOTDIR on \$NEWROOT \$RESET"
|
||||
RS=`expr \$RANDOM % 30`
|
||||
echo -e "Trying again in \$RS seconds"
|
||||
sleep \$RS
|
||||
done
|
||||
|
||||
# now we need to mount the rest of the system. This is the read/write portions
|
||||
#echo "Mounting Snapshot directories"
|
||||
if [ ! -e "\$NEWROOT/\$RWDIR" ]
|
||||
then
|
||||
echo ""
|
||||
echo -e "\${RED}Hmmm... this NFS root directory doesn't have a /\$RWDIR directory for me to mount a rw filesystem. You'd better create it... \${NORMAL}"
|
||||
echo "."
|
||||
shell
|
||||
fi
|
||||
|
||||
while [ ! -e "\$NEWROOT/etc/init.d/statelite" ]
|
||||
do
|
||||
echo ""
|
||||
echo -e "\${RED}Hmmm... \$NEWROOT/etc/init.d/statelite doesn't exist. Perhaps you didn't create this image with the -m statelite mode"
|
||||
echo ""
|
||||
shell
|
||||
done
|
||||
grep '\\(shell\\)' /proc/cmdline >/dev/null && shell
|
||||
mount -t tmpfs rw \$NEWROOT/\$RWDIR
|
||||
mkdir -p \$NEWROOT/\$RWDIR/tmpfs
|
||||
|
||||
# mount the SNAPSHOT directory here for persistent use.
|
||||
if [ ! -z \$SNAPSHOTSERVER ]
|
||||
then
|
||||
mkdir -p \$NEWROOT/\$RWDIR/persistent
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
while ! mount \$SNAPSHOTSERVER:\$SNAPSHOTROOT \$NEWROOT/\$RWDIR/persistent
|
||||
do
|
||||
ITER=\$(expr \$ITER + 1)
|
||||
if [ "\$ITER" == "\$MAXTRIES" ]
|
||||
then
|
||||
echo "You're dead. rpower \$ME boot to play again."
|
||||
echo "Possible problems:
|
||||
1. \$SNAPSHOTSERVER is not exporting \$SNAPSHOTROOT ?
|
||||
2. Is DNS set up? Maybe that's why I can't mount \$SNAPSHOTSERVER."
|
||||
shell
|
||||
exit
|
||||
fi
|
||||
echo -e "\${RED}Hmmm... Can't mount \$SNAPSHOTSERVER:\$SNAPSHOTROOT. \${NORMAL}"
|
||||
RS=`expr \$RANDOM % 20`
|
||||
echo -e "Trying again in \$RS seconds"
|
||||
sleep \$RS
|
||||
done
|
||||
fi
|
||||
|
||||
grep '\\(shell\\)' /proc/cmdline >/dev/null && shell
|
||||
|
||||
# have to preserve the initial DHCP request. So we link it.
|
||||
# SLES uses different file to store DHCP info
|
||||
if [ ! -d \$NEWROOT/\$RWDIR/tmpfs/var/lib/dhcpcd ]
|
||||
then
|
||||
mkdir -p \$NEWROOT/\$RWDIR/tmpfs/var/lib/dhcpcd
|
||||
fi
|
||||
cp -fp /var/lib/dhcpcd/dhcpcd-$prinic.info \${NEWROOT}/\${RWDIR}/tmpfs/var/lib/dhcpcd/dhcpcd-$prinic.info
|
||||
|
||||
[ -e /etc/ntp.conf ] && mkdir -p \$NEWROOT/\$RWDIR/tmpfs/etc && cp /etc/ntp.conf \$NEWROOT/\$RWDIR/tmpfs/etc/
|
||||
|
||||
[ -e /etc/resolv.conf ] && mkdir -p \$NEWROOT/\$RWDIR/tmpfs/etc && cp /etc/resolv.conf \$NEWROOT/\$RWDIR/tmpfs/etc/
|
||||
|
||||
# now that everything is mounted, lets do this
|
||||
# hmmm, apparently I'm checking this twice... so I'd better
|
||||
# be really sure the file is there.
|
||||
while [ -z \$NEWROOT/etc/init.d/statelite ]
|
||||
do
|
||||
echo "\$NEWROOT/etc/init.d/statelite does not exist in image!"
|
||||
shell
|
||||
done
|
||||
|
||||
# do all the mounts:
|
||||
\$NEWROOT/etc/init.d/statelite
|
||||
|
||||
# give the debug shell just before we go if specified!
|
||||
grep '\(shell\)' /proc/cmdline > /dev/null && shell
|
||||
|
||||
echo 0x100 > /proc/sys/kernel/real-root-dev
|
||||
export keep_old_ip=yes
|
||||
export fastboot=yes
|
||||
export READONLY=yes
|
||||
grep '\\(shell\\)' /proc/cmdline >/dev/null && shell
|
||||
mount -n --bind /dev /sysroot/dev
|
||||
umount /sys
|
||||
umount /proc
|
||||
|
||||
# sles use the standard utility to chroot
|
||||
if ! exec /usr/bin/chroot \$NEWROOT /sbin/init
|
||||
then
|
||||
echo ""
|
||||
echo -e "\${RED}Couldn't chroot. Something must be wrong with NFS root image.\${RESET}"
|
||||
shell
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
# end NFSROOT/Statelite code
|
||||
|
||||
if [ "\$NFS" = "1" ]; then
|
||||
echo Setting up nfs with ram overlay.
|
||||
mknod /dev/loop0 b 7 0
|
||||
@ -544,7 +818,8 @@ if [ "\$NFS" = "1" ]; then
|
||||
while [ ! -d /ro/bin ]; do
|
||||
echo mounting \$SERVER:\$ROOTDIR on /ro
|
||||
mount \$SERVER:\$ROOTDIR /ro -r -n -o nolock,rsize=32768,udp,nfsvers=3,timeo=14
|
||||
sleep 5 #should be random, exponential for scale
|
||||
ST=`expr \$RANDOM % 5`
|
||||
sleep \$ST
|
||||
done
|
||||
mount -t tmpfs rw /rw
|
||||
mkdir -p /rw/etc
|
||||
@ -637,10 +912,17 @@ END
|
||||
push @filestoadd,[$_,"lib/$_"];
|
||||
}
|
||||
}
|
||||
foreach ("usr/bin/grep","bin/cpio","bin/sleep","bin/mount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","usr/bin/gzip","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed") {
|
||||
getlibs($_); #there's one small bug for getlibs
|
||||
push @filestoadd,$_;
|
||||
}
|
||||
if($mode eq "statelite") {
|
||||
foreach ("sbin/ifconfig", "usr/bin/clear", "sbin/mount.nfs","sbin/umount.nfs","bin/hostname","usr/bin/egrep","bin/ln","bin/ls","usr/bin/dirname","usr/bin/expr","usr/bin/chroot","usr/bin/grep","bin/cpio","bin/sleep","bin/mount","bin/umount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","usr/bin/gzip","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed") {
|
||||
getlibs($_);
|
||||
push @filestoadd,$_;
|
||||
}
|
||||
}else {
|
||||
foreach ("sbin/ifconfig","usr/bin/clear", "usr/bin/grep","bin/cpio","bin/sleep","bin/mount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","usr/bin/gzip","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed") {
|
||||
getlibs($_); #there's one small bug for getlibs
|
||||
push @filestoadd,$_;
|
||||
}
|
||||
}
|
||||
if ($arch =~ /x86_64/) {
|
||||
push @filestoadd,"lib64/libnss_dns.so.2";
|
||||
}
|
||||
@ -717,6 +999,15 @@ sub isnetdriver {
|
||||
|
||||
sub postscripts { # TODO: customized postscripts
|
||||
generic_post();
|
||||
if($mode eq "statelite") {
|
||||
if( ! -d "$rootimg_dir/opt/xcat/") {
|
||||
mkdir "$rootimg_dir/opt/xcat/";
|
||||
}
|
||||
copy ("$installroot/postscripts/xcatdsklspost", "$rootimg_dir/opt/xcat/");
|
||||
chmod '0755', "$rootimg_dir/opt/xcat/xcatdsklspost";
|
||||
system("$XCATROOT/share/xcat/netboot/add-on/statelite/add_passwd $rootimg_dir");
|
||||
system("$XCATROOT/share/xcat/netboot/add-on/statelite/add_ssh $rootimg_dir");
|
||||
}
|
||||
if (-d "$installroot/postscripts/hostkeys") {
|
||||
for my $key (<$installroot/postscripts/hostkeys/*key>) {
|
||||
copy ($key,"$rootimg_dir/etc/ssh/");
|
||||
@ -736,18 +1027,20 @@ sub postscripts { # TODO: customized postscripts
|
||||
|
||||
sub generic_post { #This function is meant to leave the image in a state approximating a normal install
|
||||
my $cfgfile;
|
||||
unlink("$rootimg_dir/dev/null");
|
||||
system("mknod $rootimg_dir/dev/null c 1 3");
|
||||
open($cfgfile,">","$rootimg_dir/etc/fstab");
|
||||
print $cfgfile "devpts /dev/pts devpts gid=5,mode=620 0 0\n";
|
||||
print $cfgfile "tmpfs /dev/shm tmpfs defaults 0 0\n";
|
||||
print $cfgfile "proc /proc proc defaults 0 0\n";
|
||||
print $cfgfile "sysfs /sys sysfs defaults 0 0\n";
|
||||
if ($tmplimit) {
|
||||
print $cfgfile "tmpfs /tmp tmpfs defaults 0 0\n";
|
||||
print $cfgfile "tmpfs /var/tmp tmpfs defaults 0 0\n";
|
||||
}
|
||||
close($cfgfile);
|
||||
if($mode ne "statelite") {
|
||||
unlink("$rootimg_dir/dev/null");
|
||||
system("mknod $rootimg_dir/dev/null c 1 3");
|
||||
open($cfgfile,">","$rootimg_dir/etc/fstab");
|
||||
print $cfgfile "devpts /dev/pts devpts gid=5,mode=620 0 0\n";
|
||||
print $cfgfile "tmpfs /dev/shm tmpfs defaults 0 0\n";
|
||||
print $cfgfile "proc /proc proc defaults 0 0\n";
|
||||
print $cfgfile "sysfs /sys sysfs defaults 0 0\n";
|
||||
if ($tmplimit) {
|
||||
print $cfgfile "tmpfs /tmp tmpfs defaults 0 0\n";
|
||||
print $cfgfile "tmpfs /var/tmp tmpfs defaults 0 0\n";
|
||||
}
|
||||
close($cfgfile);
|
||||
}
|
||||
open($cfgfile,">","$rootimg_dir/etc/sysconfig/network");
|
||||
print $cfgfile "NETWORKING=yes\n";
|
||||
close($cfgfile);
|
||||
@ -802,7 +1095,11 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
print $cfgfile " fi\n";
|
||||
print $cfgfile "done\n";
|
||||
print $cfgfile "/etc/init.d/boot.localnet start\n";
|
||||
print $cfgfile "/opt/xcat/xcatdsklspost\n";
|
||||
if($mode eq "statelite") {
|
||||
print $cfgfile "/opt/xcat/xcatdsklspost 4\n";
|
||||
} else {
|
||||
print $cfgfile "/opt/xcat/xcatdsklspost\n";
|
||||
}
|
||||
close($cfgfile);
|
||||
chmod(0755,"$rootimg_dir/etc/init.d/gettyset");
|
||||
#link("$rootimg_dir/sbin/init","$rootimg_dir/init");
|
||||
@ -976,4 +1273,22 @@ sub get_postinstall_file_name {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
sub get_rwfiles_file_name {
|
||||
my $base = shift;
|
||||
my $dotpos = rindex($osver, ".");
|
||||
my $osbase = substr($osver, 0, $dotpos);
|
||||
if( -r "$base/$profile.$osver.$arch.rwfiles") {
|
||||
return "$base/$profile.$osver.$arch.rwfiles";
|
||||
} elsif (-r "$base/$profile.$osbase.$arch.rwfiles") {
|
||||
return "$base/$profile.$osbase.$arch.rwfiles";
|
||||
} elsif (-r "$base/$profile.$arch.rwfiles") {
|
||||
return "$base/$profile.$arch.rwfiles";
|
||||
} elsif (-r "$base/$profile.$osver.rwfiles") {
|
||||
return "$base/$profile.$osver.rwfiles";
|
||||
} elsif (-r "$base/$profile.$osbase.rwfiles") {
|
||||
return "$base/$profile.$osbase.rwfiles";
|
||||
} elsif( -r "$base/$profile.rwfiles") {
|
||||
return "$base/$profile.rwfiles";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user