Compare commits
5 Commits
5d2094939b
...
1.1.2
Author | SHA1 | Date | |
---|---|---|---|
87a859f187 | |||
952e8c8eeb | |||
1055ef57ee | |||
6dd4c44688 | |||
feed1b4a97 |
@ -34,6 +34,7 @@ public:
|
|||||||
} sShredSpeed;
|
} sShredSpeed;
|
||||||
|
|
||||||
bool bWasShredded = false; // all shred iterations done
|
bool bWasShredded = false; // all shred iterations done
|
||||||
|
bool bWasShredStarted = false; // shred was atleast once started
|
||||||
bool bWasChecked = false; // all shred iterations and optional checking done
|
bool bWasChecked = false; // all shred iterations and optional checking done
|
||||||
bool bWasDeleted = false;
|
bool bWasDeleted = false;
|
||||||
bool bIsOffline = false;
|
bool bIsOffline = false;
|
||||||
|
@ -32,6 +32,9 @@ void Delete::deleteDrive(Drive *drive)
|
|||||||
const char *cpComand = sCMD.c_str();
|
const char *cpComand = sCMD.c_str();
|
||||||
// cout << "delete: " << cpComand << endl;
|
// cout << "delete: " << cpComand << endl;
|
||||||
|
|
||||||
|
if (drive->bWasShredStarted == false)
|
||||||
|
{
|
||||||
|
//only start delete if the drive was not shredded before
|
||||||
FILE *deleteCmdOutput = popen(cpComand, "r");
|
FILE *deleteCmdOutput = popen(cpComand, "r");
|
||||||
|
|
||||||
while ((getline(&cLine, &len, deleteCmdOutput)) != -1)
|
while ((getline(&cLine, &len, deleteCmdOutput)) != -1)
|
||||||
@ -40,3 +43,4 @@ void Delete::deleteDrive(Drive *drive)
|
|||||||
}
|
}
|
||||||
pclose(deleteCmdOutput);
|
pclose(deleteCmdOutput);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -36,6 +36,7 @@ int Shred::shredDrive(Drive *drive, int *ipSignalFd)
|
|||||||
ostringstream address;
|
ostringstream address;
|
||||||
address << (void const *)&(*drive);
|
address << (void const *)&(*drive);
|
||||||
Logger::logThis()->info("Shred-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str());
|
Logger::logThis()->info("Shred-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str());
|
||||||
|
drive->bWasShredStarted = true; //Mark drive as partly shredded
|
||||||
|
|
||||||
#ifdef DRYRUN
|
#ifdef DRYRUN
|
||||||
for (int i = 0; i <= 500; i++)
|
for (int i = 0; i <= 500; i++)
|
||||||
@ -48,6 +49,7 @@ int Shred::shredDrive(Drive *drive, int *ipSignalFd)
|
|||||||
write(*ipSignalFd, "A", 1);
|
write(*ipSignalFd, "A", 1);
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
}
|
}
|
||||||
|
drive->bWasShredded = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DRYRUN
|
#ifndef DRYRUN
|
||||||
|
@ -613,6 +613,7 @@ void TUI::vTruncateText(string *psText, uint16_t u16MaxLenght)
|
|||||||
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
||||||
{
|
{
|
||||||
struct MenuState menustate;
|
struct MenuState menustate;
|
||||||
|
static bool dialogIsActive;
|
||||||
menustate.bAbort = false;
|
menustate.bAbort = false;
|
||||||
menustate.bConfirmDelete = false;
|
menustate.bConfirmDelete = false;
|
||||||
menustate.bConfirmShred = false;
|
menustate.bConfirmShred = false;
|
||||||
@ -659,15 +660,21 @@ void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY)
|
|||||||
{
|
{
|
||||||
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm SHRED", "Press ENTER for SHRED", "Press ESC for cancel");
|
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm SHRED", "Press ENTER for SHRED", "Press ESC for cancel");
|
||||||
wrefresh(dialog);
|
wrefresh(dialog);
|
||||||
|
dialogIsActive = true;
|
||||||
}
|
}
|
||||||
else if (menustate.bConfirmDelete == true)
|
else if (menustate.bConfirmDelete == true)
|
||||||
{
|
{
|
||||||
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm DELETE", "Press ENTER for DELETE", "Press ESC for cancel");
|
dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm DELETE", "Press ENTER for DELETE", "Press ESC for cancel");
|
||||||
wrefresh(dialog);
|
wrefresh(dialog);
|
||||||
|
dialogIsActive = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (dialogIsActive)
|
||||||
{
|
{
|
||||||
delwin(dialog);
|
delwin(dialog);
|
||||||
|
dialogIsActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user