diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 4b5667648..774ccad92 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -181,6 +181,8 @@ sub process_request { system("mkdir -p $rootimg_dir/xcatpost"); system("cp -r $installroot/postscripts/* $rootimg_dir/xcatpost/"); + # update rw to ro for sles + updateFstab($rootimg_dir,$profile,$arch); #get the root password for the node my $pass = xCAT::PasswordUtils::crypt_system_password(); @@ -258,7 +260,6 @@ sub process_request { return; } - # now get the files for the node my @synclist = xCAT::Utils->runcmd("ilitefile $imagename", 0, 1); unless (@synclist) { @@ -569,6 +570,8 @@ sub process_request { system("rm -f $xcat_packimg_tmpfile"); } chdir($oldpath); + + } sub liteMe { @@ -968,5 +971,33 @@ sub liteItem { } } +=head3 + updateFstab +=cut + +sub updateFstab { + + $rootimg_dir = shift; + $profile = shift; + $arch = shift; + + my $rootfs_name = $profile . "_" . $arch; + + my $tfstab; + open($tfstab, "<", "$rootimg_dir/etc/fstab"); + my @fsdents = <$tfstab>; + close($tfstab); + + open($tfstab, ">", "$rootimg_dir/etc/fstab"); + foreach my $line (@fsdents) { + if ( $line =~ /^$rootfs_name/ ) { + $line =~ s/rw/ro/; + } + print $tfstab $line; + } + close($tfstab); + +} + 1;