-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·46 lines (36 loc) · 1.28 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env sh
PYTHON=$(command -v python || command -v python3)
if [ $? -ne 0 ]; then
echo 'No Python 3 found'
exit 1
fi
if [ ! -d venv ]; then
echo 'No venv found, creating one'
$PYTHON -m venv venv
chmod +x venv/bin/activate
fi
source venv/bin/activate
PIP=$(command -v pip || command -v pip3)
for package in whiptail-dialogs; do
INFO=$($PIP show $package 2> /dev/null)
if [ $? -ne 0 ]; then
$PIP install $package
else
version=$(sed -rn 's/Version: //p' <<< $INFO)
for patch in "patches/${package}*"; do
p=$patch
patch_version=$(echo $patch | cut -d= -f2)
if ! sort --help | grep -- '--version-sort' > /dev/null; then
echo "Your 'sort' doesn't have the -V/--version-sort option, required to check if patches need to be applied. Applying anyway"
fi
if [ $(printf "${version}\n${patch_version}" | sort --version-sort | tail -n 1) != "${patch_version}" ]; then
echo "Newer version of ${package} than required for patch, skipping"
continue
fi
echo Applying ${patch}
cat ${patch} | patch -p0 --forward -r -
done
fi
done
echo 'Dependencies satisfied, running menu...'
$PYTHON menu.py