8
8
YES=0
9
9
fi
10
10
11
+ set -eu
11
12
set -o nounset
13
+ set -x
12
14
13
15
if ! which lsb_release > /dev/null
14
16
then
60
62
PYTHON3_APT_CANDIDATES=" "
61
63
PYTHON3_YUM_CANDIDATES=" "
62
64
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 ) "
64
66
65
67
# Check for root privileges
66
68
if [ $UID -eq 0 ]
67
69
then
70
+ echo " UID is 0, sudo not required"
68
71
SUDO=" "
69
72
else
70
- SUDO=" sudo"
73
+ SUDO=" sudo -E "
71
74
REQUIRED_UTILS=" sudo $REQUIRED_UTILS "
72
75
fi
73
76
74
77
function install_yaffshiv
75
78
{
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)
78
81
$SUDO rm -rf yaffshiv
79
82
}
80
83
81
84
function install_sasquatch
82
85
{
83
- git clone https://github.com/devttys0/sasquatch
86
+ git clone --quiet --depth 1 --branch " master " https://github.com/devttys0/sasquatch
84
87
(cd sasquatch && $SUDO ./build.sh)
85
88
$SUDO rm -rf sasquatch
86
89
}
87
90
88
91
function install_jefferson
89
92
{
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)
92
95
$SUDO rm -rf jefferson
93
96
}
94
97
@@ -110,7 +113,7 @@ function install_cramfstools
110
113
INSTALL_LOCATION=/usr/local/bin
111
114
112
115
# 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
114
117
# There is no "make install"
115
118
(cd cramfs-tools \
116
119
&& make \
@@ -123,19 +126,15 @@ function install_cramfstools
123
126
124
127
function install_ubireader
125
128
{
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)
128
131
$SUDO rm -rf ubi_reader
129
132
}
130
133
131
134
function install_pip_package
132
135
{
133
136
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
139
138
}
140
139
141
140
function find_path
@@ -240,14 +239,6 @@ then
240
239
exit 1
241
240
fi
242
241
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
-
251
242
# Do the install(s)
252
243
cd /tmp
253
244
$SUDO $PKGCMD $PKGCMD_OPTS $PKG_CANDIDATES
0 commit comments