diff options
| author | Mattias Andrée <maandree@operamail.com> | 2013-01-23 21:20:03 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2013-01-23 21:20:03 +0100 |
| commit | 5ab457904a9ff9eb0e08a07d596c8f742ec1a99a (patch) | |
| tree | 5350bcc4caeb92c22a545432529f9e6ac7d7d674 /bootcleanse.py | |
| parent | typo (diff) | |
| download | bootcleanse-5ab457904a9ff9eb0e08a07d596c8f742ec1a99a.tar.gz bootcleanse-5ab457904a9ff9eb0e08a07d596c8f742ec1a99a.tar.bz2 bootcleanse-5ab457904a9ff9eb0e08a07d596c8f742ec1a99a.tar.xz | |
remove all boot flags
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'bootcleanse.py')
| -rwxr-xr-x | bootcleanse.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bootcleanse.py b/bootcleanse.py index 6e57223..85443ab 100755 --- a/bootcleanse.py +++ b/bootcleanse.py @@ -25,14 +25,14 @@ import sys from subprocess import Popen, PIPE -REMOVE_MBR_CODE = False -REMOVE_BOOT_FLAG = False +REMOVE_MBR_CODE = True +REMOVE_BOOT_FLAG = True mbrs = [] for arg in sys.argv[1:]: mbrs.append(arg) - print('Remove MBR code from ' + arg) + print('Remove MBR code from and deactive boot flag on primary paritions in ' + 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]') @@ -73,11 +73,11 @@ for mbr in mbrs: if REMOVE_MBR_CODE: dd(False, '/dev/zero', mbr, 'bs=440', 'count=1') if REMOVE_BOOT_FLAG: - p = 0 - status = dd(True, mbr, None, 'bs=1', 'count=1', 'skip=%i' % (446 + 16 * p)) - status = hex(status[0][0] & 127)[2:] - if len(status) == 1: - status = '0' + status - status = '\\x' + status - dd(status, None, mbr, 'bs=1', 'count=1', 'seek=%i' % (446 + 16 * p)) + for p in range(0, 4): + status = dd(True, mbr, None, 'bs=1', 'count=1', 'skip=%i' % (446 + 16 * p)) + status = hex(status[0][0] & 127)[2:] + if len(status) == 1: + status = '0' + status + status = '\\x' + status + dd(status, None, mbr, 'bs=1', 'count=1', 'seek=%i' % (446 + 16 * p)) |
