88 YES=0
99fi
1010
11+ set -eu
1112set -o nounset
13+ set -x
1214
1315if ! which lsb_release > /dev/null
1416then
6062PYTHON3_APT_CANDIDATES=" "
6163PYTHON3_YUM_CANDIDATES=" "
6264YUM_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
6668if [ $UID -eq 0 ]
6769then
70+ echo " UID is 0, sudo not required"
6871 SUDO=" "
6972else
70- SUDO=" sudo"
73+ SUDO=" sudo -E "
7174 REQUIRED_UTILS=" sudo $REQUIRED_UTILS "
7275fi
7376
7477function 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
8184function 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
8891function 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
124127function 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
131134function 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
141140function find_path
@@ -240,14 +239,6 @@ then
240239 exit 1
241240fi
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)
252243cd /tmp
253244$SUDO $PKGCMD $PKGCMD_OPTS $PKG_CANDIDATES
0 commit comments