15#include <zypp-media/Mount>
50 MIL <<
"MediaISO::MediaISO(" << url_r <<
", "
51 << attach_point_hint_r <<
")" << std::endl;
56 ERR <<
"Media url does not contain iso filename" << std::endl;
57 ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
66 const std::string & arg { _url.getQueryParam(
"url") };
69 src.setPathName( _isofile.dirname() );
70 _isofile = _isofile.basename();
78 ERR <<
"Unable to parse iso filename source media url" << std::endl;
79 MediaBadUrlException ne(_url);
86 ERR <<
"Invalid iso filename source media url" << std::endl;
87 ZYPP_THROW(MediaBadUrlException(src));
89 if( src.getScheme() ==
"iso")
91 ERR <<
"ISO filename source media url with iso scheme (nested iso): "
92 << src.asString() << std::endl;
93 ZYPP_THROW(MediaUnsupportedUrlSchemeException(src));
96 if( !(src.getScheme() ==
"hd" ||
97 src.getScheme() ==
"dir" ||
98 src.getScheme() ==
"file" ||
99 src.getScheme() ==
"nfs" ||
100 src.getScheme() ==
"nfs4" ||
101 src.getScheme() ==
"smb" ||
102 src.getScheme() ==
"cifs"))
104 ERR <<
"ISO filename source media url scheme is not supported: "
105 << src.asString() << std::endl;
106 ZYPP_THROW(MediaUnsupportedUrlSchemeException(src));
115 MediaISO::~MediaISO()
123 DBG <<
"Closing parent handler..." << std::endl;
125 if(manager.
isOpen(_parentId))
126 manager.
close(_parentId);
136 MediaISO::isAttached()
const
138 return checkAttached(
false);
142 void MediaISO::attachTo(
bool next)
148 manager.
attach(_parentId);
167 "Unable to find iso filename on source media",
189 DBG <<
"Using a shared media "
200 if( !isUseableAttachPoint( attachPoint() ) )
202 setAttachPoint( createAttachPoint(),
true );
204 std::string mountpoint( attachPoint().
asString() );
205 std::string mountopts(
"ro,loop");
209 _filesystem, mountopts);
211 setMediaSource(media);
216 bool mountsucceeded =
false;
217 while( !(mountsucceeded=isAttached()) && --limit)
235 "Unable to verify that the media was mounted",
243 void MediaISO::releaseFrom(
const std::string & ejectDev)
260 WAR <<
"Not been able to cleanup the parent mount." << endl;
271 MediaHandler::getFile(file);
276 bool recurse_r)
const
278 MediaHandler::getDir(dirname, recurse_r);
282 void MediaISO::getDirInfo(std::list<std::string> &retlist,
286 MediaHandler::getDirInfo( retlist, dirname, dots );
294 MediaHandler::getDirInfo(retlist, dirname, dots);
297 bool MediaISO::getDoesFileExist(
const Pathname & filename )
const
299 return MediaHandler::getDoesFileExist( filename );
Base class for Exception.
void remember(const Exception &old_r)
Store an other Exception as history.
std::string asString() const
Returns a default string representation of the Url object.
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 std::string & asString() const
String representation.
bool empty() const
Test for an empty path.
Base class for all URL exceptions.
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.