-
Notifications
You must be signed in to change notification settings - Fork 87
/
setup-environment.sh
executable file
·42 lines (34 loc) · 1.15 KB
/
setup-environment.sh
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
#!/bin/bash
# setup-environment.sh - script to setup a building environment for termux-user-repository
set -e -u -o pipefail
# Enter the working directory
basedir=$(realpath $(dirname $0))
cd $basedir
# Checkout the master branch of termux/termux-packages
if [ -d "./termux-packages" ] && [ -d "./termux-packages/.git" ]; then
echo "Pulling termux-packages..."
pushd ./termux-packages
git reset --hard origin/master
git pull --rebase
popd
else
rm -rf ./termux-packages
git clone https://github.com/termux/termux-packages.git
fi
# Remove old stuffs
rm -rf {ndk-patches,packages,x11-packages,root-packages,scripts,build-all.sh,build-package.sh,clean.sh}
# Move build environment scripts to this folder
mv ./termux-packages/{ndk-patches,packages,x11-packages,root-packages,scripts,build-all.sh,build-package.sh,clean.sh} ./
# Apply script patches.
shopt -s nullglob
_patch=
for _patch in ./common-files/building-system-patches/*.patch; do
echo "Applying patch: $_patch"
patch --silent -p1 < $_patch
done
unset _patch
shopt -u nullglob
# Remove override packages
cat ./common-files/override-packages.txt | xargs rm -rfv --
# Remove files
rm -f build-package.sh.orig