aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile52
-rw-r--r--README4
-rwxr-xr-xbootcleanse.py15
-rw-r--r--info/bootcleanse.texinfo19
5 files changed, 35 insertions, 56 deletions
diff --git a/.gitignore b/.gitignore
index dcaf39c..6248923 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-_/
__pycache__/
.*
!.git*
diff --git a/Makefile b/Makefile
index 0807c55..8caf049 100644
--- a/Makefile
+++ b/Makefile
@@ -14,59 +14,41 @@ PKGNAME = bootcleanse
COMMAND = bootcleanse
LICENSES = $(PREFIX)$(DATA)
-BOOK=bootcleanse
-BOOKDIR=info/
+BOOK = bootcleanse
+BOOKDIR = info/
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
-all: info
+all: info
-info: $(BOOK).info.gz
+info: $(BOOK).info
%.info: $(BOOKDIR)%.texinfo
$(MAKEINFO) "$<"
-%.info.gz: %.info
- gzip -9c < "$<" > "$@"
-
pdf: $(BOOK).pdf
%.pdf: $(BOOKDIR)%.texinfo
texi2pdf "$<"
-pdf.gz: $(BOOK).pdf.gz
-%.pdf.gz: %.pdf
- gzip -9c < "$<" > "$@"
-
-pdf.xz: $(BOOK).pdf.xz
-%.pdf.xz: %.pdf
- xz -e9 < "$<" > "$@"
-
-
dvi: $(BOOK).dvi
%.dvi: $(BOOKDIR)%.texinfo
$(TEXI2DVI) "$<"
-dvi.gz: $(BOOK).dvi.gz
-%.dvi.gz: %.dvi
- gzip -9c < "$<" > "$@"
-
-dvi.xz: $(BOOK).dvi.xz
-%.dvi.xz: %.dvi
- xz -e9 < "$<" > "$@"
-
install: install-cmd install-license install-info
install-cmd:
- install -dm755 "$(DESTDIR)$(PREFIX)$(BIN)"
- install -m755 bootcleanse.py "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)$(BIN)"
+ cp -- bootcleanse.py "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
install-license:
- install -dm755 "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
- install -m644 COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
+ mkdir -p -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
+ cp -- COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
-install-info: $(BOOK).info.gz
- install -dm755 "$(DESTDIR)$(PREFIX)$(DATA)/info"
- install -m644 "$(BOOK).info.gz" "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+install-info: $(BOOK).info
+ mkdir -p -- "$(DESTDIR)$(PREFIX)$(DATA)/info"
+ cp -- "$(BOOK).info" "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info"
uninstall:
@@ -74,10 +56,10 @@ uninstall:
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE"
-rmdir -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
- -rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
+ -rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info"
clean:
- -rm -r *.{t2d,aux,cp,cps,fn,ky,log,pg,pgs,toc,tp,vr,vrs,op,ops,bak,info,pdf,ps,dvi,gz} 2>/dev/null
-
-.PHONY: clean uninstall install
+ -rm -f -- *.t2d *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.toc *.tp
+ -rm -f -- *.vr *.vrs *.op *.ops *.bak *.info *.pdf *.ps *.dvi *.gz
+.PHONY: all clean uninstall install
diff --git a/README b/README
index b841d24..19c93f7 100644
--- a/README
+++ b/README
@@ -1,2 +1,2 @@
-bootcleanse is a simple script to remove old stuff from your boot
-sequence; just another part of cleaning your system from old crap.
+bootcleanse is a simple script that removes old stuff from your boot
+sequence; just another part of cleaning your system from old rubbish.
diff --git a/bootcleanse.py b/bootcleanse.py
index 241f81b..90664e6 100755
--- a/bootcleanse.py
+++ b/bootcleanse.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
bootcleanse – Cleanse your system from old MBR codes and boot flags
@@ -31,15 +31,15 @@ mbrs = []
for arg in sys.argv[1:]:
mbrs.append(arg)
- print('Remove MBR code from and deactive boot flag on primary paritions in ' + arg)
+ print('Remove MBR code and deactivate the boot flag on primary partitions 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]')
print()
print('If you are not sure what you are doing, you may want')
-print('to back up the first 512 byte 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 if=DEV.backup`.')
+print('to back up the first 512 bytes of each affected 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 if=DEV.backup')
print()
print('\033[01mProceed? [yes/no]\033[21m')
@@ -49,7 +49,7 @@ while True:
break
if yn == 'no':
exit(128)
- print('Only ‘yes’ and ‘no’ is valid')
+ print('Only ‘yes’ and ‘no’ are valid')
def dd(pipe, i, o, *extra):
cmd = ['sudo', 'dd']
@@ -64,7 +64,7 @@ def dd(pipe, i, o, *extra):
if type(pipe) is str:
cmd = ['\'' + a.replace('\'', '\'\\\'\'') + '\'' for a in cmd]
cmd = ' '.join(cmd)
- cmd = 'echo -e \'%s\' | %s' % (pipe, cmd)
+ cmd = 'printf \'%s\\n\' | %s' % (pipe, cmd)
cmd = ['sudo', 'sh', '-c', cmd]
return Popen(cmd, stdin=ch0, stdout=ch1, stderr=ch2).communicate()
@@ -79,4 +79,3 @@ for mbr in mbrs:
status = '0' + status
status = '\\x' + status
dd(status, None, mbr, 'bs=1', 'count=1', 'seek=%i' % (446 + 16 * p))
-
diff --git a/info/bootcleanse.texinfo b/info/bootcleanse.texinfo
index 02c066f..fe915bc 100644
--- a/info/bootcleanse.texinfo
+++ b/info/bootcleanse.texinfo
@@ -68,13 +68,13 @@ Texts. A copy of the license is included in the section entitled
@cindex overview
@cindex description
-@command{bootcleanse} is a simple script to remove old stuff from
+@command{bootcleanse} is a simple script that removes old stuff from
your boot sequence; just another part of cleaning your system from
-old crap. It is not very configurable, if you want something specific
-than removing the MBR and all boot flags (on primary partitions)
-from a set of drives you may want to copy the script and end it do
-do exactly want you want, but the chance of you needing to do that
-is extremely small.
+old rubbish. It is not very configurable. If you want something more
+specific than removing the MBR and all boot flags (on primary
+partitions) from a set of drives, you may want to copy the script and
+edit it to do exactly what you want, but the chance that you will need
+to do that is extremely small.
@node Invoking
@@ -85,9 +85,9 @@ is extremely small.
@cindex executing
@cindex running
-@command{bootcleanse} requires (unless you have an customised,
-unsecure system setup) super user and will tell you want it is
-about to do and ask if it sould proceed.
+@command{bootcleanse} requires (unless you have a customised,
+unsecure system set-up) superuser privileges, and will tell you what it
+is about to do and ask if it should proceed.
@command{bootcleanse} takes no options, but takes all arguments
and assumes those are the drives you want to remove the MBR code
@@ -140,4 +140,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@bye
-