diff options
| author | Mattias Andrée <maandree@operamail.com> | 2012-12-28 07:06:14 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2012-12-28 07:06:14 +0100 |
| commit | b5ffb3f063a8a3afbf9cb625435b8c3148d05972 (patch) | |
| tree | 0c6705a0787dbc275cdfb24ddbae51f327db09e0 /bootcleanse.py | |
| parent | first commit (diff) | |
| download | bootcleanse-b5ffb3f063a8a3afbf9cb625435b8c3148d05972.tar.gz bootcleanse-b5ffb3f063a8a3afbf9cb625435b8c3148d05972.tar.bz2 bootcleanse-b5ffb3f063a8a3afbf9cb625435b8c3148d05972.tar.xz | |
interactive part of removal of mbr code
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'bootcleanse.py')
| -rw-r--r-- | bootcleanse.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bootcleanse.py b/bootcleanse.py new file mode 100644 index 0000000..a65229f --- /dev/null +++ b/bootcleanse.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys +from subprocess import Popen, PIPE + + +mbr = [] + +for arg in sys.argv[1:]: + mbr.append(mbr) + print('Remove MBR code from ' + arg) + if not (('a' <= arg[-1]) and (arg[-1] <= 'z') and (arg[:-1] in ('/dev/sd', '/dev/hd'))): + print('\033[01;33mWarning:\033[21;39m Does not match /dev/(sd|hd)[a-z]') + +print() +print('If you are not sure what you are doing, you may want') +print('to back up the first 512 of each defected file.') +print('To back up run `dd if=DEVICE bs=512 count=1 > DEV.backup`.') +print('To restore run `dd of=DEVICE bs=512 count=1 is=DEV.backup`.') +print() +print('\033[01mProcessed? [yes/no]\033[21m') + +while True: + yn = input() + if yn == 'yes': + break + if yn == 'no': + exit(128) + print('Only ‘yes’ and ‘no’ is valid') + |
