Skip to content

Commit 772f271

Browse files
authored
Merge pull request #531 from ReFirmLabs/530-fix-sasquatch-in-binwalk-docker-container
530 fix sasquatch in binwalk docker container
2 parents 80a519b + c84bec1 commit 772f271

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist
33
.coverage
44
*.extracted
55
*.pyc
6+
**/*.egg-info

.travis.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ addons:
66
apt:
77
update: true
88
install:
9+
- export PYTHON=$(which python3)
910
- ./deps.sh --yes
10-
- pip install coverage
11-
- ./setup.py install
12-
script: ./setup.py test
13-
cache: pip
11+
- sudo -E $PYTHON -mpip install coverage
12+
- sudo -E $PYTHON ./setup.py install
13+
script:
14+
- export PYTHON=$(which python3)
15+
- sudo -E $PYTHON ./setup.py test
1416
jobs:
1517
include:
1618
- stage: test

deps.sh

+14-23
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ else
88
YES=0
99
fi
1010

11+
set -eu
1112
set -o nounset
13+
set -x
1214

1315
if ! which lsb_release > /dev/null
1416
then
@@ -60,35 +62,36 @@ fi
6062
PYTHON3_APT_CANDIDATES=""
6163
PYTHON3_YUM_CANDIDATES=""
6264
YUM_CANDIDATES="git gcc gcc-c++ make openssl-devel qtwebkit-devel qt-devel gzip bzip2 tar arj p7zip p7zip-plugins cabextract squashfs-tools zlib zlib-devel lzo lzo-devel xz xz-compat-libs xz-libs xz-devel xz-lzma-compat python-backports-lzma lzip pyliblzma perl-Compress-Raw-Lzma lzop srecord"
63-
PIP_COMMANDS="pip3"
65+
PYTHON="$(which python3)"
6466

6567
# Check for root privileges
6668
if [ $UID -eq 0 ]
6769
then
70+
echo "UID is 0, sudo not required"
6871
SUDO=""
6972
else
70-
SUDO="sudo"
73+
SUDO="sudo -E"
7174
REQUIRED_UTILS="sudo $REQUIRED_UTILS"
7275
fi
7376

7477
function install_yaffshiv
7578
{
76-
git clone https://github.com/devttys0/yaffshiv
77-
(cd yaffshiv && $SUDO python3 setup.py install)
79+
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/yaffshiv
80+
(cd yaffshiv && $SUDO $PYTHON setup.py install)
7881
$SUDO rm -rf yaffshiv
7982
}
8083

8184
function install_sasquatch
8285
{
83-
git clone https://github.com/devttys0/sasquatch
86+
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch
8487
(cd sasquatch && $SUDO ./build.sh)
8588
$SUDO rm -rf sasquatch
8689
}
8790

8891
function install_jefferson
8992
{
90-
git clone https://github.com/sviehb/jefferson
91-
(cd jefferson && $SUDO pip3 install -r requirements.txt && $SUDO python3 setup.py install)
93+
git clone --quiet --depth 1 --branch "master" https://github.com/sviehb/jefferson
94+
(cd jefferson && $SUDO $PYTHON -mpip install -r requirements.txt && $SUDO $PYTHON setup.py install)
9295
$SUDO rm -rf jefferson
9396
}
9497

@@ -110,7 +113,7 @@ function install_cramfstools
110113
INSTALL_LOCATION=/usr/local/bin
111114

112115
# https://github.com/torvalds/linux/blob/master/fs/cramfs/README#L106
113-
git clone https://github.com/npitre/cramfs-tools
116+
git clone --quiet --depth 1 --branch "master" https://github.com/npitre/cramfs-tools
114117
# There is no "make install"
115118
(cd cramfs-tools \
116119
&& make \
@@ -123,19 +126,15 @@ function install_cramfstools
123126

124127
function install_ubireader
125128
{
126-
git clone https://github.com/jrspruitt/ubi_reader
127-
(cd ubi_reader && $SUDO python3 setup.py install)
129+
git clone --quiet --depth 1 --branch "master" https://github.com/jrspruitt/ubi_reader
130+
(cd ubi_reader && $SUDO $PYTHON setup.py install)
128131
$SUDO rm -rf ubi_reader
129132
}
130133

131134
function install_pip_package
132135
{
133136
PACKAGE="$1"
134-
135-
for PIP_COMMAND in $PIP_COMMANDS
136-
do
137-
$SUDO $PIP_COMMAND install $PACKAGE
138-
done
137+
$SUDO $PYTHON -mpip install $PACKAGE
139138
}
140139

141140
function find_path
@@ -240,14 +239,6 @@ then
240239
exit 1
241240
fi
242241

243-
# Check to see if we should install modules for python3 as well
244-
find_path python3
245-
if [ $? -eq 0 ]
246-
then
247-
PKG_CANDIDATES="$PKG_CANDIDATES $PKG_PYTHON3_CANDIDATES"
248-
PIP_COMMANDS="pip3 $PIP_COMMANDS"
249-
fi
250-
251242
# Do the install(s)
252243
cd /tmp
253244
$SUDO $PKGCMD $PKGCMD_OPTS $PKG_CANDIDATES

0 commit comments

Comments
 (0)