From 861f4465e604b40e7744dc090d6cddb26746f046 Mon Sep 17 00:00:00 2001 From: Ejner Fergo <efer@dtu.dk> Date: Wed, 4 Jul 2018 22:01:05 +0200 Subject: [PATCH] add copyright, license and version --- ssd-eraser | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ssd-eraser b/ssd-eraser index 7478b25..7027f24 100755 --- a/ssd-eraser +++ b/ssd-eraser @@ -1,4 +1,16 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 +# +# Copyright (c) 2018 Ejner Fergo efer@dtu.dk +# +# License: This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. This program is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +__version__ = '0.1' import os from time import sleep @@ -20,14 +32,16 @@ C = pyudev.Context() DISKS = [] DINFO = {} for device in C.list_devices(subsystem='block', DEVTYPE='disk'): + dev = device.device_node # Ignore USB and CDROM if device.get('ID_BUS') == 'ata' and device.get('ID_TYPE') == 'disk': + # Ignore HDD if device.get('ID_ATA_ROTATION_RATE_RPM') == '0': - DISKS.append(device.device_node) - DINFO[device.device_node] = device.get('ID_MODEL'), 'SSD' + DISKS.append(dev) + DINFO[dev] = device.get('ID_MODEL'), 'SSD' if 'nvme' in device.get('DEVNAME'): - DISKS.append(device.device_node) - DINFO[device.device_node] = device.get('ID_SERIAL'), 'NVMe' + DISKS.append(dev) + DINFO[dev] = device.get('ID_SERIAL'), 'NVMe' # Colours RED = '\033[91m' -- GitLab