2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Fix issue of packimage -m txc (#1554)

* redefine the code to make distint

* fix issue of packimage -m txc
This commit is contained in:
penguhyang 2016-07-20 20:06:33 +08:00 committed by yangsong
parent d7cd8f9a66
commit 5d46d48f6a
24 changed files with 235 additions and 105 deletions

View File

@ -62,7 +62,7 @@ OPTIONS
\ **-a**\ Architecture (ppc64,x86_64,etc)
\ **-m**\ Method (default cpio)
\ **-m**\ Method (cpio,txc,squashfs, default is cpio)
************

View File

@ -36,7 +36,7 @@ B<-p> Profile (compute,service)
B<-a> Architecture (ppc64,x86_64,etc)
B<-m> Method (default cpio)
B<-m> Method (cpio,txc,squashfs, default is cpio)
=head1 RETURN VALUE

View File

@ -450,6 +450,7 @@ sub mknetboot
$platform=xCAT_plugin::anaconda::getplatform($osver);
my $suffix = 'gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'txz' if (-r "$rootimgdir/rootimg.txz");
# statelite images are not packed.
if ($statelite) {
unless ( -r "$rootimgdir/kernel") {
@ -497,7 +498,7 @@ sub mknetboot
copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz");
}
}
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.sfs" ) {
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs" ) {
$callback->({
error=>["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1]});

View File

@ -1152,8 +1152,9 @@ sub mknetboot
$platform=xCAT_plugin::debian::getplatform($osver);
my $suffix = 'gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
# statelite images are not packed.
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'txz' if (-r "$rootimgdir/rootimg.txz");
# statelite images are not packed.
if ($statelite) {
unless ( -r "$rootimgdir/kernel") {
$callback->({
@ -1201,7 +1202,7 @@ sub mknetboot
copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz");
}
}
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.sfs" ) {
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs" ) {
$callback->({
error=>["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1]});

View File

@ -1,8 +1,26 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#-------------------------------------------------------
=head1
xCAT plugin package to pack the stateless image
Supported options:
-h Display usage message
-v Command Version
-o Operating system (fedora8, rhel5, sles10,etc)
-p Profile (compute,service)
-a Architecture (ppc64,x86_64,etc)
-m Method (default cpio)
=cut
#-------------------------------------------------------
package xCAT_plugin::packimage;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use strict;
use lib "$::XCATROOT/lib/perl";
use Data::Dumper;
use xCAT::Table;
@ -24,24 +42,44 @@ Getopt::Long::Configure("pass_through");
my $verbose = 0;
#$verbose = 1;
#-------------------------------------------------------
=head3 handled_commands
Return list of commands handled by this plugin
=cut
#-------------------------------------------------------
sub handled_commands {
return {
packimage => "packimage",
}
}
#-------------------------------------------------------
=head3 Process the command
=cut
#-------------------------------------------------------
sub process_request {
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $installroot = xCAT::TableUtils->getInstallDir();
@ARGV = @{$request->{arg}};
my $argc = scalar @ARGV;
if ($argc == 0) {
$callback->({info=>["packimage -h \npackimage -v \npackimage imagename"]});
return;
my $args;
if (defined($request->{arg})) {
$args = $request->{arg};
@ARGV = @{$args};
}
if (scalar(@ARGV) == 0) {
$callback->({info=>["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"]});
return 0;
}
my $osver;
my $arch;
my $profile;
@ -52,6 +90,9 @@ sub process_request {
my $destdir;
my $imagename;
my $dotorrent;
my $provmethod;
my $help;
my $version;
GetOptions(
"profile|p=s" => \$profile,
@ -65,62 +106,62 @@ sub process_request {
if ($version) {
my $version = xCAT::Utils->Version();
$callback->({info=>[$version]});
return;
return 0;
}
if ($help) {
$callback->({info=>["packimage -h \npackimage -v \npackimage imagename"]});
return;
$callback->({info=>["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"]});
return 0;
}
if (@ARGV > 0) {
$imagename=$ARGV[0];
if ($arch or $osver or $profile) {
$callback->({error=>["-o, -p and -a options are not allowed when a image name is specified."],errorcode=>[1]});
return;
return 1;
}
# load the module in memory
eval {require("$::XCATROOT/lib/perl/xCAT/Table.pm")};
if ($@) {
$callback->({error=>[$@],errorcode=>[1]});
return;
return 1;
}
# get the info from the osimage and linux
my $osimagetab=xCAT::Table->new('osimage', -create=>1);
unless ($osimagetab) {
$callback->({error=>["The osimage table cannot be opened."],errorcode=>[1]});
return;
return 1;
}
my $linuximagetab=xCAT::Table->new('linuximage', -create=>1);
unless ($linuximagetab) {
$callback->({error=>["The linuximage table cannot be opened."],errorcode=>[1]});
return;
return 1;
}
(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod', 'synclists');
unless ($ref) {
$callback->({error=>["Cannot find image \'$imagename\' from the osimage table."],errorcode=>[1]});
return;
return 1;
}
(my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'exlist', 'rootimgdir');
unless ($ref1) {
$callback->({error=>["Cannot find $imagename from the linuximage table."],errorcode=>[1]});
return;
return 1;
}
$osver=$ref->{'osvers'};
$arch=$ref->{'osarch'};
$profile=$ref->{'profile'};
$syncfile=$ref->{'synclists'};
my $provmethod=$ref->{'provmethod'};
$provmethod=$ref->{'provmethod'};
unless ($osver and $arch and $profile and $provmethod) {
$callback->({error=>["osimage.osvers, osimage.osarch, osimage.profile and osimage.provmethod must be specified for the image $imagename in the database."],errorcode=>[1]});
return;
return 1;
}
if ($provmethod ne 'netboot') {
$callback->({error=>["\'$imagename\' cannot be used to build diskless image. Make sure osimage.provmethod is 'netboot'."],errorcode=>[1]});
return;
return 1;
}
$exlistloc =$ref1->{'exlist'};
@ -129,7 +170,7 @@ sub process_request {
$provmethod="netboot";
unless ($osver) {
$callback->({error=>["Please specify a os version with the -o flag"],errorcode=>[1]});
return;
return 1;
}
unless ($arch) {
$arch = `uname -m`;
@ -139,7 +180,7 @@ sub process_request {
unless ($profile) {
$callback->({error=>["Please specify a profile name with -p flag"],errorcode=>[1]});
return;
return 1;
}
}
@ -154,11 +195,11 @@ sub process_request {
}
unless ($distname) {
$callback->({error=>["Unable to find $::XCATROOT/share/xcat/netboot directory for $osver"],errorcode=>[1]});
return;
return 1;
}
unless ($installroot) {
$callback->({error=>["No installdir defined in site table"],errorcode=>[1]});
return;
return 1;
}
my $oldpath=cwd();
unless ($imagename) {
@ -169,7 +210,7 @@ sub process_request {
my @ret = xCAT::SvrUtils->update_tables_with_diskless_image($osver, $arch, $profile, "netboot");
unless ($ret[0] eq 0) {
$callback->({error=>["Error when updating the osimage tables: " . $ret[1]], errorcode=>[1]});
return;
return 1;
}
}
@ -205,7 +246,7 @@ sub process_request {
my %liteHash; # create hash table for the entries in @listList
if (parseLiteFiles($ref_liteList, \%liteHash)) {
$callback->({error=>["Failed for parsing litefile table!"], errorcode=>[1]});
return;
return 1;
}
$verbose && $callback->({data=>["rootimg_status = $rootimg_status at line " . __LINE__ ]});
@ -317,7 +358,7 @@ sub process_request {
# add the xCAT post scripts to the image
unless ( -d "$rootimg_dir") {
$callback->({error=>["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"], errorcode=>[1]});
return;
return 1;
}
# some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk
@ -359,31 +400,27 @@ sub process_request {
system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile");
}
my $verb = "Packing";
my $temppath;
my $oldmask;
unless ( -d $rootimg_dir) {
$callback->({error=>["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"]});
return;
return 1;
}
$callback->({data=>["$verb contents of $rootimg_dir"]});
$callback->({data=>["Packing contents of $rootimg_dir"]});
unlink("$destdir/rootimg.gz");
unlink("$destdir/rootimg.sfs");
my $compress="gzip";
#use "pigz" as the compress tool instead of gzip if "pigz" exist
my $ispigz=system("bash -c 'type -p pigz' >/dev/null 2>&1");
if($ispigz == 0){
$compress="pigz";
}
$callback->({info=>["compress method:$compress"]});
$callback->({info=>["compress method:$method"]});
if ($method =~ /cpio/) {
my $compress="gzip";
#use "pigz" as the compress tool instead of gzip if "pigz" exist
my $ispigz=system("bash -c 'type -p pigz' >/dev/null 2>&1");
if($ispigz == 0){
$compress="pigz";
}
if ( ! $exlistloc ) {
$excludestr = "find . -xdev |cpio -H newc -o | $compress -c - > ../rootimg.gz";
}else {
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
@ -393,15 +430,21 @@ sub process_request {
}
$oldmask = umask 0077;
} elsif ($method =~ /txc/) {
my $isxz=system("bash -c 'type -p xz' >/dev/null 2>&1");
unless($isxz == 0) {
$callback->({error=>["Command xz does not exist, please make sure it works."]});
return 1;
}
$callback->({info=>["It will take several minutes to complete. So please wait for several minutes, then the other operations could be done. Otherwise, the other operation will fail."]});
if ( ! $exlistloc ) {
$excludestr = "find . -xdev | tar --selinux --xattr-include='*' -T - -Jcvf ../rootimg.txz";
}else {
$excludestr = "find . -xdev | tar --selinux --xattrs-include='*' -T - -Jcvf ../rootimg.txz";
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattr-include='*' -T -Jcvf ../rootimg.txz";
$excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -Jcvf ../rootimg.txz";
}
$oldmask = umask 0077;
} elsif ($method =~ /squashfs/) {
@ -429,6 +472,9 @@ sub process_request {
chdir($currdir);
}
umask $oldmask;
} elsif ($method =~ /txc/) {
chmod 0644,"$destdir/rootimg.txz";
umask $oldmask;
} elsif ($method =~ /squashfs/) {
my $flags;
if ($arch =~ /x86/) {
@ -443,17 +489,17 @@ sub process_request {
if (! -x "/sbin/mksquashfs" && ! -x "/usr/bin/mksquashfs" ) {
$callback->({error=>["mksquashfs not found, squashfs-tools rpm should be installed on the management node"],errorcode=>[1]});
return;
return 1;
}
my $rc = system("mksquashfs $temppath ../rootimg.sfs $flags");
if ($rc) {
$callback->({error=>["mksquashfs could not be run successfully"],errorcode=>[1]});
return;
return 1;
}
$rc = system("rm -rf $temppath");
if ($rc) {
$callback->({error=>["Failed to clean up temp space"],errorcode=>[1]});
return;
return 1;
}
chmod(0644,"../rootimg.sfs");
}
@ -481,11 +527,15 @@ sub process_request {
chdir($oldpath);
}
###########################################################
#
# copybootscript - copy the xCAT diskless init scripts to the image
#
#############################################################
#-------------------------------------------------------
=head3 copybootscript
copy the xCAT diskless init scripts to the image
=cut
#-------------------------------------------------------
sub copybootscript {
my $installroot = shift;
@ -546,6 +596,14 @@ sub copybootscript {
return 0;
}
#-------------------------------------------------------
=head3 include_file
=cut
#-------------------------------------------------------
sub include_file
{
my $file = shift;
@ -570,45 +628,47 @@ sub include_file
return join("\n", @text);
}
=head3 parseLiteFiles
In the liteentry table, one directory and its sub-items (including sub-directory and entries) can co-exist;
In order to handle such a scenario, one hash is generated to show the hirarachy relationship
#-------------------------------------------------------
For example, one array with entry names is used as the input:
my @entries = (
"imagename bind,persistent /var/",
"imagename bind /var/tmp/",
"imagename tmpfs,rw /root/",
"imagename tmpfs,rw /root/.bashrc",
"imagename tmpfs,rw /root/test/",
"imagename bind /etc/resolv.conf",
"imagename bind /var/run/"
);
Then, one hash will generated as:
%hashentries = {
'bind,persistent /var/' => [
'bind /var/tmp/',
'bind /var/run/'
],
'bind /etc/resolv.conf' => undef,
'tmpfs,rw /root/' => [
'tmpfs,rw /root/.bashrc',
'tmpfs,rw /root/test/'
]
};
=head3 parseLiteFiles
Arguments:
one array with entrynames,
one hash to hold the entries parsed
In the liteentry table, one directory and its sub-items (including sub-directory and entries) can co-exist;
In order to handle such a scenario, one hash is generated to show the hirarachy relationship
Returns:
0 if sucucess
1 if fail
For example, one array with entry names is used as the input:
my @entries = (
"imagename bind,persistent /var/",
"imagename bind /var/tmp/",
"imagename tmpfs,rw /root/",
"imagename tmpfs,rw /root/.bashrc",
"imagename tmpfs,rw /root/test/",
"imagename bind /etc/resolv.conf",
"imagename bind /var/run/"
);
Then, one hash will generated as:
%hashentries = {
'bind,persistent /var/' => [
'bind /var/tmp/',
'bind /var/run/'
],
'bind /etc/resolv.conf' => undef,
'tmpfs,rw /root/' => [
'tmpfs,rw /root/.bashrc',
'tmpfs,rw /root/test/'
]
};
Arguments:
one array with entrynames,
one hash to hold the entries parsed
Returns:
0 if sucucess
1 if fail
=cut
#-------------------------------------------------------
sub parseLiteFiles {
my ($flref, $dhref) = @_;
my @entries = @{$flref};

View File

@ -314,14 +314,12 @@ sub mknetboot
$pkgdir = "$installroot/$osver/$arch";
}elsif($osver =~ /suse.*/){
$platform = "sles";
}
my $suffix = 'gz';
if (-r "$rootimgdir/rootimg.sfs")
{
$suffix = 'sfs';
}
my $suffix = 'gz';
$suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs");
$suffix = 'txz' if (-r "$rootimgdir/rootimg.txz");
if ($statelite) {
unless ( -r "$rootimgdir/kernel") {
$callback->({
@ -372,7 +370,7 @@ sub mknetboot
}
}
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.sfs" ) {
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs" ) {
$callback->({
error=>[qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}],
errorcode=>[1]

View File

@ -24,3 +24,4 @@ irqbalance
procps-ng
parted
net-tools
xz

View File

@ -19,3 +19,4 @@ rsyslog
e2fsprogs
parted
net-tools
xz

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget tar xz cpio gzip dash modprobe touch echo cut wc
dracut_install wget tar xz cpio gzip dash modprobe touch echo cut wc xz
dracut_install -o ctorrent
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip modprobe touch echo cut wc
dracut_install wget cpio gzip modprobe touch echo cut wc xz
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod

View File

@ -90,6 +90,7 @@ elif [ -r /rootimg.gz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg.txz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.txz downloaded,setting up RAM-root tmpfs...."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@ -98,9 +99,11 @@ elif [ -r /rootimg.txz ]; then
fi
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
tar -Jxvf /rootimg.txz
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.

View File

@ -1583,6 +1583,17 @@ EOMS
print $inifile " zcat /rootimg.gz |cpio -idum\n";
print $inifile " fi\n";
print $inifile " echo Done\n";
print $inifile "elif [ -r /rootimg.txz ]; then\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
} else {
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
}
print $inifile " cd \$NEWROOT\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " tar -Jxvf /rootimg.txz\n";
print $inifile " echo Done\n";
print $inifile "else\n";
print $inifile " echo -n Failed to download image, panicing in 5...\n";
print $inifile " for i in 4 3 2 1 0; do\n";
@ -1657,7 +1668,7 @@ EOMS
}
}
# add rsync for statelite
foreach ("bin/cpio","sbin/nash","sbin/busybox.anaconda","sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc") {
foreach ("bin/cpio","sbin/nash","sbin/busybox.anaconda","sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/xz") {
getlibs($_);
push @filestoadd,$_;
}

View File

@ -41,3 +41,4 @@ udev
kernel-default
kernel-firmware
adaptec-firmware
xz

View File

@ -41,3 +41,4 @@ udev
kernel-default
kernel-firmware
adaptec-firmware
xz

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip modprobe touch echo cut wc
dracut_install wget cpio gzip modprobe touch echo cut wc xz
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod

View File

@ -87,6 +87,22 @@ elif [ -r /rootimg.gz ]; then
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg.txz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.txz downloaded,setting up RAM-root tmpfs...."
echo Setting up RAM-root tmpfs.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
else
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
fi
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
tar -Jxvf /rootimg.txz
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.

View File

@ -1621,6 +1621,17 @@ EOMS
print $inifile " zcat /rootimg.gz |cpio -idum\n";
print $inifile " fi\n";
print $inifile " echo Done\n";
print $inifile "elif [ -r /rootimg.txz ]; then\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
} else {
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
}
print $inifile " cd \$NEWROOT\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " tar -Jxvf /rootimg.txz\n";
print $inifile " echo Done\n";
print $inifile "else\n";
print $inifile " echo -n Failed to download image, panicing in 5...\n";
print $inifile " for i in 4 3 2 1 0; do\n";
@ -1728,7 +1739,7 @@ EOMS
}
}
if($mode eq "statelite") {
foreach ("sbin/ifconfig", "usr/bin/clear","usr/bin/touch","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","usr/bin/wc", "bin/sed","sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc") {
foreach ("sbin/ifconfig", "usr/bin/clear","usr/bin/touch","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","usr/bin/wc", "bin/sed","sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz") {
getlibs($_);
push @filestoadd,$_;
}
@ -1740,7 +1751,7 @@ EOMS
}
}else {
foreach ("sbin/ifconfig","usr/bin/clear","usr/bin/touch","usr/bin/grep","usr/bin/egrep","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","sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc") {
foreach ("sbin/ifconfig","usr/bin/clear","usr/bin/touch","usr/bin/grep","usr/bin/egrep","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","sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz") {
getlibs($_);
push @filestoadd,$_;
}

View File

@ -13,3 +13,4 @@ rsync
busybox-static
gawk
dnsutils
xz-utils

View File

@ -13,3 +13,4 @@ rsync
busybox-static
gawk
dnsutils
xz-utils

View File

@ -14,3 +14,4 @@ rsync
busybox-static
gawk
dnsutils
xz-utils

View File

@ -14,3 +14,4 @@ rsync
busybox-static
gawk
dnsutils
xz-utils

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip dash modprobe touch echo cut wc
dracut_install wget cpio gzip dash modprobe touch echo cut wc xz
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install mount.nfs
inst "$moddir/xcatroot" "/sbin/xcatroot"

View File

@ -50,6 +50,13 @@ elif [ -r /rootimg.gz ]; then
gzip -cd /rootimg.gz |cpio -idum
fi
echo Done
elif [ -r /rootimg.txz ]; then
echo Setting up RAM-root tmpfs.
mount -t tmpfs -o mode=755 rootfs $NEWROOT
cd $NEWROOT
echo -n "Extracting root filesystem:"
tar -Jxvf /rootimg.txz
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.
mount -t tmpfs -o mode=755 rootfs $NEWROOT

View File

@ -1436,6 +1436,20 @@ EOMS
print $inifile " fi\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n";
print $inifile " echo Done\n";
print $inifile "elif [ -r /rootimg.txz ]; then\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.txz downloaded,setting up RAM-root tmpfs...\"\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
} else {
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
}
print $inifile " cd \$NEWROOT\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " tar -Jxvf /rootimg.txz\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n";
print $inifile " echo Done\n";
print $inifile "else\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Failed to download image, panicing in 5...\"\n";
print $inifile " echo -n Failed to download image, panicing in 5...\n";
@ -1573,7 +1587,7 @@ EOMS
}
}
# add rsync for statelite
foreach ( "usr/bin/dig","bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod","usr/bin/wget") {
foreach ( "usr/bin/dig","bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod","usr/bin/wget","usr/bin/xz") {
getlibs($_);
push @filestoadd,$_;
}