Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
34665477
Commit
34665477
authored
Jul 13, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added prefix support to make uninstall
parent
8fd98939
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
Makefile.in
Makefile.in
+8
-10
setup.py
setup.py
+20
-9
No files found.
Makefile.in
View file @
34665477
...
@@ -18,7 +18,6 @@ ifeq ($(strip $(prefix)),)
...
@@ -18,7 +18,6 @@ ifeq ($(strip $(prefix)),)
else
else
PREFIX
=
"--prefix=
$(prefix)
"
PREFIX
=
"--prefix=
$(prefix)
"
endif
endif
START_SCRIPT
=
"binwalk-start"
.PHONY
:
all install build deps clean uninstall
.PHONY
:
all install build deps clean uninstall
...
@@ -35,13 +34,12 @@ build:
...
@@ -35,13 +34,12 @@ build:
$(PYTHON)
./setup.py build
$(PYTHON)
./setup.py build
start-script
:
start-script
:
echo
'#!/bin/sh'
>
$(START_SCRIPT)
echo
'#\!/bin/sh'
>
$@
echo
"PREFIX=
\"
$(prefix)
\"
"
>>
$(START_SCRIPT)
echo
"PREFIX=
\"
$(prefix)
\"
"
>>
$@
echo
'PYVERSION=`python --version 2>&1 | cut -d'
' -f2 | cut -d'
.
' -f1,2`'
>>
$(START_SCRIPT)
echo
'PYVERSION=`python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1,2`'
>>
$@
echo
'export PYTHONPATH="\$PREFIX/lib/python$PYVERSION/site-packages"'
>>
$(START_SCRIPT)
echo
'export PYTHONPATH="$$PREFIX/lib/python$$PYVERSION/site-packages"'
>>
$@
echo
'\$PREFIX/bin/binwalk "\$@"'
>>
$(START_SCRIPT)
echo
'$$PREFIX/bin/binwalk "$$@"'
>>
$@
chmod +x
$(START_SCRIPT)
chmod +x
$@
clean
:
clean
:
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
clean
;
fi
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
clean
;
fi
...
@@ -49,9 +47,9 @@ clean:
...
@@ -49,9 +47,9 @@ clean:
distclean
:
clean
distclean
:
clean
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
distclean
;
fi
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
distclean
;
fi
rm
-rf
Makefile config.
*
*
.cache
$(START_SCRIPT)
rm
-rf
Makefile config.
*
*
.cache
start-script
uninstall
:
uninstall
:
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
uninstall
;
fi
if
[
"
$(BUILD_C_LIBS)
"
-eq
"1"
]
;
then
make
-C
$(SRC_C_DIR)
uninstall
;
fi
$(PYTHON)
./setup.py uninstall
$(PYTHON)
./setup.py uninstall
--pydir
=
`
find
$(prefix)
/lib
-name
binwalk | head
-1
`
--pybin
=
`
find
$(prefix)
/bin
-name
binwalk | head
-1
`
setup.py
View file @
34665477
...
@@ -47,18 +47,25 @@ def find_binwalk_module_paths():
...
@@ -47,18 +47,25 @@ def find_binwalk_module_paths():
return
paths
return
paths
def
remove_binwalk_module
():
def
remove_binwalk_module
(
pydir
=
None
,
pybin
=
None
):
for
path
in
find_binwalk_module_paths
():
if
pydir
:
module_paths
=
[
pydir
]
else
:
module_paths
=
find_binwalk_module_paths
()
for
path
in
module_paths
:
try
:
try
:
remove_tree
(
path
)
remove_tree
(
path
)
except
OSError
as
e
:
except
OSError
as
e
:
pass
pass
script_path
=
which
(
MODULE_NAME
)
if
not
pybin
:
if
script_path
:
pybin
=
which
(
MODULE_NAME
)
if
pybin
:
try
:
try
:
print
(
"removing '
%
s'"
%
script_path
)
print
(
"removing '
%
s'"
%
pybin
)
os
.
unlink
(
script_path
)
os
.
unlink
(
pybin
)
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
pass
pass
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -66,16 +73,20 @@ def remove_binwalk_module():
...
@@ -66,16 +73,20 @@ def remove_binwalk_module():
class
UninstallCommand
(
Command
):
class
UninstallCommand
(
Command
):
description
=
"Uninstalls the Python module"
description
=
"Uninstalls the Python module"
user_options
=
[]
user_options
=
[
(
'pydir='
,
None
,
'Specify the path to the binwalk python module to be removed.'
),
(
'pybin='
,
None
,
'Specify the path to the binwalk executable to be removed.'
),
]
def
initialize_options
(
self
):
def
initialize_options
(
self
):
pass
self
.
pydir
=
None
self
.
pybin
=
None
def
finalize_options
(
self
):
def
finalize_options
(
self
):
pass
pass
def
run
(
self
):
def
run
(
self
):
remove_binwalk_module
()
remove_binwalk_module
(
self
.
pydir
,
self
.
pybin
)
class
CleanCommand
(
Command
):
class
CleanCommand
(
Command
):
description
=
"Clean Python build directories"
description
=
"Clean Python build directories"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment