Compare commits
No commits in common. "5d2094939b0257824b981d7a5dfbd5d4d859a0cb" and "282c294ae74ee26e1e53e5e0d2a8f82aaad29b2e" have entirely different histories.
5d2094939b
...
282c294ae7
@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Logic
|
// Logic
|
||||||
//#define DRYRUN // don't touch the drives
|
//#define DRYRUN //don´t touch the drives
|
||||||
#define FROZEN_ALERT // show alert if drive is frozen
|
#define FROZEN_ALERT // show alert if drive is frozen
|
||||||
#define ZERO_CHECK // check drive after shred if all bytes are zero, show alert if this fails
|
#define ZERO_CHECK // check drive after shred if all bytes are zero, show alert if this fails
|
||||||
|
|
||||||
@ -101,7 +101,6 @@ private:
|
|||||||
static void handleESC();
|
static void handleESC();
|
||||||
static void handleAbort();
|
static void handleAbort();
|
||||||
static Drive *getSelectedDrive();
|
static Drive *getSelectedDrive();
|
||||||
static bool getSystemDrive(string &systemDrive);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REHDD_H_
|
#endif // REHDD_H_
|
||||||
|
@ -344,26 +344,6 @@ void reHDD::searchDrives(list<Drive> *plistDrives)
|
|||||||
*/
|
*/
|
||||||
void reHDD::filterIgnoredDrives(list<Drive> *plistDrives)
|
void reHDD::filterIgnoredDrives(list<Drive> *plistDrives)
|
||||||
{
|
{
|
||||||
string systemDrivePath;
|
|
||||||
if (getSystemDrive(systemDrivePath))
|
|
||||||
{
|
|
||||||
// Logger::logThis()->info("Found system drive: " + systemDrivePath);
|
|
||||||
|
|
||||||
list<Drive>::iterator it;
|
|
||||||
for (it = plistDrives->begin(); it != plistDrives->end(); ++it)
|
|
||||||
{
|
|
||||||
if (it->getPath().find(systemDrivePath) != std::string::npos) // compare found system drive and current drive
|
|
||||||
{
|
|
||||||
// system drive found --> ignore this drive
|
|
||||||
#ifdef LOG_LEVEL_HIGH
|
|
||||||
Logger::logThis()->info("system drive found --> ignore this drive: " + it->getPath());
|
|
||||||
#endif
|
|
||||||
it = plistDrives->erase(it);
|
|
||||||
it--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list<tuple<string>> vtlIgnoredDevices; // store drives from ignore file
|
list<tuple<string>> vtlIgnoredDevices; // store drives from ignore file
|
||||||
ifstream input("ignoreDrives.conf"); // read ignore file
|
ifstream input("ignoreDrives.conf"); // read ignore file
|
||||||
|
|
||||||
@ -625,53 +605,3 @@ void reHDD::handleAbort()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reHDD::getSystemDrive(string &systemDrive)
|
|
||||||
{
|
|
||||||
char *cLine = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
bool systemDriveFound = false;
|
|
||||||
|
|
||||||
FILE *outputfileHwinfo = popen("lsblk -e 11 -o NAME,MOUNTPOINT", "r");
|
|
||||||
|
|
||||||
if (outputfileHwinfo == NULL)
|
|
||||||
{
|
|
||||||
Logger::logThis()->error("Unable to scan attached drives for system drive");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((getline(&cLine, &len, outputfileHwinfo)) != -1)
|
|
||||||
{
|
|
||||||
string currentLine = cLine;
|
|
||||||
|
|
||||||
if (currentLine.find("NAME") != std::string::npos)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger::logThis()->info(currentLine);
|
|
||||||
|
|
||||||
if ((cLine[0U] != '|') && (cLine[0U] != '`'))
|
|
||||||
{
|
|
||||||
systemDrive = currentLine;
|
|
||||||
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '\n'), systemDrive.end()); // remove newline
|
|
||||||
systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), ' '), systemDrive.end()); // remove spaces
|
|
||||||
// Logger::logThis()->info("Drive found: " + systemDrive);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentLine.ends_with(" /boot/efi\n"s))
|
|
||||||
{
|
|
||||||
systemDriveFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentLine.ends_with(" /\n"s))
|
|
||||||
{
|
|
||||||
systemDriveFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pclose(outputfileHwinfo);
|
|
||||||
|
|
||||||
return systemDriveFound;
|
|
||||||
}
|
|
@ -36,7 +36,7 @@ void SMART::readSMARTData(Drive *drive)
|
|||||||
sCMD.append(drive->getPath());
|
sCMD.append(drive->getPath());
|
||||||
const char *cpComand = sCMD.c_str();
|
const char *cpComand = sCMD.c_str();
|
||||||
|
|
||||||
//Logger::logThis()->info(cpComand);
|
// Logger::logThis()->info(cpComand);
|
||||||
|
|
||||||
FILE *outputfileSmart = popen(cpComand, "r");
|
FILE *outputfileSmart = popen(cpComand, "r");
|
||||||
size_t len = 0U; // length of found line
|
size_t len = 0U; // length of found line
|
||||||
@ -63,7 +63,7 @@ void SMART::readSMARTData(Drive *drive)
|
|||||||
if (status == 0U)
|
if (status == 0U)
|
||||||
{
|
{
|
||||||
// Found S.M.A.R.T. data with this command
|
// Found S.M.A.R.T. data with this command
|
||||||
//Logger::logThis()->info("Found S.M.A.R.T. data with this command");
|
// Logger::logThis()->info("Found S.M.A.R.T. data with this command");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user