4 #include <apt-pkg/macros.h>
11 #ifndef APT_8_CLEANER_HEADERS
12 #include <apt-pkg/init.h>
19 class pkgCdromStatus
/*{{{*/
25 pkgCdromStatus() : totalSteps(0) {};
26 virtual ~pkgCdromStatus() {};
29 virtual void SetTotal(int total
) { totalSteps
= total
; };
30 // update steps, will be called regularly as a "pulse"
31 virtual void Update(std::string text
="", int current
=0) = 0;
33 // ask for cdrom insert
34 virtual bool ChangeCdrom() = 0;
36 virtual bool AskCdromName(std::string
&Name
) = 0;
37 // Progress indicator for the Index rewriter
38 virtual OpProgress
* GetOpProgress() {return NULL
; };
41 class pkgCdrom
/*{{{*/
58 bool FindPackages(std::string CD
,
59 std::vector
<std::string
> &List
,
60 std::vector
<std::string
> &SList
,
61 std::vector
<std::string
> &SigList
,
62 std::vector
<std::string
> &TransList
,
63 std::string
&InfoDir
, pkgCdromStatus
*log
,
64 unsigned int Depth
= 0);
65 bool DropBinaryArch(std::vector
<std::string
> &List
);
66 bool DropRepeats(std::vector
<std::string
> &List
,const char *Name
);
67 bool DropTranslation(std::vector
<std::string
> &List
);
68 void ReduceSourcelist(std::string CD
,std::vector
<std::string
> &List
);
69 bool WriteDatabase(Configuration
&Cnf
);
70 bool WriteSourceList(std::string Name
,std::vector
<std::string
> &List
,bool Source
);
71 int Score(std::string Path
);
74 bool Ident(std::string
&ident
, pkgCdromStatus
*log
);
75 bool Add(pkgCdromStatus
*log
);
78 APT_HIDDEN
bool MountAndIdentCDROM(Configuration
&Database
, std::string
&CDROM
,
79 std::string
&ident
, pkgCdromStatus
* const log
, bool const interactive
);
84 // class that uses libudev to find cdrom/removable devices dynamically
85 struct CdromDevice
/*{{{*/
87 std::string DeviceName
;
89 std::string MountPath
;
92 class pkgUdevCdromDevices
/*{{{*/
95 // libudev dlopen structure
97 struct udev
* (*udev_new
)(void);
98 int (*udev_enumerate_add_match_property
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
99 int (*udev_enumerate_scan_devices
)(struct udev_enumerate
*udev_enumerate
);
100 struct udev_list_entry
* (*udev_enumerate_get_list_entry
)(struct udev_enumerate
*udev_enumerate
);
101 struct udev_device
* (*udev_device_new_from_syspath
)(struct udev
*udev
, const char *syspath
);
102 struct udev
* (*udev_enumerate_get_udev
)(struct udev_enumerate
*udev_enumerate
);
103 const char* (*udev_list_entry_get_name
)(struct udev_list_entry
*list_entry
);
104 const char* (*udev_device_get_devnode
)(struct udev_device
*udev_device
);
105 struct udev_enumerate
*(*udev_enumerate_new
) (struct udev
*udev
);
106 struct udev_list_entry
*(*udev_list_entry_get_next
)(struct udev_list_entry
*list_entry
);
107 const char* (*udev_device_get_property_value
)(struct udev_device
*udev_device
, const char *key
);
108 int (*udev_enumerate_add_match_sysattr
)(struct udev_enumerate
*udev_enumerate
, const char *property
, const char *value
);
109 // end libudev dlopen
112 pkgUdevCdromDevices();
113 virtual ~pkgUdevCdromDevices();
118 // convenience interface, this will just call ScanForRemovable
119 // with "APT::cdrom::CdromOnly"
120 std::vector
<CdromDevice
> Scan();
122 std::vector
<CdromDevice
> ScanForRemovable(bool CdromOnly
);