-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall-patched-libusb-1.0.26.sh
executable file
·55 lines (46 loc) · 1.41 KB
/
install-patched-libusb-1.0.26.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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# =======
# Another Term libusb wrapper build script
# =======
# Enjoy any software dynamically linked to the libusb without rooting your Android device.
# Targeted for any distro with **apt**, **apk** and **yum** at the moment.
# Tested with Debian, Alpine and CentOS only yet.
set -e
if [ $(id -u) -ne 0 ]
then
echo 'It should be run as root!' >&2
echo '(Emulated by PRoot)' >&2
exit 1
fi
(
which apt-get >/dev/null 2>&1 && {
apt-get install git binutils gcc g++ make m4 autoconf automake libtool pkg-config gettext
exit 0
}
which apk >/dev/null 2>&1 && {
apk add linux-headers git binutils gcc g++ make m4 autoconf automake libtool pkg-config gettext usbutils
exit 0
}
which yum >/dev/null 2>&1 && {
yum install git binutils gcc gcc-c++ make m4 autoconf automake libtool pkg-config gettext
exit 0
}
echo 'No idea about your distribution...'
echo 'Presuming prerequisites are already installed.'
exit 0
)
mkdir -p build
cd build
PKG_NAME='libusb'
git clone "https://github.com/green-green-avk/$PKG_NAME.git"
cd "$PKG_NAME"
git checkout 'v1.0.26-android-libusbmanager'
./bootstrap.sh
./configure --prefix='/opt/libusb' --enable-android-helper="$APP_ID.libusb"
make && make install
echo
echo 'Setting up LD_LIBRARY_PATH...'
echo 'export LD_LIBRARY_PATH="/opt/libusb/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"' > /etc/profile.d/libusb.sh
echo 'Done.'
echo
echo 'The libusb wrapper will work in newly started sessions. Enjoy!'