Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49656 - in /trunk/storage/libstorage/src: Dasd.cc Disk.cc Dm.cc DmCo.cc DmPartCo.cc DmraidCo.cc Loop.cc LoopCo.cc LvmVg.cc MdCo.cc Storage.cc StorageDefines.h Volume.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Mon, 04 Aug 2008 16:34:26 -0000
  • Message-id: <20080804163427.5A0E739BA1@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Mon Aug 4 18:34:26 2008
New Revision: 49656

URL: http://svn.opensuse.org/viewcvs/yast?rev=49656&view=rev
Log:
- work on shell quoting and absolute path names for executables

Modified:
trunk/storage/libstorage/src/Dasd.cc
trunk/storage/libstorage/src/Disk.cc
trunk/storage/libstorage/src/Dm.cc
trunk/storage/libstorage/src/DmCo.cc
trunk/storage/libstorage/src/DmPartCo.cc
trunk/storage/libstorage/src/DmraidCo.cc
trunk/storage/libstorage/src/Loop.cc
trunk/storage/libstorage/src/LoopCo.cc
trunk/storage/libstorage/src/LvmVg.cc
trunk/storage/libstorage/src/MdCo.cc
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageDefines.h
trunk/storage/libstorage/src/Volume.cc

Modified: trunk/storage/libstorage/src/Dasd.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dasd.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dasd.cc (original)
+++ trunk/storage/libstorage/src/Dasd.cc Mon Aug 4 18:34:26 2008
@@ -35,7 +35,7 @@
bool Dasd::detectPartitionsFdasd( ProcPart& ppart )
{
bool ret = true;
- string cmd_line = "/sbin/fdasd -p " + device();
+ string cmd_line = "/sbin/fdasd -p " + quote(device());
system_stderr.erase();
y2milestone( "executing cmd:%s", cmd_line.c_str() );
SystemCmd Cmd( cmd_line );
@@ -49,7 +49,7 @@
bool Dasd::detectPartitions( ProcPart& ppart )
{
bool ret = true;
- string cmd_line = "dasdview -x " + device();
+ string cmd_line = "dasdview -x " + quote(device());
system_stderr.erase();
detected_label = "dasd";
setLabelData( "dasd" );
@@ -381,7 +381,7 @@
++i;
}
inpfile.close();
- string cmd_line = "/sbin/fdasd -c " + inpname + " " + device();
+ string cmd_line = "/sbin/fdasd -c " + inpname + " " + quote(device());
if( execCheckFailed( cmd_line ) )
{
SystemCmd cmd( "cat " + inpname );

Modified: trunk/storage/libstorage/src/Disk.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.cc (original)
+++ trunk/storage/libstorage/src/Disk.cc Mon Aug 4 18:34:26 2008
@@ -2285,7 +2285,7 @@
{
string cmd;
SystemCmd c;
- cmd = "dd if=/dev/zero of=" + p->device() + " bs=1k count=200";
+ cmd = "dd if=/dev/zero of=" + quote(p->device()) + " bs=1k
count=200";
c.execute( cmd );
unsigned long long pos = p->sizeK();
if( pos>200 )
@@ -2307,7 +2307,7 @@
}
if( !dmp_slave && call_blockdev )
{
- SystemCmd c( "/sbin/blockdev --rereadpt " + device() );
+ SystemCmd c("/sbin/blockdev --rereadpt " + quote(device()));
if( p->type()!=EXTENDED )
getStorage()->waitForDevice( p->device() );
}

Modified: trunk/storage/libstorage/src/Dm.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dm.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dm.cc (original)
+++ trunk/storage/libstorage/src/Dm.cc Mon Aug 4 18:34:26 2008
@@ -10,6 +10,7 @@
#include "y2storage/AppUtil.h"
#include "y2storage/Regex.h"
#include "y2storage/Storage.h"
+#include "y2storage/StorageDefines.h"

using namespace storage;
using namespace std;
@@ -54,7 +55,7 @@
{
if( dm_major==0 )
getDmMajor();
- SystemCmd c("dmsetup table " + quote(tname));
+ SystemCmd c(DMSETUPBIN " table " + quote(tname));
inactiv = c.retcode()!=0;
y2milestone( "table %s retcode:%d numLines:%u inactive:%d",
tname.c_str(), c.retcode(), c.numLines(), inactiv );
@@ -196,8 +197,8 @@
ret = Loop::loopDeviceName(mi);
if( ret.empty() && mj==dmMajor() && ls.size()>=2 )
{
- c.execute( "dmsetup info -c --noheadings -j " + *ls.begin() +
- " -m " + *(++ls.begin()) + " | sed -e \"s/:.*//\"" );
+ c.execute(DMSETUPBIN " info -c --noheadings -j " + *ls.begin() +
+ " -m " + *(++ls.begin()) + " | sed -e \"s/:.*//\"" );
if( c.retcode()==0 && c.numLines()>0 )
{
string tmp = "/dev/"+*c.getLine(0);
@@ -207,7 +208,7 @@
}
else
{
- c.execute("dmsetup table " + quote(*c.getLine(0)));
+ c.execute(DMSETUPBIN " table " + quote(*c.getLine(0)));
if( c.retcode()==0 && c.numLines()>0 )
{
pair = extractNthWord( 3, *c.getLine(0) );
@@ -436,7 +437,7 @@
SystemCmd c;
if( val )
{
- c.execute( "dmsetup version" );
+ c.execute(DMSETUPBIN " version");
if( c.retcode()!=0 )
{
c.execute(" grep \"^dm[-_]mod[ ]\" /proc/modules" );
@@ -450,7 +451,7 @@
}
else
{
- c.execute( "dmsetup remove_all" );
+ c.execute(DMSETUPBIN " remove_all");
}
active = val;
}
@@ -489,7 +490,7 @@
int Dm::dmNumber( const string& table )
{
int ret = -1;
- SystemCmd c("dmsetup -c --noheadings info " + quote(table));
+ SystemCmd c(DMSETUPBIN " -c --noheadings info " + quote(table));
if( c.retcode()==0 && c.numLines()>0 )
{
list<string> sl = splitString( *c.getLine(0), ":" );

Modified: trunk/storage/libstorage/src/DmCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmCo.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmCo.cc (original)
+++ trunk/storage/libstorage/src/DmCo.cc Mon Aug 4 18:34:26 2008
@@ -11,6 +11,7 @@
#include "y2storage/ProcPart.h"
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
+#include "y2storage/StorageDefines.h"

using namespace std;
using namespace storage;
@@ -77,7 +78,7 @@
if( dev.substr( 0, 12 ) == "/dev/mapper/")
{
string tdev = dev.substr (12);
- SystemCmd c("cryptsetup status " + quote(tdev));
+ SystemCmd c(CRYPTSETUPBIN " status " + quote(tdev));

string cipher, keysize;
for( unsigned int i = 0; i < c.numLines(); i++)
@@ -113,7 +114,7 @@
Storage::ConstDmraidCoPair dmrco = getStorage()->dmraidCoPair();
Storage::ConstDmraidPair dmr = getStorage()->dmrPair();
y2milestone( "begin" );
- SystemCmd c( "dmsetup ls | grep \"(.*)\"" );
+ SystemCmd c(DMSETUPBIN " ls | grep \"(.*)\"" );
for( unsigned i=0; i<c.numLines(); ++i )
{
string line = *c.getLine(i);
@@ -318,7 +319,7 @@
ret = m->prepareRemove();
if( ret==0 )
{
- string cmd = "dmsetup remove " + m->getTableName();
+ string cmd = DMSETUPBIN " remove " + quote(m->getTableName());
SystemCmd c( cmd );
if( c.retcode()!=0 )
ret = DM_REMOVE_FAILED;

Modified: trunk/storage/libstorage/src/DmPartCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPartCo.cc (original)
+++ trunk/storage/libstorage/src/DmPartCo.cc Mon Aug 4 18:34:26 2008
@@ -12,6 +12,7 @@
#include "y2storage/SystemCmd.h"
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
+#include "y2storage/StorageDefines.h"

using namespace std;
using namespace storage;
@@ -232,7 +233,7 @@
void
DmPartCo::init( ProcPart& ppart )
{
- SystemCmd c("dmsetup table " + quote(nm));
+ SystemCmd c(DMSETUPBIN " table " + quote(nm));
if( c.retcode()==0 && c.numLines()>=1 && isdigit( c.stdout()[0] ))
{
mnr = Dm::dmNumber( nm );
@@ -249,7 +250,7 @@
{
string pat = numToName(1);
pat.erase( pat.length()-1, 1 );
- c.execute( "dmsetup ls | grep -w ^" + pat + "[0-9]\\\\+" );
+ c.execute(DMSETUPBIN " ls | grep -w ^" + pat + "[0-9]\\\\+" );
if( c.numLines()==0 )
activate_part(true);
}
@@ -499,11 +500,11 @@
if( val )
{
Dm::activate(true);
- c.execute( "kpartx -a -p _part \"" + dev + "\"" );
+ c.execute(KPARTXBIN " -a -p _part " + quote(dev));
}
else
{
- c.execute( "kpartx -d -p _part \"" + dev + "\"" );
+ c.execute(KPARTXBIN " -d -p _part " + quote(dev));
}
active = val;
}

Modified: trunk/storage/libstorage/src/DmraidCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmraidCo.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmraidCo.cc (original)
+++ trunk/storage/libstorage/src/DmraidCo.cc Mon Aug 4 18:34:26 2008
@@ -30,7 +30,7 @@
void DmraidCo::getRaidData( const string& name )
{
y2milestone( "name:%s", name.c_str() );
- SystemCmd c( "dmraid -s -c -c -c \"" + name + "\"" );
+ SystemCmd c( "dmraid -s -c -c -c " + quote(name));
list<string>::const_iterator ci;
list<string> sl;
if( c.numLines()>0 )

Modified: trunk/storage/libstorage/src/Loop.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Loop.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Loop.cc (original)
+++ trunk/storage/libstorage/src/Loop.cc Mon Aug 4 18:34:26 2008
@@ -182,7 +182,7 @@
y2mil( "pa:" << pa );
createPath( pa );
}
- string cmd = "dd if=/dev/zero of=" + lfileRealPath();
+ string cmd = "dd if=/dev/zero of=" + quote(lfileRealPath());
cmd += " bs=1k count=" + decString( sizeK() );
SystemCmd c( cmd );
ret = c.retcode()==0;

Modified: trunk/storage/libstorage/src/LoopCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LoopCo.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LoopCo.cc (original)
+++ trunk/storage/libstorage/src/LoopCo.cc Mon Aug 4 18:34:26 2008
@@ -13,6 +13,7 @@
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
#include "y2storage/EtcFstab.h"
+#include "y2storage/StorageDefines.h"

using namespace storage;
using namespace std;
@@ -53,7 +54,7 @@
fstab->getFileBasedLoops( getStorage()->root(), l );
if( !l.empty() )
{
- SystemCmd c( "losetup -a" );
+ SystemCmd c(LOSETUPBIN " -a");
for( list<FstabEntry>::const_iterator i=l.begin(); i!=l.end(); ++i )
{
y2mil( "i:" << *i );

Modified: trunk/storage/libstorage/src/LvmVg.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmVg.cc (original)
+++ trunk/storage/libstorage/src/LvmVg.cc Mon Aug 4 18:34:26 2008
@@ -497,7 +497,7 @@
void LvmVg::getVgData( const string& name, bool exists )
{
y2milestone( "name:%s", name.c_str() );
- SystemCmd c(VGDISPLAYBIN " --units k -v " + name);
+ SystemCmd c(VGDISPLAYBIN " --units k -v " + quote(name));
unsigned cnt = c.numLines();
unsigned i = 0;
num_lv = 0;
@@ -1010,7 +1010,7 @@
rmdir( ddir.c_str() );
}
string cmd = VGCREATEBIN " " + instSysString() + metaString() +
- "-s " + decString(pe_size) + "k " + name() + " " +
devices;
+ "-s " + decString(pe_size) + "k " + quote(name()) + " " +
quote(devices);
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1088,7 +1088,7 @@
ret = doCreatePv( *d );
if( ret==0 )
{
- string cmd = "vgextend " + instSysString() + name() + " " + *d;
+ string cmd = VGEXTENDBIN " " + instSysString() + quote(name()) + "
" + quote(*d);
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1137,7 +1137,7 @@
{
getStorage()->showInfoCb( reduceVgText(true,*d) );
}
- string cmd = "vgreduce " + instSysString() + name() + " " + *d;
+ string cmd = VGREDUCEBIN " " + instSysString() + quote(name()) + " " +
quote(*d);
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1183,8 +1183,8 @@
if( l->stripeSize()>0 )
cmd += " -I " + decString(l->stripeSize());
}
- cmd += " -n " + l->name();
- cmd += " " + name();
+ cmd += " -n " + quote(l->name());
+ cmd += " " + quote(name());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1224,7 +1224,7 @@
ret = v->prepareRemove();
if( ret==0 )
{
- string cmd = LVREMOVEBIN " -f " + instSysString() + " " +
l->device();
+ string cmd = LVREMOVEBIN " -f " + instSysString() + " " +
quote(l->device());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1280,8 +1280,8 @@
ret = v->resizeFs();
if( ret==0 && old_le>new_le )
{
- string cmd = "lvreduce -f " + instSysString() +
- " -l -" + decString(old_le-new_le) + " " + l->device();
+ string cmd = LVREDUCEBIN " -f " + instSysString() +
+ " -l -" + decString(old_le-new_le) + " " + quote(l->device());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1291,8 +1291,8 @@
}
if( ret==0 && old_le<new_le )
{
- string cmd = "lvextend " + instSysString() +
- " -l +" + decString(new_le-old_le) + " " + l->device();
+ string cmd = LVEXTENDBIN " " + instSysString() +
+ " -l +" + decString(new_le-old_le) + " " + quote(l->device());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{

Modified: trunk/storage/libstorage/src/MdCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/MdCo.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/MdCo.cc (original)
+++ trunk/storage/libstorage/src/MdCo.cc Mon Aug 4 18:34:26 2008
@@ -11,6 +11,7 @@
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
#include "y2storage/EtcRaidtab.h"
+#include "y2storage/StorageDefines.h"

using namespace std;
using namespace storage;
@@ -571,14 +572,14 @@
string mdconf = tmpDir + "/mdadm.conf";
string cmd = "echo 1 > /sys/module/md_mod/parameters/start_ro";
c.execute( cmd );
- cmd = "mdadm --examine --scan --config=partitions >" + mdconf;
+ cmd = MDADMBIN " --examine --scan --config=partitions >" + mdconf;
c.execute( cmd );
- cmd = "mdadm --assemble --scan --config=" + mdconf;
+ cmd = MDADMBIN " --assemble --scan --config=" + mdconf;
c.execute( cmd );
}
else
{
- c.execute( "mdadm --stop --scan" );
+ c.execute(MDADMBIN " --stop --scan");
}
active = val;
}
@@ -629,9 +630,9 @@
{
string cmd;
SystemCmd c;
- cmd = "dd if=/dev/zero of=" + m->device() + " bs=1k count=200";
+ cmd = "dd if=/dev/zero of=" + quote(m->device()) + " bs=1k
count=200";
c.execute( cmd );
- cmd = "dd if=/dev/zero of=" + m->device() +
+ cmd = "dd if=/dev/zero of=" + quote(m->device()) +
" seek=" + decString(m->sizeK()-10) +
" bs=1k count=10";
c.execute( cmd );
@@ -661,7 +662,7 @@
ret = m->prepareRemove();
if( ret==0 )
{
- string cmd = "mdadm --stop " + m->device();
+ string cmd = MDADMBIN " --stop " + quote(m->device());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -676,7 +677,7 @@
m->getDevs( d );
for( list<string>::const_iterator i=d.begin(); i!=d.end(); ++i )
{
- c.execute( "mdadm --zero-superblock " + *i );
+ c.execute(MDADMBIN " --zero-superblock " + quote(*i));
}
}
if( ret==0 )

Modified: trunk/storage/libstorage/src/Storage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Mon Aug 4 18:34:26 2008
@@ -37,6 +37,7 @@
#include "y2storage/ProcPart.h"
#include "y2storage/EtcFstab.h"
#include "y2storage/AsciiFile.h"
+#include "y2storage/StorageDefines.h"

using namespace std;
using namespace storage;
@@ -286,7 +287,7 @@
SystemCmd rm;
for( unsigned i=0; i<c.numLines(); i++ )
{
- rm.execute( "mdadm --stop /dev/" + extractNthWord(0, *c.getLine(i))
);
+ rm.execute(MDADMBIN " --stop " + quote("/dev/" + extractNthWord(0,
*c.getLine(i))));
}
}
delete ppart;
@@ -421,14 +422,14 @@
void
Storage::detectMultipath()
{
- bool acc_ok = access( "/sbin/multipath", X_OK )==0;
+ bool acc_ok = access(MULTIPATHBIN, X_OK) == 0;
y2mil( "detectMultipath acc_ok:" << acc_ok );
if( acc_ok )
{
list<string> mp_list;
string line;
unsigned i=0;
- SystemCmd c( "/sbin/multipath -d -v 2+ -ll" );
+ SystemCmd c(MULTIPATHBIN " -d -v 2+ -ll");
if( i<c.numLines() )
line = *c.getLine(i);
while( i<c.numLines() )
@@ -855,7 +856,7 @@
{
y2milestone( "detectFsData begin" );
SystemCmd Blkid( "BLKID_SKIP_CHECK_MDRAID=1 /sbin/blkid -c /dev/null" );
- SystemCmd Losetup( "/sbin/losetup -a" );
+ SystemCmd Losetup(LOSETUPBIN " -a");
for( VolIterator i=begin; i!=end; ++i )
{
if( i->getUsedByType()==UB_NONE )
@@ -4343,9 +4344,9 @@
if( !todo.empty() )
{
SystemCmd c;
- c.execute( "dmsetup ls" );
- c.execute( "dmsetup table" );
- c.execute( "dmsetup info" );
+ c.execute(DMSETUPBIN " ls");
+ c.execute(DMSETUPBIN " table");
+ c.execute(DMSETUPBIN " info");
logProcData();
}
}
@@ -4437,7 +4438,7 @@
}
tfile.close();
c.execute( "cat " + fname );
- c.execute("dmsetup create " + quote(tblname) + " <" + fname);
+ c.execute(DMSETUPBIN " create " + quote(tblname) + " <" + fname);
unlink( fname.c_str() );
}
EvmsCo::activateDevices();
@@ -5278,7 +5279,7 @@
removeDmMapsTo( vol.getContainer()->device() );
if( vol.getContainer()->majorNr()>0 )
{
- string cmd = "dmsetup table | grep -w ";
+ string cmd = DMSETUPBIN " table | grep -w ";
cmd += decString(vol.getContainer()->majorNr()) + ":" +
decString(vol.getContainer()->minorNr());
cmd += " | sed s/:.*// | uniq";
@@ -5304,15 +5305,15 @@

bool Storage::removeDmTable( const string& table )
{
- SystemCmd c("dmsetup table " + quote(table));
+ SystemCmd c(DMSETUPBIN " table " + quote(table));
bool ret = false;
if( c.retcode()==0 )
{
- c.execute("dmsetup info " + quote(table));
- c.execute("dmsetup remove " + quote(table));
+ c.execute(DMSETUPBIN " info " + quote(table));
+ c.execute(DMSETUPBIN " remove " + quote(table));
waitForDevice();
ret = c.retcode()==0;
- c.execute("dmsetup table | grep " + quote(table));
+ c.execute(DMSETUPBIN " table | grep " + quote(table));
logProcData();
}
y2milestone( "ret:%d", ret );
@@ -6151,7 +6152,7 @@
}
if( ret && vol->getFs()==NTFS )
{
- SystemCmd c( "ntfsresize -f -i " + device );
+ SystemCmd c( "ntfsresize -f -i " + quote(device));
string fstr = " might resize at ";
string::size_type pos;
if( c.retcode()==0 &&

Modified: trunk/storage/libstorage/src/StorageDefines.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageDefines.h?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageDefines.h (original)
+++ trunk/storage/libstorage/src/StorageDefines.h Mon Aug 4 18:34:26 2008
@@ -11,10 +11,20 @@

#define LVCREATEBIN "/sbin/lvcreate"
#define LVREMOVEBIN "/sbin/lvremove"
+#define LVEXTENDBIN "/sbin/lvextend"
+#define LVREDUCEBIN "/sbin/lvreduce"

#define VGCREATEBIN "/sbin/vgcreate"
#define VGREMOVEBIN "/sbin/vgremove"
+#define VGEXTENDBIN "/sbin/vgextend"
+#define VGREDUCEBIN "/sbin/vgreduce"
#define VGDISPLAYBIN "/sbin/vgdisplay"

+#define CRYPTSETUPBIN "/sbin/cryptsetup"
+#define LOSETUPBIN "/sbin/losetup"
+#define MULTIPATHBIN "/sbin/multipath"
+#define DMSETUPBIN "/sbin/dmsetup"
+#define KPARTXBIN "/sbin/kpartx"
+

#endif

Modified: trunk/storage/libstorage/src/Volume.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=49656&r1=49655&r2=49656&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Mon Aug 4 18:34:26 2008
@@ -19,6 +19,7 @@
#include "y2storage/ProcPart.h"
#include "y2storage/OutputProcessor.h"
#include "y2storage/EtcFstab.h"
+#include "y2storage/StorageDefines.h"

using namespace std;
using namespace storage;
@@ -692,7 +693,7 @@
SystemCmd c;
string cmd = "/bin/dd if=";
cmd += (encryption!=ENC_NONE) ? "/dev/urandom" : "/dev/zero";
- cmd += " of=" + mountDevice() + " bs=1024 count=";
+ cmd += " of=" + quote(mountDevice()) + " bs=1024 count=";
cmd += decString(min(200ull,size_k));
if( c.execute( cmd ) != 0 )
ret = VOLUME_FORMAT_DD_FAILED;
@@ -720,7 +721,7 @@
mountDevice().find( "/dev/loop" )!=0 )
{
SystemCmd c;
- c.execute( "mdadm --zero-superblock " + mountDevice() );
+ c.execute(MDADMBIN " --zero-superblock " + quote(mountDevice()));
}
if( ret==0 )
{
@@ -802,7 +803,7 @@
{
if (!tunefs_opt.empty())
{
- string cmd = "/sbin/tune2fs " + tunefs_opt + " " + mountDevice();
+ string cmd = "/sbin/tune2fs " + tunefs_opt + " " +
quote(mountDevice());
SystemCmd c( cmd );
if( c.retcode()!=0 )
ret = VOLUME_TUNE2FS_FAILED;
@@ -826,7 +827,7 @@
{
if (!tunefs_opt.empty())
{
- string cmd = "/sbin/reiserfstune " + tunefs_opt + " " +
mountDevice();
+ string cmd = "/sbin/reiserfstune " + tunefs_opt + " " +
quote(mountDevice());
SystemCmd c( cmd );
if( c.retcode()!=0 )
ret = VOLUME_TUNE2FS_FAILED;
@@ -872,7 +873,7 @@

void Volume::updateFsData()
{
- SystemCmd Blkid( "BLKID_SKIP_CHECK_MDRAID=1 /sbin/blkid -c /dev/null " +
mountDevice() );
+ SystemCmd Blkid("BLKID_SKIP_CHECK_MDRAID=1 /sbin/blkid -c /dev/null " +
quote(mountDevice()));
getFsData( Blkid );
}

@@ -962,7 +963,7 @@
{
if( !loop_dev.empty() )
{
- SystemCmd c( "losetup -d " + loop_dev );
+ SystemCmd c(LOSETUPBIN " -d " + quote(loop_dev));
if( c.retcode()!=0 )
ret = VOLUME_LOUNSETUP_FAILED;
else
@@ -987,7 +988,7 @@
table.erase( 0, table.find_last_of( '/' )+1 );
if( !table.empty() )
{
- SystemCmd c("cryptsetup remove " + quote(table));
+ SystemCmd c(CRYPTSETUPBIN " remove " + quote(table));
if( c.retcode()!=0 )
ret = VOLUME_CRYPTUNSETUP_FAILED;
else
@@ -1191,7 +1192,7 @@
int ret = 0;
if( encryption!=ENC_NONE && !dmcrypt_dev.empty() )
{
- cmd = "cryptsetup resize ";
+ cmd = CRYPTSETUPBIN " resize ";
cmd += dmcrypt_dev.substr(dmcrypt_dev.rfind( '/' )+1);
c.execute( cmd );
}
@@ -1460,7 +1461,7 @@
int ret = 0;
if( loop_dev.empty() )
{
- SystemCmd c( "losetup -a" );
+ SystemCmd c(LOSETUPBIN " -a" );
ret = getFreeLoop( c );
}
y2milestone( "ret:%d", ret );
@@ -1469,10 +1470,7 @@

string Volume::getLosetupCmd( storage::EncryptType, const string& pwdfile )
const
{
- string cmd = "/sbin/losetup";
- cmd += " ";
- cmd += loop_dev;
- cmd += " ";
+ string cmd = LOSETUPBIN " " + quote(loop_dev) + " ";
const Loop* l = static_cast<const Loop*>(this);
cmd += l->lfileRealPath();
y2milestone( "cmd:%s", cmd.c_str() );
@@ -1488,7 +1486,7 @@
" format:" << format << " pwempty:" << empty_pwd );
if( table.find( '/' )!=string::npos )
table.erase( 0, table.find_last_of( '/' )+1 );
- string cmd = "/sbin/cryptsetup -q";
+ string cmd = CRYPTSETUPBIN " -q";

if( format )
{
@@ -1667,8 +1665,8 @@
{
string lfile;
if( getLoopFile( lfile ))
- c.execute( "losetup " + loop_dev + " " +
- cont->getStorage()->root() + lfile );
+ c.execute(LOSETUPBIN " " + quote(loop_dev) + " " +
+ quote(cont->getStorage()->root() + lfile));
}
string cmd = getCryptsetupCmd( try_order[pos], dmcrypt_dev, "", fname,
false );
c.execute( "modprobe dm-crypt" );
@@ -1799,7 +1797,7 @@
{
if( loop_dev.size()>0 )
{
- SystemCmd c( "losetup -d " + loop_dev );
+ SystemCmd c(LOSETUPBIN " -d " + quote(loop_dev));
loop_dev.erase();
}
updateFstabOptions();

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages