Compare commits
	
		
			7 Commits
		
	
	
		
			1.1.2
			...
			d8584486b9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d8584486b9 | |||
| 20d0dd8e90 | |||
| 1ec4a2c793 | |||
| a0c842d90d | |||
| 1ceffa56f8 | |||
| 4ff1888333 | |||
| 4b33fb6fdb | 
| @ -9,7 +9,7 @@ | ||||
| * process multiple drives at once | ||||
|  | ||||
| ## Download USB Image ## | ||||
| [2.5GB image v1.0.0](https://schuttercloud.com/s/ggxGH9sA326aRfK)   (`wget` is your friend) | ||||
| See reHDD-Bootable how the live image created: https://git.mosad.xyz/localhorst/reHDD-Bootable | ||||
|  | ||||
| Use [Etcher](https://www.balena.io/etcher/#download) or `dd` to create an bootable USB drive . | ||||
|  | ||||
|  | ||||
| @ -8,7 +8,7 @@ | ||||
| #ifndef REHDD_H_ | ||||
| #define REHDD_H_ | ||||
|  | ||||
| #define REHDD_VERSION "V1.1.2" | ||||
| #define REHDD_VERSION "V1.2.0" | ||||
|  | ||||
| // Drive handling Settings | ||||
| #define WORSE_HOURS 19200    // mark drive if at this limit or beyond | ||||
| @ -25,13 +25,13 @@ | ||||
| #define SOFTWARE_VERSION REHDD_VERSION | ||||
| #define HARDWARE_VERSION "generic" | ||||
|  | ||||
| // #define LOG_LEVEL_HIGH  //log everything, like drive scan thread | ||||
| // #define LOG_LEVEL_HIGH // log everything, like drive scan thread | ||||
| #ifndef LOG_LEVEL_HIGH | ||||
| #define LOG_LEVEL_LOW // log only user actions and tasks | ||||
| #endif | ||||
|  | ||||
| // 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 ZERO_CHECK   // check drive after shred if all bytes are zero, show alert if this fails | ||||
|  | ||||
| @ -86,6 +86,7 @@ private: | ||||
|     static void searchDrives(list<Drive> *plistDrives); | ||||
|     static void printDrives(list<Drive> *plistDrives); | ||||
|     static void startShredAllDrives(list<Drive> *plistDrives); | ||||
|     static void stopShredAllDrives(list<Drive> *plistDrives); | ||||
|     static void updateShredMetrics(list<Drive> *plistDrives); | ||||
|     static void filterIgnoredDrives(list<Drive> *plistDrives); | ||||
|     static void filterInvalidDrives(list<Drive> *plistDrives); | ||||
|  | ||||
| @ -31,6 +31,7 @@ public: | ||||
|         Delete, | ||||
|         Enter, | ||||
|         ESC, | ||||
|         Terminate, | ||||
|         Undefined | ||||
|     }; | ||||
|     struct MenuState | ||||
|  | ||||
| @ -197,6 +197,12 @@ void reHDD::ThreadUserInput() | ||||
|             handleESC(); | ||||
|             ui->updateTUI(&listDrives, u8SelectedEntry); | ||||
|             break; | ||||
|         case TUI::UserInput::Terminate: | ||||
|             cout << "Terminate" << endl; | ||||
|             stopShredAllDrives(&listDrives); | ||||
|             sleep(5);     // sleep 5 sec | ||||
|             std::exit(1); // Terminates main, doesn't wait for threads | ||||
|             break; | ||||
|         default: | ||||
|             break; | ||||
|         } | ||||
| @ -464,6 +470,34 @@ void reHDD::startShredAllDrives(list<Drive> *plistDrives) | ||||
|     mxDrives.unlock(); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * \brief   stop shred for all drives | ||||
|  * \param	pointer of list <Drive>* plistDrives | ||||
|  * \return  void | ||||
|  */ | ||||
| void reHDD::stopShredAllDrives(list<Drive> *plistDrives) | ||||
| { | ||||
|     list<Drive>::iterator it; | ||||
|     mxDrives.lock(); | ||||
|     for (it = plistDrives->begin(); it != plistDrives->end(); ++it) | ||||
|     { | ||||
|  | ||||
|         if (it->state == Drive::SHRED_ACTIVE || it->state == Drive::DELETE_ACTIVE) | ||||
|         { | ||||
|             it->state = Drive::NONE; | ||||
|             Logger::logThis()->info("Abort-Shred-Signal for: " + it->getModelName() + "-" + it->getSerial()); | ||||
|             // task for drive is running --> remove selection | ||||
|         } | ||||
|  | ||||
| #ifdef LOG_LEVEL_HIGH | ||||
|         ostringstream address; | ||||
|         address << (void const *)&(*it); | ||||
|         Logger::logThis()->info("Started shred (all) for: " + it->getModelName() + "-" + it->getSerial() + " @" + address.str()); | ||||
| #endif | ||||
|     } | ||||
|     mxDrives.unlock(); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * \brief   print drives with all information | ||||
|  * \param	pointer of list <Drive>* plistDrives | ||||
| @ -665,6 +699,12 @@ bool reHDD::getSystemDrive(string &systemDrive) | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|         if (currentLine.ends_with(" /run/overlay/live\n"s)) | ||||
|         { | ||||
|             systemDriveFound = true; | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|         if (currentLine.ends_with(" /\n"s)) | ||||
|         { | ||||
|             systemDriveFound = true; | ||||
|  | ||||
| @ -187,7 +187,7 @@ int Shred::shredDrive(Drive *drive, int *ipSignalFd) | ||||
|     Logger::logThis()->info("Check-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str()); | ||||
|     drive->u32DriveChecksumAfterShredding = uiCalcChecksum(driveFileDiscr, drive, ipSignalFd); | ||||
| #ifdef LOG_LEVEL_HIGH | ||||
|     if (drive->u32DriveChecksumAferShredding != 0) | ||||
|     if (drive->u32DriveChecksumAfterShredding != 0) | ||||
|     { | ||||
|         Logger::logThis()->info("Shred-Task: Checksum not zero: " + to_string(drive->u32DriveChecksumAfterShredding) + " - Drive: " + drive->getSerial()); | ||||
|     } | ||||
|  | ||||
| @ -237,6 +237,9 @@ enum TUI::UserInput TUI::readUserInput() | ||||
|     case 'S': | ||||
|         return TUI::UserInput::ShredAll; | ||||
|         break; | ||||
|     case 'T': | ||||
|         return TUI::UserInput::Terminate; | ||||
|         break; | ||||
|     default: | ||||
|         return TUI::UserInput::Undefined; | ||||
|         break; | ||||
| @ -482,8 +485,12 @@ WINDOW *TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, st | ||||
|     { | ||||
|         string sLineTmp = "Press d for Delete"; | ||||
|         mvwaddstr(newWindow, u16Line++, (iXSize / 2) - (sLineTmp.size() / 2), sLineTmp.c_str()); | ||||
|         u16Line++; | ||||
|     } | ||||
|  | ||||
|     string sLineTmp = "Press T for terminating reHDD"; | ||||
|     mvwaddstr(newWindow, u16Line++, (iXSize / 2) - (sLineTmp.size() / 2), sLineTmp.c_str()); | ||||
|  | ||||
|     return newWindow; | ||||
| } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user