13#include <zypp/base/Logger.h>
14#include <zypp/base/String.h>
15#include <zypp-media/Mount>
33#define DELAYED_VERIFY 1
54 const Pathname & attach_point_hint_r )
59 MIL <<
"MediaDISK::MediaDISK(" << url_r <<
", " << attach_point_hint_r <<
")" << endl;
64 ERR <<
"Media url does not contain a device specification" << std::endl;
68 DBG <<
"Verify of " <<
_device <<
" delayed" << std::endl;
92 if( dev_name.
empty() ||
93 dev_name.
asString().compare(0,
sizeof(
"/dev/")-1,
"/dev/"))
95 ERR <<
"Specified device name " << dev_name
96 <<
" is not allowed" << std::endl;
101 if( !dev_info.
isBlk())
103 ERR <<
"Specified device name " << dev_name
104 <<
" is not a block device" << std::endl;
110 Pathname dpath(
"/dev/disk/by-uuid");
111 std::list<Pathname> dlist;
114 std::list<Pathname>::const_iterator it;
115 for(it = dlist.begin(); it != dlist.end(); ++it)
121 DBG <<
"Specified device name " << dev_name
122 <<
" is a volume (disk/by-uuid link "
123 << vol_info.
path() <<
")"
134 Pathname dpath(
"/dev/disk/by-label");
135 std::list<Pathname> dlist;
138 std::list<Pathname>::const_iterator it;
139 for(it = dlist.begin(); it != dlist.end(); ++it)
145 DBG <<
"Specified device name " << dev_name
146 <<
" is a volume (disk/by-label link "
147 << vol_info.
path() <<
")"
158 args.push_back(
"blkid" );
159 args.push_back(
"-p" );
160 args.push_back( dev_name.
asString() );
164 if ( cmd.
close() != 0 )
167 <<
"Specified device name " << dev_name
168 <<
" is not a usable disk volume"
197 if(!dev_info.
isBlk())
200 DBG <<
"Verifying " <<
_device <<
" ..." << std::endl;
219 DBG <<
"Using a shared media "
233 MountEntries::const_iterator e;
234 for( e = entries.begin(); e != entries.end(); ++e)
236 bool is_device =
false;
240 if( dev_path.compare(0,
sizeof(
"/dev/")-1,
"/dev/") == 0 &&
241 dev_info(e->src) && dev_info.
isBlk())
246 if( is_device && media->maj_nr == dev_info.
devMajor() &&
247 media->min_nr == dev_info.
devMinor())
252 DBG <<
"Using a system mounted media "
280 if( !media->bdir.empty())
283 mount.
mount(media->bdir, mountpoint,
"none", options);
296 while( !(mountsucceeded=
isAttached()) && --limit)
313 "Unable to verify that the media was mounted",
383 const Pathname & dirname,
bool dots )
const
397 const Pathname & dirname,
bool dots )
const
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
std::vector< std::string > Arguments
const std::string & execError() const
Some detail telling why the execution failed, if it failed.
int close()
Wait for the progamm to complete.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
Wrapper class for ::stat/::lstat.
const Pathname & path() const
Return current Pathname.
unsigned int devMinor() const
unsigned int devMajor() const
const std::string & asString() const
String representation.
bool empty() const
Test for an empty path.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
std::list< DirEntry > DirContent
Returned by readdir.
Easy-to use interface to the ZYPP dependency resolver.
std::string asString(const Patch::Category &obj)
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.